diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-04-08 23:30:10 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-05-03 18:48:16 +0200 |
commit | 597be28790ec5fabe70ceb5e5401b0391db84bcb (patch) | |
tree | af7daf8f1c42174fee3543c73ec6360ca10273c7 | |
parent | 08f9e4037a61b56bae26e1cb12a80c93894ddeba (diff) | |
download | andean-abyss-597be28790ec5fabe70ceb5e5401b0391db84bcb.tar.gz |
Automatic Eradicate place.
-rw-r--r-- | rules.js | 34 |
1 files changed, 15 insertions, 19 deletions
@@ -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() |