From e018d811bfcb8fe0245189c3cce6c9867315c3c6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 28 Apr 2024 18:14:03 +0200 Subject: Fix seat data. --- data.js | 6 +++--- rules.ts | 48 ++++++++++++++++++++++++++++++------------------ tools/gendata.js | 6 +++--- tools/layout.svg | 45 +++++++++++++++++++++++---------------------- 4 files changed, 59 insertions(+), 46 deletions(-) diff --git a/data.js b/data.js index 84a83e3..0517b73 100644 --- a/data.js +++ b/data.js @@ -157,7 +157,7 @@ lords:[ {"side":"York","name":"Northumberland Y1","short_name":"Northumberland","full_name":"Henry Percy","title":"Northumberland","seat":4,"marshal":0,"influence":4,"lordship":2,"command":2,"valour":1,"forces":{"retinue":1,"men_at_arms":2,"longbowmen":2,"militia":4},"assets":{"cart":2,"prov":2,"coin":2},"ships":0,"id":"lord_northumberland_y1"}, {"side":"York","name":"Northumberland Y2","short_name":"Northumberland","full_name":"Henry Percy","title":"Northumberland","seat":4,"marshal":0,"influence":4,"lordship":2,"command":2,"valour":1,"forces":{"retinue":1,"men_at_arms":2,"longbowmen":2,"militia":2},"assets":{"cart":2,"prov":2,"coin":2},"ships":0,"id":"lord_northumberland_y2"}, {"side":"York","name":"Gloucester 1","short_name":"Gloucester","full_name":"Richard Plantagenet","title":"Duke of Gloucester","seat":27,"marshal":1,"influence":2,"lordship":2,"command":3,"valour":2,"forces":{"retinue":1,"men_at_arms":2,"longbowmen":2},"assets":{"cart":1,"prov":1,"coin":1},"ships":0,"id":"lord_gloucester_1"}, -{"side":"York","name":"Gloucester 2","short_name":"Gloucester","full_name":"Richard Plantagenet","title":"Duke of Gloucester","seat":27,"marshal":1,"influence":5,"lordship":3,"command":3,"valour":2,"forces":{"retinue":1,"men_at_arms":3,"longbowmen":3,"militia":4},"assets":{"cart":2,"prov":2,"coin":4},"ships":0,"id":"lord_gloucester_2"}, +{"side":"York","name":"Gloucester 2","short_name":"Gloucester","full_name":"Richard Plantagenet","title":"Duke of Gloucester","seat":30,"marshal":1,"influence":5,"lordship":3,"command":3,"valour":2,"forces":{"retinue":1,"men_at_arms":3,"longbowmen":3,"militia":4},"assets":{"cart":2,"prov":2,"coin":4},"ships":0,"id":"lord_gloucester_2"}, {"side":"York","name":"Richard III","short_name":"Richard III","full_name":"Richard Plantagenet","title":"King of England","seat":30,"marshal":2,"influence":5,"lordship":3,"command":3,"valour":2,"forces":{"retinue":1,"men_at_arms":3,"longbowmen":2,"militia":4},"assets":{"cart":2,"prov":2,"coin":4},"ships":0,"id":"lord_richard_iii"}, {"side":"York","name":"Norfolk","short_name":"Norfolk","full_name":"John Howard","title":"Duke of Norfolk","seat":14,"marshal":0,"influence":3,"lordship":3,"command":2,"valour":2,"forces":{"retinue":1,"men_at_arms":2,"longbowmen":2,"militia":2},"assets":{"cart":2,"prov":2,"coin":2},"ships":0,"id":"lord_norfolk"}, {"side":"York","name":"Warwick Y","short_name":"Warwick","full_name":"Richard Neville","title":"Earl of Warwick","seat":51,"marshal":1,"influence":5,"lordship":3,"command":2,"valour":1,"forces":{"retinue":1,"men_at_arms":3,"longbowmen":3},"assets":{"prov":2,"coin":2},"ships":2,"id":"lord_warwick_y"}, @@ -417,8 +417,8 @@ seat:[ {"name":"seat lancaster lord_buckingham","box":{"x":715,"y":958,"w":54,"h":56}}, {"name":"seat lancaster lord_northumberland_l","box":{"x":397,"y":405,"w":54,"h":56}}, {"name":"seat lancaster lord_clarence","box":{"x":654,"y":593,"w":54,"h":56}}, -{"name":"seat lancaster lord_jasper_tudor_1","box":{"x":147,"y":1067,"w":54,"h":56}}, -{"name":"seat lancaster lord_jasper_tudor_2","box":{"x":230,"y":888,"w":54,"h":56}}, +{"name":"seat lancaster lord_jasper_tudor_1","box":{"x":153,"y":1064,"w":54,"h":56}}, +{"name":"seat lancaster lord_jasper_tudor_2","box":{"x":233,"y":890,"w":54,"h":56}}, {"name":"seat lancaster lord_henry_tudor","box":{"x":944,"y":1144,"w":54,"h":56}}, {"name":"seat lancaster lord_oxford","box":{"x":771,"y":1092,"w":54,"h":56}}, {"name":"seat lancaster lord_warwick_l","box":{"x":1118,"y":1385,"w":54,"h":56}}, diff --git a/rules.ts b/rules.ts index b13b336..54ffaeb 100644 --- a/rules.ts +++ b/rules.ts @@ -494,6 +494,14 @@ function is_lieutenant(lord: Lord) { } } +function get_lord_seat(lord: Lord): Locale { + return data.lords[lord].seat +} + +function get_vassal_seat(v: Vassal): Locale { + return data.vassals[v].seat +} + // from !node tools/gendata.js function is_seaport(x: Locale) { return x === 1 || (x >= 5 && x <= 6) || (x >= 14 && x <= 15) || x === 17 || (x >= 19 && x <= 22) || x === 24 || x === 26 || x === 35 || x === 37 || x === 51 || (x >= 56 && x <= 57) } function is_port_1(x: Locale) { return x === 1 || x === 35 || x === 37 || (x >= 56 && x <= 57) } @@ -2826,15 +2834,18 @@ function can_lord_muster(lord: Lord) { function has_locale_to_muster(lord: Lord) { // Can muster at own seat without enemy lord. - if (!has_enemy_lord(data.lords[lord].seat)) - if (is_move_allowed(lord, data.lords[lord].seat)) + let seat = get_lord_seat(lord) + if (!has_enemy_lord(seat)) + if (is_move_allowed(lord, seat)) return true // Else, can muster at any friendly seat (of a friendly lord who is also in play) - for (let other of all_friendly_lords()) - if (is_lord_in_play(other) && is_friendly_locale(data.lords[other].seat)) - if (is_move_allowed(lord, data.lords[other].seat)) + for (let other of all_friendly_lords()) { + let other_seat = get_lord_seat(other) + if (is_lord_in_play(other) && is_friendly_locale(other_seat)) + if (is_move_allowed(lord, other_seat)) return true + } // Tough luck! return false @@ -3083,7 +3094,7 @@ function do_levy_ship() { function chamberlains_eligible_levy(loc: Locale) { if (lord_has_capability(game.command, AOW_LANCASTER_CHAMBERLAINS)) { for (let vassal of all_vassals) - if (is_vassal_mustered_with(vassal, game.command) && loc === data.vassals[vassal].seat) + if (is_vassal_mustered_with(vassal, game.command) && loc === get_vassal_seat(vassal)) return true } return false @@ -3161,7 +3172,7 @@ states.levy_lord_at_seat = { prompt() { view.prompt = `Levy Lord: Choose a stronghold for ${lord_name[game.who]}.` let found = false - let seat = data.lords[game.who].seat + let seat = get_lord_seat(game.who) if (!has_enemy_lord(seat) && is_move_allowed(game.who, seat)) { gen_action_locale(seat) found = true @@ -3169,9 +3180,10 @@ states.levy_lord_at_seat = { if (!found) { for (let lord of all_friendly_lords()) { - if ((is_lord_on_map(lord) || is_lord_on_calendar(lord)) && is_friendly_locale(data.lords[lord].seat)) { - if (is_move_allowed(game.who, data.lords[lord].seat)) - gen_action_locale(data.lords[lord].seat) + let seat = get_lord_seat(lord) + if ((is_lord_on_map(lord) || is_lord_on_calendar(lord)) && is_friendly_locale(seat)) { + if (is_move_allowed(game.who, seat)) + gen_action_locale(seat) } } } @@ -3206,12 +3218,12 @@ function can_levy_vassal(vassal: Vassal) { return false } if ( - !is_friendly_locale(data.vassals[vassal].seat) && + !is_friendly_locale(get_vassal_seat(vassal)) && (game.command !== LORD_HENRY_TUDOR || !is_event_in_play(EVENT_LANCASTER_MARGARET_BEAUFORT)) ) { return false } - if (!is_friendly_locale(data.vassals[vassal].seat)) + if (!is_friendly_locale(get_vassal_seat(vassal))) return false if ( game.active === LANCASTER && @@ -3799,7 +3811,7 @@ function command_has_harbingers() { function chamberlains_eligible_supply(source: Locale) { if (lord_has_capability(game.command, AOW_LANCASTER_CHAMBERLAINS)) { for (let vassal of all_vassals) - if (is_vassal_mustered_with(vassal, game.command) && source === data.vassals[vassal].seat) + if (is_vassal_mustered_with(vassal, game.command) && source === get_vassal_seat(vassal)) return true } return false @@ -3808,7 +3820,7 @@ function chamberlains_eligible_supply(source: Locale) { function quartermasters_eligible_supply(source: Locale) { if (lord_has_capability(game.command, AOW_LANCASTER_QUARTERMASTERS)) { for (let vassal of all_vassals) - if (is_vassal_mustered_with(vassal, game.command) && source === data.vassals[vassal].seat) + if (is_vassal_mustered_with(vassal, game.command) && source === get_vassal_seat(vassal)) return true } return false @@ -4260,13 +4272,13 @@ function can_tax_at(here: Locale, lord: Lord) { return true // Own seat - if (here === data.lords[lord].seat) + if (here === get_lord_seat(lord)) return true // vassal seats for (let vassal of all_vassals) if (is_vassal_mustered_with(vassal, lord)) - if (here === data.vassals[vassal].seat) + if (here === get_vassal_seat(vassal)) return true } return false @@ -4367,7 +4379,7 @@ states.tax = { locale(loc) { game.where = loc // TODO: naval blockade if only reachable by sea - if (loc === data.lords[game.command].seat) { + if (loc === get_lord_seat(game.command)) { do_tax(game.command, game.where, 1) end_tax() } @@ -11453,7 +11465,7 @@ states.tax_collectors_lord = { locale(loc) { game.where = loc // TODO: naval blockade if only reachable by sea - if (loc === data.lords[game.who].seat) { + if (loc === get_lord_seat(game.who)) { do_tax(game.who, game.where, 2) end_tax_collectors_lord() } diff --git a/tools/gendata.js b/tools/gendata.js index ac5f75f..278b90e 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -301,8 +301,8 @@ const boxes = { "vassal vassal_beaumont": [730,765,54,56], "seat lancaster lord_buckingham": [715,958,54,56], "seat york lord_march": [432,947,54,56], - "seat lancaster lord_jasper_tudor_2": [230,888,54,56], - "seat lancaster lord_jasper_tudor_1": [147,1067,54,56], + "seat lancaster lord_jasper_tudor_2": [233,890,54,56], + "seat lancaster lord_jasper_tudor_1": [153,1064,54,56], "seat lancaster lord_oxford": [771,1092,54,56], "seat york lord_rutland": [1113,1181,54,56], "seat lancaster lord_warwick_l": [1118,1385,54,56], @@ -1086,7 +1086,7 @@ let lords = [ short_name: "Gloucester", full_name: "Richard Plantagenet", title: "Duke of Gloucester", - seat: locmap["Gloucester"], + seat: locmap["London"], marshal:1, influence:5, lordship:3, diff --git a/tools/layout.svg b/tools/layout.svg index d8c25c0..d718d09 100644 --- a/tools/layout.svg +++ b/tools/layout.svg @@ -1,20 +1,20 @@ + inkscape:version="1.0.2 (e86c870879, 2021-01-15)"> @@ -38,9 +38,9 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" showgrid="true" - inkscape:zoom="0.7681373" - inkscape:cx="464.76066" - inkscape:cy="793.47794" + inkscape:zoom="1.3210766" + inkscape:cx="575.39574" + inkscape:cy="874.26408" inkscape:window-width="1920" inkscape:window-height="991" inkscape:window-x="-9" @@ -65,14 +65,15 @@ inkscape:label="Image" id="g8"> + preserveAspectRatio="none" + id="image10" + sodipodi:insensitive="true" + style="image-rendering:pixelated" + inkscape:svg-dpi="1" /> @@ -2241,8 +2242,8 @@ id="rect1068" width="53.546478" height="55.672852" - x="147.28767" - y="1066.9144" + x="153.22676" + y="1064.3271" rx="0" ry="0" inkscape:label="seat lancaster lord_jasper_tudor_1" /> -- cgit v1.2.3