diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-04-16 17:59:01 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-04-16 17:59:01 +0200 |
commit | ae78b813290ab22603a2c81fb3822e4b1efae20e (patch) | |
tree | 43f9b4620ad66ed983e7ae0b129ea9b1fb414870 | |
parent | e575c58f6e2652d27c4725d27279416f09fa7b1a (diff) | |
download | plantagenet-ae78b813290ab22603a2c81fb3822e4b1efae20e.tar.gz |
Fix "Rising Wages".
-rw-r--r-- | rules.js | 130 |
1 files changed, 73 insertions, 57 deletions
@@ -2582,54 +2582,13 @@ states.levy_muster_lord = { levy_troops() { push_undo() + if (is_event_in_play(EVENT_LANCASTER_RISING_WAGES) && game.active === YORK) { - push_state("rising_wages") - } - let here = get_lord_locale(game.who) - let here_type = data.locales[here].type - if ( - !lord_has_capability(game.who, AOW_LANCASTER_QUARTERMASTERS) && - !lord_has_capability(game.who, AOW_YORK_WOODWILLES) && - !chamberlains_eligible_levy(here) - ) - deplete_locale(here) - switch (here_type) { - case "calais": - add_lord_forces(game.who, MEN_AT_ARMS, 2) - add_lord_forces(game.who, LONGBOWMEN, 1) - break - case "london": - add_lord_forces(game.who, MEN_AT_ARMS, 1) - add_lord_forces(game.who, LONGBOWMEN, 1) - add_lord_forces(game.who, MILITIA, 1) - break - case "harlech": - add_lord_forces(game.who, MEN_AT_ARMS, 1) - add_lord_forces(game.who, LONGBOWMEN, 2) - break - case "city": - add_lord_forces(game.who, LONGBOWMEN, 1) - add_lord_forces(game.who, MILITIA, 1) - break - case "town": - add_lord_forces(game.who, MILITIA, 2) - break - case "fortress": - add_lord_forces(game.who, MEN_AT_ARMS, 1) - add_lord_forces(game.who, MILITIA, 1) - break - } - if (game.flags.free_levy === 1) { - ++game.count - game.flags.free_levy = 0 - } - if (eligible_kings_name()) { - goto_kings_name("Levy Troops") + goto_rising_wages() + return } - if (is_event_in_play(EVENT_YORK_THE_COMMONS) && is_york_lord(game.who)) - goto_the_commons() - else - resume_levy_muster_lord() + + do_levy_troops() }, levy_beloved_warwick() { @@ -2677,6 +2636,68 @@ states.levy_muster_lord = { }, } +// Check if the levy troops is at vassal seat +function chamberlains_eligible_levy(locale) { + for (let vassal = first_vassal; vassal <= last_vassal; ++vassal) + if (is_vassal_mustered_with(vassal, game.who) && lord_has_capability(game.who, AOW_LANCASTER_CHAMBERLAINS)) { + if (locale === data.vassals[vassal].seat) + return true + } +} + +function do_levy_troops() { + let here = get_lord_locale(game.who) + if ( + !lord_has_capability(game.who, AOW_LANCASTER_QUARTERMASTERS) && + !lord_has_capability(game.who, AOW_YORK_WOODWILLES) && + !chamberlains_eligible_levy(here) + ) + deplete_locale(here) + + let here_type = data.locales[here].type + switch (here_type) { + case "calais": + add_lord_forces(game.who, MEN_AT_ARMS, 2) + add_lord_forces(game.who, LONGBOWMEN, 1) + break + case "london": + add_lord_forces(game.who, MEN_AT_ARMS, 1) + add_lord_forces(game.who, LONGBOWMEN, 1) + add_lord_forces(game.who, MILITIA, 1) + break + case "harlech": + add_lord_forces(game.who, MEN_AT_ARMS, 1) + add_lord_forces(game.who, LONGBOWMEN, 2) + break + case "city": + add_lord_forces(game.who, LONGBOWMEN, 1) + add_lord_forces(game.who, MILITIA, 1) + break + case "town": + add_lord_forces(game.who, MILITIA, 2) + break + case "fortress": + add_lord_forces(game.who, MEN_AT_ARMS, 1) + add_lord_forces(game.who, MILITIA, 1) + break + } + if (game.flags.free_levy === 1) { + ++game.count + game.flags.free_levy = 0 + } + + // TODO: after The Commons + + if (is_event_in_play(EVENT_YORK_THE_COMMONS) && is_york_lord(game.who)) { + goto_the_commons() + } else { + if (eligible_kings_name()) + goto_kings_name("Levy Troops") + else + resume_levy_muster_lord() + } +} + // === 3.4.2 LEVY LORD === states.muster_lord_at_seat = { @@ -11057,6 +11078,10 @@ function kings_name_reset_troops() { // === EVENT: RISING WAGES === +function goto_rising_wages() { + game.state = "rising_wages" +} + states.rising_wages = { inactive: "Rising Wages", prompt() { @@ -11074,18 +11099,9 @@ states.rising_wages = { add_lord_assets(lord, COIN, -1) logi(`${EVENT_LANCASTER_RISING_WAGES}`) log("York paid 1 Coin to Levy troops") - pop_state() - }, -} -// Check if the levy troops is at vassal seat - -function chamberlains_eligible_levy(locale) { - for (let vassal = first_vassal; vassal <= last_vassal; ++vassal) - if (is_vassal_mustered_with(vassal, game.who) && lord_has_capability(game.who, AOW_LANCASTER_CHAMBERLAINS)) { - if (locale === data.vassals[vassal].seat) - return true - } + do_levy_troops() + }, } // === EVENT: THE COMMONS === |