summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-07-04 12:40:15 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commitc6ba8588ed657e7ab6f2b02d2b3d9f08d07529b4 (patch)
treedd1dd97ae1a89354d9623c1ebd22d44c09953440 /rules.js
parent82f16b170c3b6f9fc5bc5d83c717364f31aa7b63 (diff)
downloadcrusader-rex-c6ba8588ed657e7ab6f2b02d2b3d9f08d07529b4.tar.gz
crusader: Fix Saladin deployment.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js18
1 files changed, 12 insertions, 6 deletions
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;