summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-08-12 01:07:51 +0200
committerTor Andersson <tor@ccxvii.net>2023-08-12 01:12:50 +0200
commit22aa4e63be0716c704a129d130855bf7b7f6e5c0 (patch)
tree306b4bc7c7d4a420d77facc5ec259c843ed5cd2a
parent72d4f97f138f42762f45a67728a9f518ff73eb7e (diff)
downloadrommel-in-the-desert-22aa4e63be0716c704a129d130855bf7b7f6e5c0.tar.gz
Allow dismantling a single minefield without placing a new one.
-rw-r--r--rules.js30
1 files changed, 26 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 0425651..539ed03 100644
--- a/rules.js
+++ b/rules.js
@@ -6143,7 +6143,7 @@ states.spending_bps = {
if (game.selected < 0) {
if (game.month >= 11 && has_friendly_unit_in_raw_hex(MALTA))
gen_action_hex(MALTA)
- if (count_friendly_minefields() >= 2 || bps >= 15)
+ if (count_friendly_minefields() >= 1 || bps >= 15)
gen_action('minefield')
if (bps >= 10)
gen_action('extra_supply_card')
@@ -6284,7 +6284,7 @@ states.minefield = {
prompt() {
view.prompt = `Buildup: Build a minefield.`
let mfs = friendly_minefields()
- if (count_friendly_minefields() >= 2)
+ if (count_friendly_minefields() >= 1)
gen_action('dismantle')
if (available_bps() >= 15) {
let net = friendly_buildup_network()
@@ -6295,7 +6295,10 @@ states.minefield = {
},
dismantle() {
push_undo()
- game.state = 'dismantle1'
+ if (count_friendly_minefields() >= 2)
+ game.state = 'dismantle1'
+ else
+ game.state = 'dismantle0'
},
hex(x) {
let mfs = friendly_minefields()
@@ -6306,6 +6309,25 @@ states.minefield = {
}
}
+states.dismantle0 = {
+ inactive: "buildup",
+ prompt() {
+ view.prompt = `Buildup: Dismantle minefield.`
+ let net = friendly_buildup_network()
+ for (let x of friendly_minefields())
+ if (net[x] && !is_battle_hex(x))
+ gen_action_hex(x)
+ for (let x of game.minefields[MF_VISIBLE])
+ if (net[x] && !is_battle_hex(x))
+ gen_action_hex(x)
+ },
+ hex(x) {
+ set_delete(friendly_minefields(), x)
+ set_delete(game.minefields[MF_VISIBLE], x)
+ game.state = 'spending_bps'
+ },
+}
+
states.dismantle1 = {
inactive: "buildup",
prompt() {
@@ -6347,7 +6369,7 @@ states.dismantle2 = {
states.dismantle3 = {
inactive: "buildup",
prompt() {
- view.prompt = `Buildup: Build a new minefield.`
+ view.prompt = `Buildup: Build a new minefield at no cost.`
let mfs = friendly_minefields()
let net = friendly_buildup_network()
for (let x of all_hexes)