diff options
author | teisuru <31881306+teisuru@users.noreply.github.com> | 2023-10-18 08:53:45 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-12-10 18:16:55 +0100 |
commit | fe7bb76742c6e0d80265934491d3d89407bdc7be (patch) | |
tree | 7985c84217cfaf13e4a2f67249ccfb2996915b83 /rules.js | |
parent | 2ff5d82e5578c8d3a2860c073d2aaaca2f0c62ad (diff) | |
download | plantagenet-fe7bb76742c6e0d80265934491d3d89407bdc7be.tar.gz |
Capability Y12
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 80 |
1 files changed, 71 insertions, 9 deletions
@@ -1655,6 +1655,22 @@ function can_add_troops_irishmen(lordwho, locale) { return false } +function can_add_troops_sof(lordwho, locale) { + let number = 6 + for (let lord = first_friendly_lord; lord <= last_friendly_lord; ++lord) { + number -= get_lord_forces(lord, MERCENARIES) + } + if (!has_exhausted_marker(locale) && + !is_exile(locale) && + lord_has_capability(lordwho, AOW_YORK_SOLDIERS_OF_FORTUNE) && + (get_lord_assets(lordwho, COIN) > 0 || get_shared_assets(lordwho, COIN) > 0) && + number >= 1 + ) + return true + else + return false +} + function can_add_transport(who, what) { return get_lord_assets(who, what) < 100 } @@ -2939,8 +2955,11 @@ states.levy_muster_lord = { if (can_add_troops_irishmen(game.who, here)) view.actions.levy_irishmen = 1 - } + if (can_add_troops_sof(game.who, here)) + view.actions.soldiers_of_fortune = 1 + } + if (game.count === 0 && game.flags.free_levy === 1 && can_add_troops(game.who, here)) { view.actions.levy_troops = 1 } @@ -3026,23 +3045,21 @@ states.levy_muster_lord = { levy_beloved_warwick() { push_undo() add_lord_forces(game.who, MILITIA, 5) - if (game.flags.free_levy === 1) { - ++game.count - game.flags.free_levy = 0 - } resume_levy_muster_lord() }, levy_irishmen() { push_undo() add_lord_forces(game.who, MILITIA, 5) - if (game.flags.free_levy === 1) { - ++game.count - game.flags.free_levy = 0 - } resume_levy_muster_lord() }, + soldiers_of_fortune() { + push_undo() + push_state("soldier_of_fortune") + + }, + capability() { push_undo() push_state("muster_capability") @@ -3068,6 +3085,51 @@ function chamberlains_eligible_levy(locale) { } } + +states.soldier_of_fortune = { + inactive: "sof", + prompt() { + set_lord_unfed(game.who, 1) + view.prompt = `Pay 1 Coin for Mercenaries ${lord_name[game.who]}.` + let done = true + + + if (done) { + if (is_lord_unfed(game.who)) { + if (get_lord_assets(game.who, COIN) > 0) { + done = false + gen_action_coin(game.who) + } + } + } + // Sharing + if (done) { + for (let lord = first_friendly_lord; lord <= last_friendly_lord; ++lord) { + if (is_lord_unfed(lord) && can_pay_from_shared(lord)) { + gen_action_lord(lord) + } + } + } + + }, + + coin(lord) { + push_undo() + let number = get_lord_forces(game.who, MERCENARIES) + let merc = 0 + if (number === 5) + merc = 1 + else + merc = 2 + add_lord_assets(lord, COIN, -1) + add_lord_forces(game.who, MERCENARIES, merc) + }, + lord(lord) { + push_undo() + game.who = lord + game.state = "pay_lord_shared" + }, +} states.muster_lord_at_seat = { inactive: "Muster", prompt() { |