summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-09-18 16:30:06 +0200
committerTor Andersson <tor@ccxvii.net>2024-09-20 15:09:37 +0200
commit253760156779498b95ed18854a758da23ed82a43 (patch)
treef4030ae009e5ff81a901d979ee2bb15da1b04a2b
parentd0cc6bfc086508780e6da3aa3339d8475d01a600 (diff)
downloadwilderness-war-253760156779498b95ed18854a758da23ed82a43.tar.gz
Flush summaries when done, before clicking "End event".
-rw-r--r--rules.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index b492c23..771cbe1 100644
--- a/rules.js
+++ b/rules.js
@@ -5149,6 +5149,8 @@ states.step_losses = {
remove_from_array(game.battle.atk_pcs, p)
remove_from_array(game.battle.units, p)
}
+ if (game.battle.step_loss === 0)
+ flush_losses_summary()
},
end_losses() {
if (game.active === game.battle.attacker)
@@ -7199,6 +7201,7 @@ states.massacre_1 = {
view.actions.pass = 1
},
play_event(c) {
+ flush_summary()
play_card_for_response(c)
award_vp(1)
game.state = 'massacre_2'
@@ -7232,6 +7235,7 @@ states.massacre_2 = {
eliminate_piece(p)
},
end_event() {
+ flush_summary()
set_active_enemy()
end_massacre()
}
@@ -7313,6 +7317,8 @@ states.provincial_regiments_dispersed_for_frontier_duty = {
if (is_northern_provincial(p))
game.frontier_duty.northern --
eliminate_piece(p)
+ if (game.frontier_duty.southern + game.frontier_duty.northern === 0)
+ flush_summary()
},
end_event() {
delete game.frontier_duty
@@ -7447,11 +7453,15 @@ states.indian_alliance = {
if (has_unbesieged_enemy_leader(s) && !has_unbesieged_enemy_units(s))
goto_retreat_lone_leader(s, 'indian_alliance')
}
+ if (game.count === 0)
+ flush_summary()
},
piece(p) {
push_undo()
restore_unit(p)
game.count -= 0.5
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
delete game.alliance
@@ -7515,6 +7525,7 @@ states.restore_units = {
},
piece(p) {
restore_unit(p)
+ // TODO: flush summary when done
},
end_event() {
end_action_phase()
@@ -7558,6 +7569,7 @@ states.mohawks = {
},
space(s) {
place_indian(s, first_mohawk, last_mohawk)
+ flush_summary()
},
end_event() {
goto_restore_units("Mohawks", first_mohawk, last_mohawk)
@@ -7602,6 +7614,7 @@ states.cherokees = {
},
space(s) {
place_indian(s, first_cherokee, last_cherokee)
+ flush_summary()
},
end_event() {
goto_restore_units("Cherokees", first_cherokee, last_cherokee)
@@ -7668,6 +7681,8 @@ states.cherokee_uprising = {
if (is_southern_provincial(p))
game.uprising.southern --
eliminate_piece(p)
+ if (game.uprising.regular + game.uprising.southern === 0)
+ flush_summary()
},
end_event() {
delete game.uprising
@@ -7706,6 +7721,7 @@ states.treaty_of_easton = {
},
piece(p) {
eliminate_piece(p)
+ // TODO: flush summary when done
},
end_event() {
end_action_phase()
@@ -7746,6 +7762,8 @@ states.indians_desert = {
game.indians_desert = piece_space(p)
eliminate_piece(p)
game.count --
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
delete game.indians_desert
@@ -7917,6 +7935,8 @@ states.small_pox_eliminate_steps = {
push_undo()
reduce_unit(p)
game.count --
+ if (game.count === 0)
+ flush_losses_summary()
},
next() {
flush_losses_summary()
@@ -8202,6 +8222,7 @@ states.stingy_provincial_assembly = {
push_undo()
eliminate_piece(p)
game.count = 0
+ flush_summary()
},
end_event() {
set_active_enemy()
@@ -8322,6 +8343,7 @@ states.british_colonial_politics = {
piece(p) {
push_undo()
eliminate_piece(p)
+ // TODO: flush summary when done
},
end_event() {
set_active_enemy()
@@ -8439,6 +8461,8 @@ states.raise_provincial_regiments = {
place_piece(p, s)
game.did_raise = 1
game.count --
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
delete game.did_raise
@@ -8581,6 +8605,8 @@ states.colonial_recruits = {
push_undo()
restore_unit(p)
game.count --
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
end_action_phase()
@@ -8668,6 +8694,8 @@ states.restore_regular_or_light_infantry_units = {
push_undo()
restore_unit(p)
game.count --
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
end_action_phase()
@@ -8742,11 +8770,15 @@ states.call_out_militias = {
let p = find_unused_friendly_militia()
place_piece(p, s)
game.count -= 2
+ if (game.count === 0)
+ flush_summary()
},
piece(p) {
push_undo()
restore_unit(p)
game.count -= 1
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
end_action_phase()
@@ -8798,11 +8830,15 @@ states.rangers = {
let p = find_unused_ranger()
place_piece(p, s)
game.count -= 2
+ if (game.count === 0)
+ flush_summary()
},
piece(p) {
push_undo()
restore_unit(p)
game.count -= 1
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
end_action_phase()
@@ -8869,6 +8905,8 @@ states.french_regulars = {
}
}
game.count = 0
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
game.events.french_regulars = 1
@@ -8934,6 +8972,8 @@ states.light_infantry = {
game.count = 0
}
}
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
end_british_reinforcement()
@@ -9010,6 +9050,8 @@ states.british_regulars = {
game.count = 0
}
}
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
game.events.british_regulars = 1
@@ -9105,6 +9147,8 @@ states.highlanders = {
game.count = 0
}
}
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
end_british_reinforcement()
@@ -9178,6 +9222,8 @@ states.royal_americans = {
game.count = 0
}
}
+ if (game.count === 0)
+ flush_summary()
},
end_event() {
end_british_reinforcement()
@@ -9261,6 +9307,7 @@ states.acadians_expelled_restore_coureurs_and_militia = {
},
piece(p) {
restore_unit(p)
+ // TODO: flush summary when done
},
end_event() {
set_active(game.acadians)