diff options
author | teisuru <31881306+teisuru@users.noreply.github.com> | 2023-09-02 00:57:01 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-12-10 18:16:55 +0100 |
commit | 7a24fc2dacb39d82a0b922244c8e54a79a4dadeb (patch) | |
tree | 6e708e26d5b09811f64ca6eff26487dae5aad193 /rules.js | |
parent | 75c6b72df894aca18a6380a5e279bb11587e0143 (diff) | |
download | plantagenet-7a24fc2dacb39d82a0b922244c8e54a79a4dadeb.tar.gz |
early forage logic (exhaust/deplete)
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 48 |
1 files changed, 31 insertions, 17 deletions
@@ -1110,7 +1110,7 @@ function remove_favoury_marker(loc) { set_delete(game.pieces.favoury, loc) } -function has_ravaged_marker(loc) { +function has_exhausted_marker(loc) { return set_has(game.pieces.exhausted, loc) } @@ -1118,8 +1118,29 @@ function add_exhausted_marker(loc) { set_add(game.pieces.exhausted, loc) } +function has_depleted_marker(loc) { + return set_has(game.pieces.depleted, loc) +} + +function add_depleted_marker(loc) { + set_add(game.pieces.depleted, loc) +} + +function remove_depleted_marker(loc) { + set_delete(game.pieces.depleted, loc) +} + function remove_exhausted_marker(loc) { - set_delete(game.pieces.ravaged, loc) + set_delete(game.pieces.exhausted, loc) +} +function deplete_locale(loc) { + if (has_depleted_marker(loc)) { + remove_depleted_marker(loc), + add_exhausted_marker(loc) + } + else { + add_depleted_marker(loc) + } } function is_friendly_locale(loc) { @@ -1339,6 +1360,7 @@ exports.setup = function (seed, scenario, options) { capabilities: Array(lord_count << 1).fill(NOTHING), moved: 0, vassals: Array(vassal_count).fill(VASSAL_UNAVAILABLE), + depleted: [], exhausted: [], favourl:[], favoury:[], @@ -3502,18 +3524,10 @@ states.supply_path_way = { function can_action_forage() { if (game.actions < 1) return false - - /* if - return false */ - let here = get_lord_locale(game.command) - if (has_ravaged_marker(here)) + if (has_exhausted_marker(here)) return false - if (is_summer()) - return true -// if (is_friendly_stronghold_locale(here)) // FIXME: simpler check? -// return true - return false + return true } function goto_forage() { @@ -3521,6 +3535,7 @@ function goto_forage() { let here = get_lord_locale(game.command) log(`Foraged at %${here}`) add_lord_assets(game.command, PROV, 1) + deplete_locale(here) spend_action(1) resume_command() } @@ -3531,30 +3546,29 @@ function goto_forage() { function can_action_tax() { if (game.actions < 1) return false - - // Must have space left to hold Coin if (get_lord_assets(game.command, COIN) >= 8) return false - // Must be at own seat TO BE REMOVED return is_lord_at_seat(game.command) - // TODO : Add deplete/exhaust } function goto_tax() { push_undo() let here = get_lord_locale(game.command) + log(`Taxed %${here}.`) + + if (is_town(here) || is_fortress(here) || is_harlech(here)) add_lord_assets(game.command, COIN, 1) else if (is_city(here)) add_lord_assets(game.command, COIN, 2) else add_lord_assets(game.command, COIN, 3) -// TODO : Add deplete/exhaust + spend_action(1) resume_command() |