summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-08 23:30:10 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-03 18:48:16 +0200
commit597be28790ec5fabe70ceb5e5401b0391db84bcb (patch)
treeaf7daf8f1c42174fee3543c73ec6360ca10273c7
parent08f9e4037a61b56bae26e1cb12a80c93894ddeba (diff)
downloadandean-abyss-597be28790ec5fabe70ceb5e5401b0391db84bcb.tar.gz
Automatic Eradicate place.
-rw-r--r--rules.js34
1 files changed, 15 insertions, 19 deletions
diff --git a/rules.js b/rules.js
index 4c97cea..cc24a4c 100644
--- a/rules.js
+++ b/rules.js
@@ -4313,9 +4313,12 @@ states.eradicate_base = {
}
function goto_eradicate_shift() {
- // TODO: auto_place FARC GUERRILLA
if (can_eradicate_shift())
game.state = "eradicate_shift"
+ else if (AUTOMATIC && auto_place_piece(game.sa.where, FARC, GUERRILLA))
+ end_special_activity()
+ else if (can_place_piece(game.sa.where, FARC, GUERRILLA))
+ game.state = "eradicate_place"
else
end_special_activity()
}
@@ -4326,37 +4329,30 @@ function can_eradicate_shift() {
for (let s of data.spaces[game.sa.where].adjacent)
if (can_shift_opposition(s))
return true
- return can_place_piece(game.sa.where, FARC, GUERRILLA)
+ return false
}
states.eradicate_shift = {
prompt() {
view.prompt = `Eradicate: Shift ${space_name[game.sa.where]} or adjacent space toward active Opposition.`
view.where = game.sa.where
-
- let can_shift = false
-
- if (can_shift_opposition(game.sa.where)) {
+ if (can_shift_opposition(game.sa.where))
gen_action_space(game.sa.where)
- can_shift = true
- }
- for (let s of data.spaces[game.sa.where].adjacent) {
- if (can_shift_opposition(s)) {
+ for (let s of data.spaces[game.sa.where].adjacent)
+ if (can_shift_opposition(s))
gen_action_space(s)
- can_shift = true
- }
- }
-
- if (!can_shift) {
- view.prompt = `Eradicate: Place available FARC Guerrilla in ${space_name[game.sa.where]}.`
- // TODO: auto_place
- gen_piece_in_space(AVAILABLE, FARC, GUERRILLA)
- }
},
space(s) {
shift_opposition(s)
end_special_activity()
},
+}
+
+states.eradicate_place = {
+ prompt() {
+ view.prompt = `Eradicate: Place available FARC Guerrilla in ${space_name[game.sa.where]}.`
+ gen_piece_in_space(AVAILABLE, FARC, GUERRILLA)
+ },
piece(p) {
place_piece(p, game.sa.where)
end_special_activity()