summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-09-20 14:20:46 +0100
committeriainp5 <iain.pearce.ip@gmail.com>2024-09-20 14:20:46 +0100
commit3646c0abaaf69b1453663313c0faf4499548bec4 (patch)
tree41e84a617d56c3d0570d2023902aa7f4957ce56f
parent066db0195cb566066354eab404e9bf1e7a29e62d (diff)
download1989-dawn-of-freedom-3646c0abaaf69b1453663313c0faf4499548bec4.tar.gz
Fix for remove_x_infl
-rw-r--r--rules.js31
1 files changed, 27 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 2b541da..25fc3d3 100644
--- a/rules.js
+++ b/rules.js
@@ -4160,20 +4160,41 @@ function vm_do_remove_infl(space) {
function vm_do_remove_x_infl(space) {
push_undo()
const clicked_space = find_space_index(space)
- log(`Removed ${game.vm_available_ops} influence from %${clicked_space}.`)
if (game.remove_opponent_infl) {
if (game.active === COM) {
+ if (game.pieces[clicked_space].demInfl >= game.vm_available_ops) {
game.pieces[clicked_space].demInfl -= game.vm_available_ops
+ } else {
+ game.vm_available_ops = game.pieces[clicked_space].demInfl
+ game.pieces[clicked_space].demInfl -= game.vm_available_ops
+ }
} else {
- game.pieces[clicked_space].comInfl -= game.vm_available_ops
+ if (game.pieces[clicked_space].comInfl >= game.vm_available_ops) {
+ game.pieces[clicked_space].comInfl -= game.vm_available_ops
+ } else {
+ game.vm_available_ops = game.pieces[clicked_space].comInfl
+ game.pieces[clicked_space].comInfl -= game.vm_available_ops
+ }
}
} else {
if (game.active === COM) {
- game.pieces[clicked_space].comInfl -= game.vm_available_ops
+ if (game.pieces[clicked_space].comInfl >= game.vm_available_ops) {
+ game.pieces[clicked_space].comInfl -= game.vm_available_ops
+ } else {
+ game.vm_available_ops = game.pieces[clicked_space].comInfl
+ game.pieces[clicked_space].comInfl -= game.vm_available_ops
+ }
} else {
- game.pieces[clicked_space].demInfl -= game.vm_available_ops
+ if (game.pieces[clicked_space].demInfl >= game.vm_available_ops) {
+ game.pieces[clicked_space].demInfl -= game.vm_available_ops
+ } else {
+ game.vm_available_ops = game.pieces[clicked_space].demInfl
+ game.pieces[clicked_space].demInfl -= game.vm_available_ops
+ }
}
+
+ log(`Removed ${game.vm_available_ops} influence from %${clicked_space}`)
}
check_control_change(clicked_space)
@@ -4957,6 +4978,7 @@ function vm_the_tyrant_is_gone() {
game.playable_cards[41].playable = 0
game.playable_cards[101].playable = 0
game.playable_cards[107].playable = 0
+ console.log('game.vm_event', game.vm_event)
game.state = 'vm_the_tyrant_is_gone'
}
@@ -6805,6 +6827,7 @@ states.vm_the_tyrant_is_gone = {
},
infl(space) {
push_undo()
+ log(`The Ceausescus flee to %${space}`)
game.persistent_events['the_tyrant_is_gone'] = find_space_index(space)
},
done () {