diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-10-14 13:04:26 +0200 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-10-14 13:04:26 +0200 |
commit | 32b5cbc892588e532c690f76b910787cbb1dbff1 (patch) | |
tree | 7d6ef1a7778503f72d95581ad39284100d5fd6c2 | |
parent | 060863752f989d6fb57a28a01aac488fc7221930 (diff) | |
download | algeria-32b5cbc892588e532c690f76b910787cbb1dbff1.tar.gz |
Gov activation cost can be fraction, only round PSL down at end of reinforcement
-rw-r--r-- | rules.js | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -894,7 +894,7 @@ exports.view = function(state, player) { turn: game.turn, fln_ap: game.fln_ap, fln_psl: game.fln_psl, - gov_psl: game.gov_psl, + gov_psl: Math.floor(game.gov_psl), // activation cost can be fraction air_avail: game.air_avail, air_max: game.air_max, helo_avail: game.helo_avail, @@ -1695,7 +1695,8 @@ states.gov_reinforcement = { gen_action_unit(u) }) - if (game.gov_psl > cost) { + // don't allow PSL to go <= 0 + if (Math.floor(game.gov_psl - cost) > 0) { for_each_algerian_map_area(loc => { gen_action_loc(loc) }) @@ -1708,8 +1709,8 @@ states.gov_reinforcement = { gen_action_unit(u) }) - // Fractions rounded up - if (game.gov_psl > Math.ceil(cost)) { + // don't allow PSL to go <= 0 + if (Math.floor(game.gov_psl - cost) > 0) { gen_action("activate") } } @@ -1731,7 +1732,6 @@ states.gov_reinforcement = { } let cost = mobilization_cost(list) lower_gov_psl(cost) - // log(`Paid ${cost} PSP`) }, select_all_inactive() { push_undo() @@ -1749,9 +1749,9 @@ states.gov_reinforcement = { log(`>U${u} in A${loc}`) set_unit_box(u, OPS) } - let cost = Math.ceil(activation_cost(list)) + // cost can be fraction + let cost = activation_cost(list) lower_gov_psl(cost) - // log(`Paid ${cost} PSP`) }, remove() { let list = game.selected @@ -1811,6 +1811,9 @@ states.gov_reinforcement = { game.border_zone_drm -= 1 }, end_reinforcement() { + // PSL rounded down as cost can be fractions + game.gov_psl = Math.floor(game.gov_psl) + goto_fln_reinforcement_phase() } } |