summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-20 14:43:51 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-03 18:48:16 +0200
commit14fdd3eedfe90b62f01cd3c57767e1a9dbd4308e (patch)
tree2d66ec33097683ae417b1ddd429adec3aa4af826 /rules.js
parentb236dc6c372e8168d2d0ce4a508382c6b645cf59 (diff)
downloadandean-abyss-14fdd3eedfe90b62f01cd3c57767e1a9dbd4308e.tar.gz
WIP extort
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js55
1 files changed, 30 insertions, 25 deletions
diff --git a/rules.js b/rules.js
index b9933bf..7032d7d 100644
--- a/rules.js
+++ b/rules.js
@@ -4892,25 +4892,37 @@ function goto_extort() {
states.extort = {
prompt() {
- if (game.sa.where < 0) {
- view.prompt = "Extort: Select space with Underground Guerrilla that you control."
- for (let s = first_space; s <= last_space; ++s) {
- if (set_has(game.sa.spaces, s))
- continue
- if (has_underground_guerrilla(s, game.current)) {
- if (game.current === FARC && has_farc_control(s))
- gen_action_space(s)
- if (game.current === AUC && has_auc_control(s))
- gen_action_space(s)
- }
+ view.prompt = "Extort: Select space with Underground Guerrilla that you control."
+ for (let s = first_space; s <= last_space; ++s) {
+ if (set_has(game.sa.spaces, s))
+ continue
+ if (has_underground_guerrilla(s, game.current)) {
+ if (game.current === FARC && has_farc_control(s))
+ gen_action_space(s)
+ if (game.current === AUC && has_auc_control(s))
+ gen_action_space(s)
}
- } else {
- view.prompt = `Extort in ${space_name[game.sa.where]}.`
- view.where = game.sa.where
- gen_underground_guerrillas(game.sa.where, game.current)
}
+ if (game.sa.spaces.length > 0)
+ view.actions.end_extort = 1
+ },
+ space(s) {
+ push_undo()
+ game.sa.where = s
+ set_add(game.sa.spaces, s)
+ game.state = "extort_space"
+ },
+ end_extort() {
+ push_undo()
+ end_extort()
+ },
+}
- view.actions.end_extort = 1
+states.extort_space = {
+ prompt() {
+ view.prompt = `Extort in ${space_name[game.sa.where]}.`
+ view.where = game.sa.where
+ gen_underground_guerrillas(game.sa.where, game.current)
},
piece(p) {
game.sa.count += 1
@@ -4920,15 +4932,8 @@ states.extort = {
game.sa.where = -1
if (!can_extort_again())
end_extort()
- },
- space(s) {
- push_undo()
- game.sa.where = s
- set_add(game.sa.spaces, s)
- },
- end_extort() {
- push_undo()
- end_extort()
+ else
+ game.state = "extort"
},
}