From c6ba8588ed657e7ab6f2b02d2b3d9f08d07529b4 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 4 Jul 2021 12:40:15 +0200 Subject: crusader: Fix Saladin deployment. --- rules.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index ed148ab..2a40d94 100644 --- a/rules.js +++ b/rules.js @@ -1065,21 +1065,27 @@ states.saracen_deployment = { prompt: function (view, current) { if (is_inactive_player(current)) return view.prompt = "Deployment: Waiting for " + game.active + "."; - view.prompt = "Deployment: You may swap places with Saladin and any other block of his family." + view.prompt = "Deployment: You may swap places with Saladin and any other block of his family."; gen_action(view, 'next'); - for (let b of SALADIN_FAMILY) - if (b != SALADIN && game.location[b] != game.location[SALADIN]) - gen_action(view, 'block', b); + gen_action_undo(view); + if (game.location[SALADIN] == DAMASCUS) { + for (let b of SALADIN_FAMILY) + if (b != SALADIN && game.location[b] != game.location[SALADIN]) + gen_action(view, 'block', b); + } }, block: function (who) { + push_undo(); let saladin = game.location[SALADIN]; game.location[SALADIN] = game.location[who]; game.location[who] = saladin; + game.who = null; }, next: function () { game.who = null; start_year(); - } + }, + undo: pop_undo } // GAME TURN @@ -1824,7 +1830,7 @@ states.sea_move_to = { town: function (to) { --game.moves; - let from = game.location[game.who]; + let from = game.where; game.location[game.who] = to; game.moved[game.who] = 1; -- cgit v1.2.3