diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -4350,7 +4350,7 @@ function goto_retroactive_conquest() { } }) - game.retro = map_filter(game.retro, (s,pow) => pow !== game.power) + game.retro = map_filter(game.retro, (_,pow) => pow !== game.power) log_conquest(conq) @@ -6390,10 +6390,10 @@ const setup_max_troops = [ ] const setup_troops = [ - 0, 0, 0, 0, 0, - 0, 0, 0, 6, + 7, 6, 5, 0, 0, + 0, 0, 4, 6, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 0, 0, 6, 2, 0, 4, 5, 5, ] @@ -6624,7 +6624,7 @@ states.setup = { } else { let n_stacks = 0 for (let p of all_power_generals[game.power]) { - if (game.troops[p] === 0) { + if (!set_has(game.moved, p)) { gen_action_piece(p) n_stacks ++ } @@ -6650,16 +6650,16 @@ states.setup = { function count_unsetup_min() { let n = 0 for (let p of all_power_generals[game.power]) - if (game.troops[p] === 0) - n += setup_min_troops[p] + if (game.selected !== p && !set_has(game.moved, p)) + n += setup_min_troops[p] - game.troops[p] return n } function count_unsetup_max() { let n = 0 for (let p of all_power_generals[game.power]) - if (game.troops[p] === 0) - n += setup_max_troops[p] + if (game.selected !== p && !set_has(game.moved, p)) + n += setup_max_troops[p] - game.troops[p] return n } @@ -6673,21 +6673,23 @@ states.setup_general = { let n_self_min = setup_min_troops[who] let n_self_max = setup_max_troops[who] - let n_other_min = count_unsetup_min() - n_self_min - let n_other_max = count_unsetup_max() - n_self_max - let n_troops = setup_total_troops[game.power] - count_used_troops() + + let n_troops = setup_total_troops[game.power] - count_used_troops() + game.troops[who] + let n_leave_min = count_unsetup_min() + let n_leave_max = count_unsetup_max() // leave at least 1 for each remaining general - let take_max = Math.min(n_self_max, n_troops - n_other_min) + let take_max = Math.min(n_self_max, n_troops - n_leave_min) // leave no more than 8 for each remaining general - let take_min = Math.max(n_self_min, n_troops - n_other_max) + let take_min = Math.max(n_self_min, n_troops - n_leave_max) view.actions.value = [] for (let i = take_min; i <= take_max; ++i) view.actions.value.push(i) }, value(v) { + set_add(game.moved, game.selected) game.troops[game.selected] = v game.selected = -1 game.state = "setup" @@ -6697,12 +6699,16 @@ states.setup_general = { function goto_setup() { game.stage = 0 set_active_setup_power() + for (let p of all_generals) + if (setup_min_troops[p] === setup_max_troops[p]) + set_add(game.moved, p) game.state = "setup" } function end_setup() { let end = is_intro() ? 2 : 4 if (++game.stage === end) { + set_clear(game.moved) goto_start_turn() } else { set_active_setup_power() |