From 9e7c1420da9c57f5af27e24ef8a84e7c3cc13116 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Mon, 7 Oct 2024 20:01:52 +0100 Subject: Fix for Sinatra/Peretroika in TST award --- rules.js | 88 +++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 32 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 3e13e98..1511719 100644 --- a/rules.js +++ b/rules.js @@ -686,6 +686,7 @@ states.resolve_opponent_event = { }, tst_7() { push_undo() + log('Event cancelled using Tiananmen Square Track Award') game.tst_7 = true game.vm_event_to_do = false }, @@ -2318,42 +2319,14 @@ function do_sc(space) { // Check if in Tiananmen Square Track Award else if (game.state === 'vm_tst_6_sc') { + roll += get_tst_6_ops() roll += 2 log('+2 from Tiananmen Square Track award') } else { //let modifier = 0 let card_ops = get_card_ops(this_card()) -/* - // Start with base value of card - log(`+${card_ops} from card`) - - //Check for events which modify card ops - // Check for Perestoika - if (game.active === COM && game.persistent_events.includes(25)) { - log(`+1 from C25`) - modifier++ - } - // Check for Sinatra Doctrine - if (game.active === DEM && game.persistent_events.includes(50)) { - log(`+1 from C50`) - modifier++ - } - // Check for Prudence - if (game.active === DEM && game.prudence && game.prudence.DEM < 0) { - log(`${pluralize(game.prudence.DEM, ' op')} from C8`) - modifier += game.prudence.DEM - } - if (game.active === COM && game.prudence && game.prudence.COM < 0) { - log(`${pluralize(game.prudence.COM, ' op')} from C8`) - modifier += game.prudence.COM - } - let modified_ops = card_ops + modifier - //Check modified card ops is not less than 1 - if ((modified_ops) < 1) { - modified_ops = 1 - } - */ + roll += card_ops log(`+${card_ops} from card ops`) } @@ -3262,7 +3235,11 @@ function get_events(card){ } function get_card_ops(card) { - let ops = cards[card].ops + let ops = 0 + + if (card) { + ops = cards[card].ops + } if (game.persistent_events.includes(25) && game.active === COM) { if(game.state === 'choose_card' || game.state === 'stasi_play_card') { log('+1 op from C25') @@ -3294,6 +3271,7 @@ function get_card_ops(card) { } } ops += game.prudence.DEM + if (ops < 1) { ops = 1 } @@ -3314,6 +3292,49 @@ function get_card_ops(card) { } return ops } +function get_tst_6_ops() { + let ops = 0 + + if (game.persistent_events.includes(25) && game.active === COM) { + log('+1 op from C25') + ops ++ + } + if (game.persistent_events.includes(50) && game.active === DEM) { + log('+1 op from C50') + ops ++ + } + + if ((game.active === DEM && game.prudence && game.prudence.DEM !== 0)) { + if (ops > 0) { + log(`${pluralize(game.prudence.DEM,'op')} from C8`) + } else { + log(`-1 op from C8`) + } + + ops += game.prudence.DEM + + if (ops < -1) { + ops = -1 + } + } + + if (game.active === COM && game.prudence && game.prudence.COM < 0) { + + if (ops > 0) { + log(`${pluralize(game.prudence.COM,'op')} from C8`) + } else { + log(`-1 op from C8`) + } + + ops += game.prudence.COM + if (ops < -1) { + ops = -1 + } + } + return ops +} + + // =========== MOVING THROUGH TURNS ============ function end_round() { @@ -8248,12 +8269,15 @@ states.vm_tst_8 = { } }, event() { + push_undo() game.vm_event_to_do = false game.return_state = 'vm_tst_8' game.return = game.active - goto_vm(game.played_card) + game.vm_event = game.played_card + goto_vm(game.vm_event) }, ops() { + push_undo() game.vm_infl_to_do = false game.return = game.active game.return_state = 'vm_tst_8' -- cgit v1.2.3