summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-10-10 11:29:02 +0200
committerTor Andersson <tor@ccxvii.net>2023-10-10 11:29:02 +0200
commit2a9f4e4e5bab2345e12d43ae7bbca307c829091b (patch)
treeb152bfbbc94812395d13cfb2b33948262d4c26d9
parent431dddd022f9bc58580fc2ad108deecfb3c44236 (diff)
downloadwilderness-war-2a9f4e4e5bab2345e12d43ae7bbca307c829091b.tar.gz
Prompt for Coehorns in defense during assault.
-rw-r--r--rules.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index b5c3f1d..53949f0 100644
--- a/rules.js
+++ b/rules.js
@@ -4559,6 +4559,14 @@ function can_play_coehorns_in_attack() {
return false
}
+function can_play_coehorns_in_defense() {
+ // If played during siege, this will be false during assault because the card is in discard.
+ // There's no risk of being prompted twice.
+ if (is_card_available_for_defender(COEHORNS))
+ return game.battle.assault && has_friendly_regulars(game.battle.where)
+ return false
+}
+
function can_play_fieldworks_in_attack() {
if (!game.battle.assault) {
if (is_card_available_for_attacker(FIELDWORKS_1) || is_card_available_for_attacker(FIELDWORKS_2)) {
@@ -4595,7 +4603,7 @@ function goto_battle_attacker_events() {
function goto_battle_defender_events() {
set_active(game.battle.defender)
- if (can_play_ambush_in_defense() || can_play_fieldworks_in_defense()) {
+ if (can_play_ambush_in_defense() || can_play_coehorns_in_defense() || can_play_fieldworks_in_defense()) {
game.state = 'defender_events'
} else {
goto_battle_roll()
@@ -4704,6 +4712,14 @@ states.defender_events = {
else
dont_have.push('"Ambush"')
}
+ if (can_play_coehorns_in_defense()) {
+ if (player.hand.includes(COEHORNS)) {
+ gen_action('play_event', COEHORNS)
+ have.push('"Coehorns"')
+ } else {
+ dont_have.push('"Coehorns"')
+ }
+ }
if (can_play_fieldworks_in_defense()) {
let x = false
if (player.hand.includes(FIELDWORKS_1)) {
@@ -4740,6 +4756,9 @@ states.defender_events = {
else
game.events.ambush = game.active
break
+ case COEHORNS:
+ game.events.coehorns = game.active
+ break
case FIELDWORKS_1:
case FIELDWORKS_2:
place_fieldworks(game.battle.where)