From 03fa05f2f083ab541749ee56a8a8056b298200b9 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 16 Jun 2022 18:32:06 +0200 Subject: Change results when resigning. Opponent for 2P games. None for multi-player games. --- rules.js | 15 +++++++++++++-- 1 file 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() } -- cgit v1.2.3