summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-06-16 18:32:06 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commit03fa05f2f083ab541749ee56a8a8056b298200b9 (patch)
tree5fc0d3964b0a18080b0de927a2bdb5b085db1aff
parent3e8fe76752d0be4d09744dc854bf0144cfc4a9a6 (diff)
downloadpax-pamir-03fa05f2f083ab541749ee56a8a8056b298200b9.tar.gz
Change results when resigning.
Opponent for 2P games. None for multi-player games.
-rw-r--r--rules.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index f14ba5c..6c0aec0 100644
--- a/rules.js
+++ b/rules.js
@@ -2051,7 +2051,7 @@ states.battle = {
}
}
} else {
- view.prompt = `Battle on #${game.where} is over \u2014 undo will not be possible.`;
+ view.prompt = `Battle on #${game.where} is over \u2014 undo will not be possible.`
}
}
gen_action('next')
@@ -3133,8 +3133,19 @@ exports.resign = function (state, current) {
load_game(state)
logbr()
log(`${current} resigned.`)
- goto_game_over()
+ game.state = 'game_over'
+ game.active = 5
game.victory = `${current} resigned.`
+
+ if (game.players.length === 2) {
+ if (current === player_names[0])
+ game.result = player_names[1]
+ else
+ game.result = player_names[0]
+ } else {
+ game.result = "None"
+ }
+
return save_game()
}