summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortroy.nordine <troy.nordine@thomsonreuters.com>2023-09-19 14:46:53 -0500
committerTor Andersson <tor@ccxvii.net>2023-12-10 18:16:55 +0100
commitb23d9b61271355f9f32b95f2b4a496d57462db12 (patch)
treed935ab4accd21fa8f00aef9ec4f3b8ae17528cd9
parente3d722f793e2307bb0be1566c8cf6f35c730479c (diff)
downloadplantagenet-b23d9b61271355f9f32b95f2b4a496d57462db12.tar.gz
some incremental updates.
-rw-r--r--data.js16
-rw-r--r--play.js81
-rw-r--r--rules.js37
-rw-r--r--tools/gendata.js16
4 files changed, 77 insertions, 73 deletions
diff --git a/data.js b/data.js
index 703f211..6a40af5 100644
--- a/data.js
+++ b/data.js
@@ -196,19 +196,19 @@ lords:[
{"side":"Lancaster","name":"Warwick L","full_name":"Richard Neville","title":"Earl of Warwick","seats":[51],"marshal":1,"influence":5,"lordship":3,"command":2,"valour":2,"forces":{"retinue":1,"men_at_arms":3,"longbowmen":3},"assets":{"cart":2,"prov":2,"coin":2},"ships":2,"id":"lord_warwick_l"},
],
vassals:[
-{"service":1,"name":"Norfolk","seat":[14],"influence":0},
+{"service":3,"name":"Westmoreland","seat":[2],"influence":0},
{"service":1,"name":"Stanley","seat":[44],"influence":0},
+{"service":1,"name":"Dudley","seat":[42],"influence":0},
+{"service":2,"name":"Shrewsbury","seat":[10],"influence":-1},
+{"service":3,"name":"Worcester","seat":[46],"influence":0},
+{"service":2,"name":"Oxford","seat":[28],"influence":0},
+{"service":1,"name":"Essex","seat":[31],"influence":0},
+{"service":3,"name":"Suffolk","seat":[35],"influence":1},
{"service":3,"name":"Fauconberg","seat":[17],"influence":2},
+{"service":1,"name":"Norfolk","seat":[14],"influence":0},
{"service":2,"name":"Devon","seat":[21],"influence":-1},
-{"service":3,"name":"Suffolk","seat":[35],"influence":1},
{"service":1,"name":"Bonville","seat":[23],"influence":1},
-{"service":1,"name":"Dudley","seat":[42],"influence":0},
{"service":1,"name":"Beaumont","seat":[49],"influence":-2},
-{"service":2,"name":"Oxford","seat":[28],"influence":0},
-{"service":2,"name":"Shrewsbury","seat":[10],"influence":-1},
-{"service":1,"name":"Essex","seat":[31],"influence":0},
-{"service":3,"name":"Westmoreland","seat":[2],"influence":0},
-{"service":3,"name":"Worcester","seat":[46],"influence":0},
{"service":0,"name":"Trollope","seat":[],"influence":0,"capability":"Andrew Trollope"},
{"service":0,"name":"Clifford","seat":[],"influence":0,"capability":"My father's blood"},
{"service":0,"name":"Edward","seat":[],"influence":0,"capability":"Edward"},
diff --git a/play.js b/play.js
index 1332245..ef9b28f 100644
--- a/play.js
+++ b/play.js
@@ -37,7 +37,7 @@ function pack4_get(word, n) {
}
function pack8_get(word, n) {
- n = n << 4
+ n = n << 3
return (word >>> n) & 255
}
@@ -195,8 +195,8 @@ const asset_type_count = 4
const asset_action_name = [ "prov", "coin", "cart", "ship" ]
const asset_type_x34 = [ 1, 1, 1, 0]
-const VASSAL_UNAVAILABLE = -1
-const VASSAL_READY = -2
+const VASSAL_UNAVAILABLE = 201
+const VASSAL_READY = 200
const NOWHERE = -1
const CALENDAR = 100
@@ -395,13 +395,13 @@ function is_vassal_unavailable(vassal) {
function get_vassal_locale(vassal) {
- return pack8_get(view.pieces.vassal[vassal], 1)
+ return pack8_get(view.pieces.vassals[vassal], 1)
}
function get_vassals_with_lord(lord) {
let results = []
for (let x = first_vassal; x < last_vassal; x++) {
- if (pack8_get(view.pieces.vassal[x], 0) === lord) {
+ if (pack8_get(view.pieces.vassals[x], 0) === lord) {
results.push(x)
}
}
@@ -564,7 +564,7 @@ const ui = {
lord_cylinder: [],
lord_mat: [],
lord_buttons: [],
- vassal_service: [],
+ map_vassals: [],
forces: [],
routed: [],
assets: [],
@@ -801,7 +801,7 @@ function build_map() {
let xc = Math.round(x + w / 2)
let yc = Math.round(y + h / 2)
let small = 46
- e.className = "marker " + vassal.name
+ e.className = "hide marker " + vassal.name
e.style.position = "absolute"
e.style.top = y + "px"
e.style.left = x + "px"
@@ -810,7 +810,22 @@ function build_map() {
e.style.backgroundSize = small + "px"
register_action(e, "vassal", ix)
register_tooltip(e, data.vassalbox[ix].name)
- e.classList.toggle("hide", !is_vassal_ready(ix))
+// e.classList.toggle("hide", !is_vassal_ready(ix))
+ document.getElementById("pieces").appendChild(e)
+ })
+
+ data.vassals.forEach((vassal, ix) => {
+ let e = ui.map_vassals[ix] = document.createElement("div")
+ e.className = "hide marker square " + vassal.name
+ e.style.position = "absolute"
+ e.style.width = 46 + "px"
+ e.style.height = 46 + "px"
+ e.style.backgroundSize = 46 + "px"
+
+ register_action(e, "vassal", ix)
+ register_tooltip(e, data.vassals[ix].name)
+
+// e.classList.toggle("hide", is_vassal_ready(ix))
document.getElementById("pieces").appendChild(e)
})
@@ -935,11 +950,9 @@ function layout_locale_cylinders(loc) {
if (!is_upper)
++n
- let wrap = 3
+ let wrap = 2
switch (data.locales[loc].type) {
- case "region": wrap = 2; break
- case "town": wrap = 2; break
- case "novgorod": wrap = 4; break
+ case "london": wrap = 3; break
}
let m = Math.floor((n-1) / wrap)
@@ -1123,31 +1136,11 @@ function update_valour(lord, parent, battle) {
}
}
-function update_vassals(ready_parent, mustered_parent, lord_ix) {
- /* TODO: vassals currently with lord
- for (let v of data.lords[lord_ix].vassals) {
- let e = ui.vassal_service[v]
- if (is_vassal_ready(v)) {
- e.classList.remove("hide")
- ready_parent.appendChild(e)
- }
- else if (is_vassal_mustered(v)) {
- e.classList.remove("hide")
- mustered_parent.appendChild(e)
- }
- else {
- e.classList.add("hide")
- }
- e.classList.toggle("action", is_action("vassal", v))
- }
- */
-}
function update_lord_mat(ix) {
if (view.reveal & (1 << ix)) {
ui.lord_mat[ix].classList.remove("hidden")
update_assets(ix, ui.assets[ix], view.pieces.assets[ix])
- // update_vassals(ui.ready_vassals[ix], ui.mustered_vassals[ix], ix)
update_forces(ui.forces[ix], view.pieces.forces[ix], ix, false)
update_forces(ui.routed[ix], view.pieces.routed[ix], ix, true)
ui.lord_feed[ix].classList.toggle("hide", count_lord_all_forces(ix) <= 6)
@@ -1418,18 +1411,23 @@ function update_court() {
lcourt.appendChild(ui.lord_mat[lord])
}
-function update_calendar_vassals() {
- for (let v in data.vassals) {
+function update_vassals() {
+ for (let v = first_vassal; v < last_vassal; v++) {
let info = data.vassals[v]
- let e = ui.map_vassals[v]
- e.classList.add("hide")
if (!is_vassal_ready(v) && get_vassal_locale(v) !== 0) {
- calendar_layout_vassal[get_vassal_locale(v) - CALENDAR] = e
+ let e = ui.map_vassals[v]
+ e.classList.add("hide")
+ calendar_layout_vassal[get_vassal_locale(v) - CALENDAR].push(e)
e.classList.remove("hide")
e.classList.toggle("action", is_action("vassal", v))
e.classList.add("vassal" + clean_name(info.name))
e.classList.add("back", is_vassal_unavailable(v))
- }
+ } else if (is_vassal_ready(v)) {
+ let e = ui.vassalbox[v]
+ e.classList.remove("hide")
+ e.classList.toggle("action", is_action("vassal", v))
+ e.classList.add("vassal" + clean_name(info.name))
+ }
}
}
@@ -1453,7 +1451,7 @@ function on_update() {
}
}
- update_calendar_vassals()
+ update_vassals()
layout_calendar()
//layout_track()
@@ -1569,6 +1567,11 @@ function on_update() {
action_button("stronghold", "Stronghold")
action_button("port", "Port")
+ // Pay or Disband
+ action_button("pay", "Pay")
+ action_button("disband", "Disband")
+
+
// Events
action_button("decline", "Decline")
action_button("deploy", "Deploy")
diff --git a/rules.js b/rules.js
index d9e6bd7..f1b27b5 100644
--- a/rules.js
+++ b/rules.js
@@ -342,15 +342,15 @@ const VASSAL_FAUCONBERG = find_vassal('Fauconberg')
const VASSAL_NORFOLK = find_vassal('Norfolk')
const VASSAL_OXFORD = find_vassal('Oxford')
const VASSAL_SHREWSBURY = find_vassal('Shrewsbury')
-const VASSAL_STANLEY1 = find_vassal('Stanley1')
+const VASSAL_STANLEY = find_vassal('Stanley')
const VASSAL_SUFFOLK = find_vassal('Suffolk')
-const VASSAL_WESTMORLD = find_vassal('Westmorld')
+const VASSAL_WESTMORLAND = find_vassal('Westmoreland')
const VASSAL_WORCESTER = find_vassal('Worcester')
const VASSAL_CLIFFORD = find_vassal('Clifford')
const VASSAL_EDWARD = find_vassal('Edward')
const VASSAL_HASTINGS = find_vassal('Hastings')
const VASSAL_MONTAGU = find_vassal('Montagu')
-const VASSAL_STANLEY2 = find_vassal('Stanley2')
+const VASSAL_THOMAS_STANLEY = find_vassal('Thomas Stanley')
const VASSAL_TROLLOPE = find_vassal('Trollope')
const AOW_LANCASTER_CULVERINS_AND_FALCONETS = [ L1, L2 ] // TODO
@@ -502,8 +502,8 @@ const EVENT_YORK_PATRICK_DE_LA_MOTE = Y37 // TODO
// Check all push/clear_undo
-const VASSAL_UNAVAILABLE = -1
-const VASSAL_READY = -2
+const VASSAL_UNAVAILABLE = 201
+const VASSAL_READY = 200
//const VASSAL_MUSTERED = -3
const NOBODY = -1
@@ -1103,23 +1103,23 @@ function setup_vassals(excludes = []) {
for (let x = first_vassal; x < last_vassal; x++) {
if (!excludes.includes(x) && data.vassals[x].capability === undefined) {
set_vassal_ready(x)
- set_vassal_on_map(data.vassals[x].seat[0])
+ set_vassal_on_map(x, data.vassals[x].seat[0])
}
}
}
function set_vassal_on_map(vassal, loc) {
- game.pieces.vassal[vassal] = pack8_set(game.pieces.vassal[vassal], 1, loc)
+ game.pieces.vassals[vassal] = pack8_set(game.pieces.vassals[vassal], 1, loc)
}
function get_vassal_locale(vassal) {
- return pack8_get(game.pieces.vassal[vassal], 1)
+ return pack8_get(game.pieces.vassals[vassal], 1)
}
function get_vassals_with_lord(lord) {
let results = []
for (let x = first_vassal; x < last_vassal; x++) {
- if (pack8_get(game.pieces.vassal[x], 0) === lord) {
+ if (pack8_get(game.pieces.vassals[x], 0) === lord) {
results.push(x)
}
}
@@ -1128,19 +1128,19 @@ function get_vassals_with_lord(lord) {
}
function set_vassal_ready(vassal) {
- game.pieces.vassal[vassal] = pack8_set(game.pieces.vassals[vassal], 0, VASSAL_READY)
+ game.pieces.vassals[vassal] = pack8_set(game.pieces.vassals[vassal], 0, VASSAL_READY)
}
function set_vassal_on_calendar(vassal, turn) {
- game.pieces.vassal[vassal] = pack8_set(game.pieces.vassal[vassal], 1, turn + CALENDAR)
+ game.pieces.vassals[vassal] = pack8_set(game.pieces.vassals[vassal], 1, turn + CALENDAR)
}
function set_vassal_with_lord(vassal, lord) {
- game.pieces.vassal[vassal] = pack8_set(game.pieces.vassal[vassal], 0, lord)
+ game.pieces.vassals[vassal] = pack8_set(game.pieces.vassals[vassal], 0, lord)
}
function set_vassal_unavailable(vassal) {
- game.pieces.vassal[vassal] = pack8_set(game.pieces.vassals[vassal], 0, VASSAL_UNAVAILABLE)
+ game.pieces.vassals[vassal] = pack8_set(game.pieces.vassals[vassal], 0, VASSAL_UNAVAILABLE)
}
function muster_vassal(vassal, lord) {
@@ -1167,7 +1167,7 @@ function get_ready_vassals() {
let results = []
for (let x = first_vassal; x < last_vassal; x++) {
- if (is_vassal_ready(x) && favor.includes(x)) {
+ if (is_vassal_ready(x) && favor.includes(data.vassals[x].seat[0])) {
results.push(x)
}
}
@@ -1184,7 +1184,7 @@ function is_vassal_ready(vassal) {
}
function is_vassal_mustered(vassal) {
- return pack8_get(game.pieces.vassals[vassal]) >= 0
+ return pack8_get(game.pieces.vassals[vassal]) < VASSAL_READY
}
function is_york_lord(lord) {
@@ -5882,6 +5882,7 @@ function end_pay_lords() {
states.pay_lords = {
inactive: "Pay Lords",
prompt() {
+ view.prompt = "Pay Lords in Influence or Disband them."
prompt_held_event()
let done = true
@@ -5909,7 +5910,7 @@ states.pay_lords = {
game.who = NOBODY
},
pay() {
- reduce_influence(is_exile_box(get_lord_locale(game.who)) ? 2 : 1)
+ reduce_influence(is_exile(get_lord_locale(game.who)) ? 2 : 1)
set_lord_moved(game.who, 0)
game.who = NOBODY
},
@@ -6654,12 +6655,12 @@ function pack4_set(word, n, x) {
}
function pack8_get(word, n) {
- n = n << 4
+ n = n << 3
return (word >>> n) & 255
}
function pack8_set(word, n, x) {
- n = n << 4
+ n = n << 3
return (word & ~(255 << n)) | (x << n)
}
diff --git a/tools/gendata.js b/tools/gendata.js
index a05c325..4521bd3 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -1684,19 +1684,19 @@ lords.forEach(lord => {
lord.id = "lord_" + clean_name(lord.name)
})
-vassal(1, "Norfolk", seats("Arundel"), 0)
+vassal(3, "Westmoreland", seats("Appleby"), 0)
vassal(1, "Stanley", seats("Derby"), 0)
+vassal(1, "Dudley", seats("Leicester"), 0)
+vassal(2, "Shrewsbury", seats("Shrewsbury"), -1)
+vassal(3, "Worcester", seats("Worcester"), 0)
+vassal(2, "Oxford", seats("Oxford"), 0)
+vassal(1, "Essex", seats("St Albans"), 0)
+vassal(3, "Suffolk", seats("Ipswich"), 1)
vassal(3, "Fauconberg", seats("Dover"), 2)
+vassal(1, "Norfolk", seats("Arundel"), 0)
vassal(2, "Devon", seats("Exeter"), -1)
-vassal(3, "Suffolk", seats("Ipswich"), 1)
vassal(1, "Bonville", seats("Launceston"), 1)
-vassal(1, "Dudley", seats("Leicester"), 0)
vassal(1, "Beaumont", seats("Lincoln"), -2)
-vassal(2, "Oxford", seats("Oxford"), 0)
-vassal(2, "Shrewsbury", seats("Shrewsbury"), -1)
-vassal(1, "Essex", seats("St Albans"), 0)
-vassal(3, "Westmoreland", seats("Appleby"), 0)
-vassal(3, "Worcester", seats("Worcester"), 0)
vassal(0, "Trollope", seats(''), 0, "Andrew Trollope")
vassal(0, "Clifford", seats(''), 0, "My father's blood")