summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-24 23:52:41 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-03 18:48:16 +0200
commit3281c3d380f96d9ce6ed4ead3198a88f45dcce84 (patch)
treec887a829c94c46dc120a6a473e195ab63c2041ad /rules.js
parentc627af2462954bd4f000d9a4fc43fe63ed1a2358 (diff)
downloadandean-abyss-3281c3d380f96d9ce6ed4ead3198a88f45dcce84.tar.gz
Remove Terror first for Train Civic Action.
Add a common do_civic_action function.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js31
1 files changed, 19 insertions, 12 deletions
diff --git a/rules.js b/rules.js
index 7ea466e..10b4690 100644
--- a/rules.js
+++ b/rules.js
@@ -2923,16 +2923,30 @@ function goto_train_civic_action(s) {
}
function do_train_civic_action() {
- pay_resources(GOVT, 3, true)
- shift_support(game.op.where)
- logi_support_shift(game.op.where)
-
+ do_civic_action(game.op.where, false)
if (can_govt_train_civic(game.op.where))
game.state = "train_civic_buy"
else
end_train_civic_action()
}
+function do_civic_action(s, verbose) {
+ pay_resources(GOVT, 3)
+ if (has_terror(s)) {
+ if (verbose)
+ logi("Removed Terror from S" + s)
+ else
+ logi("Removed Terror")
+ remove_terror(s)
+ } else {
+ shift_support(s)
+ if (verbose)
+ logi("S" + s + " to " + support_level_name[game.support[s]])
+ else
+ logi(support_level_name[game.support[s]])
+ }
+}
+
function end_train_civic_action() {
game.state = "train_done"
}
@@ -6194,14 +6208,7 @@ states.civic_action = {
push_undo()
if (!has_troops(s) || !has_police(s))
set_add(game.prop.first_div, s)
- pay_resources(GOVT, 3)
- if (has_terror(s)) {
- logi("Removed Terror from S" + s)
- remove_terror(s)
- } else {
- shift_support(s)
- logi("S" + s + " to " + support_level_name[game.support[s]])
- }
+ do_civic_action(s, true)
game.prop.count++
},
done() {