diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 67 |
1 files changed, 25 insertions, 42 deletions
@@ -2381,7 +2381,10 @@ events.campaign = { states.activate_individually = { prompt() { view.prompt = `Activate units and/or leaders individually${format_remain(game.count)}.` - view.actions.next = 1 + if (game.count > 0) + view.actions.confirm_end_activations = 1 + else + view.actions.end_activations = 1 if (game.count >= 1) { for (let p = first_friendly_leader; p <= last_friendly_leader; ++p) { if (is_piece_on_map(p) && !game.activation.includes(p)) { @@ -2419,7 +2422,10 @@ states.activate_individually = { else game.count -= 1.0 }, - next() { + confirm_end_activations() { + this.end_activations() + }, + end_activations() { push_undo() goto_pick_first_move() }, @@ -2640,7 +2646,10 @@ states.designate_force = { case 'campaign_2': case 'move': // Campaign and normal activations can activate leaders without forces. - view.actions.activate = 1 + if (count_units_in_force(game.force.commander) > 0) + view.actions.activate = 1 + else + view.actions.confirm_activate = 1 break case 'intercept': // Must be a force to proceed (leader + at least one unit) @@ -2700,10 +2709,10 @@ states.designate_force = { activate() { push_undo() - if (game.force.reason === 'move' && count_units_in_force(game.force.commander) === 0) - game.state = 'confirm_designate_force' - else - end_designate_force() + end_designate_force() + }, + confirm_activate() { + this.activate() }, intercept() { attempt_intercept() @@ -2713,20 +2722,6 @@ states.designate_force = { }, } -states.confirm_designate_force = { - inactive() { - inactive_prompt("designate force " + designate_force_reason_prompt[game.force.reason], game.force.commander, 0) - }, - prompt() { - view.prompt = `You have not picked up any units \u2014 are you sure you want to continue?` - view.who = game.force.commander - view.actions.next = 1 - }, - next() { - end_designate_force() - } -} - function end_designate_force() { let commander = game.force.commander let reason = game.force.reason @@ -3403,7 +3398,10 @@ states.move = { else if (game.move.used === 9) view.actions.end_move = 1 } else { - view.actions.end_move = 1 + if (game.move.used > 0) + view.actions.end_move = 1 + else + view.actions.confirm_end_move = 1 } if (game.move.used < max_movement_cost(game.move.type)) { @@ -3469,12 +3467,11 @@ states.move = { goto_designate_inside() }, end_move() { - if (game.move.used > 0) { - end_move() - } else { - push_undo() - game.state = 'confirm_end_move' - } + clear_undo() + end_move() + }, + confirm_end_move() { + this.end_move() }, } @@ -3530,20 +3527,6 @@ states.drop_off = { }, } -states.confirm_end_move = { - inactive() { - inactive_prompt("move", moving_piece(), 0) - }, - prompt() { - view.prompt = `You have not moved yet \u2014 are you sure you want to pass?` - view.who = moving_piece() - view.actions.end_move = 1 - }, - end_move() { - end_move() - } -} - function goto_retroactive_foul_weather() { if (game.options.retroactive && game.retro_foul_weather) { // console.log("RETRO REWIND") |