summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-10-28 17:05:47 +0000
committeriainp5 <iain.pearce.ip@gmail.com>2024-11-02 07:50:48 +0000
commit64fa63421fb188db9c23c244ef6b81335cb10752 (patch)
tree7a35f893a38a316bf8976f1f6bbe689c3be3ac9b /rules.js
parent2a3049cec4d0d0153395b77d9974b3c50106b3d0 (diff)
download1989-dawn-of-freedom-64fa63421fb188db9c23c244ef6b81335cb10752.tar.gz
Updates to Table Cards and cleanup
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js70
1 files changed, 60 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index 54cfd26..0593375 100644
--- a/rules.js
+++ b/rules.js
@@ -222,6 +222,7 @@ const all_power_cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
const numberless_cards = [1, 2, 3, 4, 5, 6, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 ]
const auto_resolve_events = [5, 8, 9, 13, 17, 25, 26, 30, 35, 50, 53, 54, 58, 59, 62, 63, 65, 70, 72, 74, 86, 99, 102, 108]
const switch_events = [6, 20, 71]
+const one_turn_events = [ 8, 13, 25, 50, 63, 74, 49, 58, 59, 100, 101 ]
const PC_TACTIC_FAILS = 52
@@ -3752,7 +3753,27 @@ function new_turn() {
delete game.selected_space
//Remove events that only last one turn
- game.persistent_events = game.persistent_events.filter(n => n !== C_PERESTROIKA)
+
+ for (let e of one_turn_events) {
+ if (game.persistent_events.includes(e)) {
+ end_one_turn_event(e)
+ }
+ }
+ if (game.prudence) {
+ delete game.prudence
+ log_summary(`C${8}`)
+ }
+ if (game.summary.length > 0) {
+ log('No longer in effect:')
+ pop_summary_i()
+ log_br()
+ }
+ delete game.stasi_card
+ delete game.stand_fast
+
+/* TODO: Add log for events no longer in effect */
+
+ /*game.persistent_events = game.persistent_events.filter(n => n !== C_PERESTROIKA)
game.persistent_events = game.persistent_events.filter(n => n !== C_THE_SINATRA_DOCTRINE)
game.persistent_events = game.persistent_events.filter(n => n !== C_STASI)
game.persistent_events = game.persistent_events.filter(n => n !== C_HONECKER)
@@ -3795,12 +3816,18 @@ function new_turn() {
discard_from_table(63)
permanently_remove(63)
}
+ //Stasi
+ if (game.persistent_events.includes(C_STASI)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== C_STASI)
+ discard_from_table(C_STASI)
+ log(`C${C_STASI} no longer in effect`)
+ }
//Stand Fast
if (game.persistent_events.includes(100)) {
game.persistent_events = game.persistent_events.filter(n => n !== 100)
delete game.stand_fast
log(`C100 no longer in effect`)
- }
+ }*/
if (game.samizdat_card > 0 ) {
game.democrat_hand.push(game.samizdat_card)
@@ -3857,6 +3884,12 @@ function new_turn() {
}
}
+function end_one_turn_event(event) {
+ game.persistent_events = game.persistent_events.filter(n => n !== event)
+ discard_from_table(event)
+ log_summary(`C${event}`)
+}
+
function next_player() {
clear_undo()
if (game.active === DEM)
@@ -4020,8 +4053,12 @@ function discard_card(hand) {
function discard_from_table(card) {
let find_card = game.table_cards.indexOf(card)
- game.table_cards.splice(find_card, 1)
- game.strategy_discard.push(card)
+ if (find_card !== -1) {
+ game.table_cards.splice(find_card, 1)
+ if (cards[card].remove === 1 && !game.strategy_removed.includes(card)) {
+ game.strategy_removed.push(card)
+ } else {game.strategy_discard.push(card) }
+ }
}
@@ -4214,6 +4251,19 @@ function pop_summary() {
game.summary = []
}
+function pop_summary_i() {
+ if (game.summary.length > 0) {
+ for (let [n, msg] of game.summary) {
+ if (n > 1) {
+ logi(msg.replace("£ SP", `${n} SPs`));
+ } else {
+ logi(msg.replace("£ SP", `${n} SP`));
+ }
+ }
+ }
+ game.summary = []
+}
+
function log_summary_place(p) {
let from = piece_space(p)
if (from !== AVAILABLE)
@@ -5556,8 +5606,9 @@ function vm_peasant_parties_revolt() {
}
function vm_perestroika() {
- game.persistent_events.push(25)
- log_msg_gap('C25 in effect')
+ game.persistent_events.push(C_PERESTROIKA)
+ game.table_cards.push(C_PERESTROIKA)
+ log_msg_gap(`C${C_PERESTROIKA} in effect`)
vm_next()
}
@@ -5687,6 +5738,7 @@ function vm_st_nicholas_church () {
function vm_stasi() {
log_msg_gap('C13 in effect')
+ game.table_cards.push(C_STASI)
game.persistent_events.push(C_STASI)
vm_next()
}
@@ -5754,7 +5806,8 @@ function vm_the_monday_demonstrations() {
function vm_the_sinatra_doctrine() {
game.persistent_events.push(C_THE_SINATRA_DOCTRINE)
- log_msg_gap('C50 in effect')
+ game.table_cards.push(C_THE_SINATRA_DOCTRINE)
+ log_msg_gap(`C${C_THE_SINATRA_DOCTRINE} in effect`)
vm_next()
}
@@ -8537,7 +8590,6 @@ CODE[12] = [ // Apparatchicks
]
CODE[13] = [ // Stasi
- [ vm_permanently_remove ],
[ vm_stasi ],
[ vm_return ],
]
@@ -8615,7 +8667,6 @@ CODE[24] = [ // St Nicolas Church
]
CODE[25] = [ // Perestroika
- [ vm_permanently_remove ],
[ vm_perestroika ],
[ vm_return ],
]
@@ -8818,7 +8869,6 @@ CODE[49] = [ // Foreign Currency Debt Burden*
]
CODE[50] = [ // The Sinatra Doctrine*
- [ vm_permanently_remove ],
[ vm_the_sinatra_doctrine ],
[ vm_return ],
]