summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-12 13:26:19 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-03 18:48:16 +0200
commit15652f9a6b9634a99e3d60c2f87d8aea52bd12f1 (patch)
tree069e25000ea73dc1985c12dcce2b74ce6e8c7154
parent969766f086f8b94b9372b8032354b17fa5d48599 (diff)
downloadandean-abyss-15652f9a6b9634a99e3d60c2f87d8aea52bd12f1.tar.gz
Update game finished state handling.
-rw-r--r--rules.js27
1 files changed, 12 insertions, 15 deletions
diff --git a/rules.js b/rules.js
index 08abf2b..58fbb68 100644
--- a/rules.js
+++ b/rules.js
@@ -3425,7 +3425,7 @@ function free_rally_elite_backing(s) {
game.state = "rally_space"
game.op.elite_backing = 1
game.op.where = s
- game.op.count = rally_count()
+ game.op.count = 0
}
function rally_count() {
@@ -5287,14 +5287,14 @@ function goto_victory_phase() {
log_h2("Victory Phase")
let result = calc_victory(false)
if (result)
- goto_game_over(result)
+ goto_game_end(result)
else
goto_sabotage_phase()
}
function goto_final_victory() {
log_h2("Final Victory")
- goto_game_over(calc_victory(true))
+ goto_game_end(calc_victory(true))
}
// PROPAGANDA: SABOTAGE
@@ -6922,25 +6922,24 @@ states.vm_free_attack_terror = {
terror: vm_free_terror_space,
}
-// === GAME OVER ===
+// === GAME END ===
-function goto_game_over(result) {
- game.state = "game_over"
+function goto_game_end(result) {
+ game.state = "game_end"
game.current = -1
game.active = "None"
game.result = result
- game.victory = result + " won!"
- log_h1("Game Over")
- log(game.victory)
+ log_br()
+ log(game.result = " won!")
return true
}
-states.game_over = {
+states.game_end = {
get inactive() {
- return game.victory
+ return game.result + " won!"
},
prompt() {
- view.prompt = game.victory
+ view.prompt = game.result + " won!"
},
}
@@ -7050,9 +7049,7 @@ exports.view = function (state, role) {
if (game.prop)
view.propaganda = game.prop.step
- if (game.state === "game_over") {
- view.prompt = game.victory
- } else if (!is_current_role(role)) {
+ if (!is_current_role(role)) {
let inactive = states[game.state].inactive
if (!inactive) {
if (game.vm)