summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-08-04 16:14:38 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-21 00:28:20 +0200
commit065aaddc871722de1a5f1ec3406c2bab169fde4b (patch)
tree54c3141b6ae3fa89b6ca77793514ef83f9d91dfd /rules.js
parent78bc73ae429395406382c5adea0f7f59b6c56360 (diff)
downloadwashingtons-war-065aaddc871722de1a5f1ec3406c2bab169fde4b.tar.gz
draw replacement cards after battle at end of impulse
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js36
1 files changed, 22 insertions, 14 deletions
diff --git a/rules.js b/rules.js
index b644ddf..823226b 100644
--- a/rules.js
+++ b/rules.js
@@ -168,6 +168,8 @@ function setup_game(seed) {
b_hand: [],
a_queue: 0,
b_queue: 0,
+ a_draw: 0,
+ b_draw: 0,
card: 0,
last_played: 0,
@@ -1496,6 +1498,18 @@ function end_strategy_card() {
}
}
+ while (game.b_draw > 0) {
+ log("B drew replacement card.")
+ set_add(game.b_hand, deal_card())
+ game.b_draw--
+ }
+
+ while (game.a_draw > 0) {
+ log("A drew replacement card.")
+ set_add(game.a_hand, deal_card())
+ game.a_draw--
+ }
+
game.state = "end_strategy_card"
return true
}
@@ -2654,10 +2668,10 @@ states.play_attacker_battle_card = {
push_undo()
play_card(c, "for +2 DRM")
if (game.active === P_BRITAIN) {
- game.combat.b_draw_after_battle = true
+ game.b_draw += 1
game.combat.b_bonus += 2
} else {
- game.combat.a_draw_after_battle = true
+ game.a_draw += 1
game.combat.a_bonus += 2
}
if (is_trigger_remove_benedict_arnold(c))
@@ -2669,10 +2683,10 @@ states.play_attacker_battle_card = {
push_undo()
discard_card(c, "for +1 DRM")
if (game.active === P_BRITAIN) {
- game.combat.b_draw_after_battle = true
+ game.b_draw += 1
game.combat.b_bonus += 1
} else {
- game.combat.a_draw_after_battle = true
+ game.a_draw += 1
game.combat.a_bonus += 1
}
game.state = "play_attacker_battle_card_confirm"
@@ -2718,10 +2732,10 @@ states.play_defender_battle_card = {
push_undo()
play_card(c, "for +2 DRM")
if (game.active === P_BRITAIN) {
- game.combat.b_draw_after_battle = true
+ game.b_draw += 1
game.combat.b_bonus += 2
} else {
- game.combat.a_draw_after_battle = true
+ game.a_draw += 1
game.combat.a_bonus += 2
}
if (is_trigger_remove_benedict_arnold(c))
@@ -2733,10 +2747,10 @@ states.play_defender_battle_card = {
push_undo()
discard_card(c, "for +1 DRM")
if (game.active === P_BRITAIN) {
- game.combat.b_draw_after_battle = true
+ game.b_draw += 1
game.combat.b_bonus += 1
} else {
- game.combat.a_draw_after_battle = true
+ game.a_draw += 1
game.combat.a_bonus += 1
}
game.state = "play_defender_battle_card_confirm"
@@ -3202,12 +3216,6 @@ function end_battle() {
if (game.combat.british_losses >= 3)
lose_regular_advantage()
- // TODO: delay until end of campaign (at end of player's impulse)
- if (game.combat.b_draw_after_battle)
- set_add(game.b_hand, deal_card())
- if (game.combat.a_draw_after_battle)
- set_add(game.a_hand, deal_card())
-
delete game.combat
end_move(true)