diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-02-06 18:05:45 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | c939e0daee913b4e411b908df3438feb6b5c7eff (patch) | |
tree | 56dc819c7c1a92d37b8ada58f0fdc82dbd1bfa71 | |
parent | 5b5ec6314d372baf42eb288e8682aa89a2a4a50f (diff) | |
download | wilderness-war-c939e0daee913b4e411b908df3438feb6b5c7eff.tar.gz |
Fix control status of wilderness spaces. Update VP for Niagara & Forks.
-rw-r--r-- | rules.js | 49 |
1 files changed, 31 insertions, 18 deletions
@@ -1180,16 +1180,9 @@ function is_originally_british(space) { } function is_french_controlled_space(space) { - if (is_space_unbesieged(space) && !has_british_units(space)) { - if (is_originally_british(space)) { - if (has_french_units(space)) - return true; - } else { - // TODO: neutral spaces? - return true; - } - } - return false; + if (game.active === FRANCE) + return is_friendly_controlled_space(space); + return is_enemy_controlled_space(space); } function has_french_stockade(space) { @@ -1237,14 +1230,15 @@ function has_unbesieged_enemy_units_that_did_not_intercept(space) { function is_friendly_controlled_space(space) { if (is_space_unbesieged(space) && !has_enemy_units(space)) { if (is_originally_enemy(space)) { - if (has_friendly_units(space)) + if (has_friendly_units(space) || has_friendly_stockade(space) || has_friendly_fort(space)) return true; if (has_friendly_amphib(space)) return true; - } else { - // TODO: neutral spaces? - // return !is_originally_friendly(space); + } else if (is_originally_friendly(space)) { return true; + } else { + if (has_friendly_units(space) || has_friendly_stockade(space) || has_friendly_fort(space)) + return true; } } return false; @@ -1253,14 +1247,15 @@ function is_friendly_controlled_space(space) { function is_enemy_controlled_space(space) { if (is_space_unbesieged(space) && !has_friendly_units(space)) { if (is_originally_friendly(space)) { - if (has_enemy_units(space)) + if (has_enemy_units(space) || has_enemy_stockade(space) || has_enemy_fort(space)) return true; if (has_enemy_amphib(space)) return true; - } else { - // TODO: neutral spaces? - // return !is_originally_enemy(space); + } else if (is_originally_enemy(space)) { return true; + } else { + if (has_enemy_units(space) || has_enemy_stockade(space) || has_enemy_fort(space)) + return true; } } return false; @@ -1776,6 +1771,22 @@ function lift_sieges_and_amphib() { for (let s of originally_british_fortresses) if (game.France.fortresses.includes(s) && is_british_controlled_space(s)) recapture_british_fortress(s); + + // Check ownership of other VP locations: + update_vp("niagara", NIAGARA); + update_vp("ohio_forks", OHIO_FORKS); +} + +function update_vp(name, s) { + let save = game[name]; + let v = 0; + if (is_french_controlled_space(s)) + v = 1; + else if (is_british_controlled_space(s)) + v = -1; + if (v !== save) + award_french_vp(v - save); + game[name] = v; } // PATH FINDING @@ -7279,6 +7290,8 @@ exports.setup = function (seed, scenario, options) { }, sieges: {}, fieldworks: [], + niagara: 1, + ohio_forks: 1, France: { hand: [], held: 0, |