summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-07-04 12:39:39 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commit82f16b170c3b6f9fc5bc5d83c717364f31aa7b63 (patch)
tree4516086caf548985952241788fd9d87801aa1e93 /rules.js
parentf65b5cf7fb909ade4ed64d652833c7fa78cdb9e6 (diff)
downloadcrusader-rex-82f16b170c3b6f9fc5bc5d83c717364f31aa7b63.tar.gz
crusader: P2 main attack relief forces are delayed one round.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js37
1 files changed, 27 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index bef50b8..ed148ab 100644
--- a/rules.js
+++ b/rules.js
@@ -1490,24 +1490,43 @@ states.manna = {
// MOVE PHASE
+function queue_attack(who, round) {
+ if (round == 1)
+ return ATTACK_MARK;
+ if (round == 2) {
+ game.reserves1.push(who);
+ return RESERVE_MARK_1;
+ }
+ if (round == 3) {
+ game.reserves2.push(who);
+ return RESERVE_MARK_2;
+ }
+}
+
function move_block(who, from, to) {
game.location[who] = to;
game.road_limit[road_id(from, to)] = road_limit(from, to) + 1;
game.distance ++;
if (is_contested_field(to)) {
game.last_used[road_id(from, to)] = game.active;
+
+ // 6.56 Main Attack relief force by Player 2 arrives one round later than normal
+ let relief_delay = 0;
+ if (game.active == game.p2 && besieged_player(to) == game.p2) {
+ console.log("DELAYED RELIEF BY P2", who, from, to);
+ relief_delay = 1;
+ }
+
if (!game.attacker[to]) {
game.attacker[to] = game.active;
game.main_road[to] = from;
- return ATTACK_MARK;
+ return queue_attack(who, 1 + relief_delay);
} else {
// Attacker main attack or reinforcements
if (game.attacker[to] == game.active) {
- if (game.main_road[to] != from) {
- game.reserves1.push(who);
- return RESERVE_MARK_1;
- }
- return ATTACK_MARK;
+ if (game.main_road[to] != from)
+ return queue_attack(who, 2 + relief_delay);
+ return queue_attack(who, 1 + relief_delay);
}
// Defender reinforcements
@@ -1515,11 +1534,9 @@ function move_block(who, from, to) {
game.main_road[to] = from;
if (game.main_road[to] == from) {
- game.reserves1.push(who);
- return RESERVE_MARK_1;
+ return queue_attack(who, 2);
} else {
- game.reserves2.push(who);
- return RESERVE_MARK_2;
+ return queue_attack(who, 3);
}
}
}