From 2ebc3dbec73650c26db8c9b49b98887f19a99ec2 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Wed, 18 Sep 2024 08:30:55 +0100 Subject: Updates to log for scoring --- rules.js | 67 ++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 29 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 6f3a8bb..f7aee78 100644 --- a/rules.js +++ b/rules.js @@ -545,6 +545,7 @@ states.play_card ={ goto_vm(game.played_card)} else { next_player() + log(`C${game.played_card}`) goto_vm(game.played_card) } }, @@ -1469,7 +1470,11 @@ states.vp_roll = { } log(`Modified roll: ${roll}`) let vp_change = vp_roll[roll] - log(`Gain ${vp_change} VP`) + if (game.active === DEM) { + log(`+${vp_change} VP`) + } else { + log(`-${vp_change} VP`) + } if (roll >= 4) if (game.active === DEM) {game.vp += vp_change} else {game.vp -= vp_change} @@ -2608,26 +2613,26 @@ function score_country(country) { } else { value_control = 4 } - -//Check for presence +//Log for scoring + //Check for presence let presence = check_presence(country) console.log('presence: ', presence) -//Check for domination or control + //If one side has domination or control if (presence.dem_control || presence.dem_domination) { log(`Democrat:`) if (presence.dem_control) { - log(`Control: ${value_control} VP`) + log(`Control: +${value_control} VP`) } else { - log(`Domination: ${value_domination} VP`) + log(`Domination: +${value_domination} VP`) } - log(`Battlegrounds: ${presence.dem_battlegrounds} VP`) + log(`Battlegrounds: +${presence.dem_battlegrounds} VP`) log_gap('Communist:') if (presence.com_spaces > 0) { - log(`Presence: ${value_presence} VP`) + log(`Presence: -${value_presence} VP`) if (presence.com_battlegrounds >0) { - log(`Battlegrounds: ${presence.com_battlegrounds} VP`) + log(`Battlegrounds: -${presence.com_battlegrounds} VP`) } } else { log('No presence: 0 VP') @@ -2637,17 +2642,17 @@ function score_country(country) { else if (presence.com_control || presence.com_domination) { log('Communist:') if (presence.com_control) { - log(`Control: ${value_control} VP`) + log(`Control: -${value_control} VP`) } else { - log(`Domination: ${value_domination} VP`) + log(`Domination: -${value_domination} VP`) } - log(`Battlegrounds: ${presence.com_battlegrounds} VP`) + log(`Battlegrounds: -${presence.com_battlegrounds} VP`) log_gap('Democrat:') if (presence.dem_spaces > 0) { - log(`Presence: ${value_presence} VP`) + log(`Presence: +${value_presence} VP`) if (presence.dem_battlegrounds > 0) { - log(`Battlegrounds: ${presence.dem_battlegrounds} VP`) + log(`Battlegrounds: +${presence.dem_battlegrounds} VP`) } } else { log('No presence: 0 VP') @@ -2655,28 +2660,31 @@ function score_country(country) { } -// Otherwise, score for battlegrounds + //Otherwise, presence and battlegrounds else { log("No domination or control") + log_gap(`Communist:`) if (presence.com_spaces > 0) { - log(`Communist has presence: gains ${value_presence} VP`) + log(`Presence: -${value_presence} VP`) + if (presence.com_battlegrounds > 0) { + log(`Battlegrounds: -${presence.com_battlegrounds} VP`) + } } else { - log('Communist has no presence') - } - if (presence.com_battlegrounds >0) { - log(`And ${presence.com_battlegrounds} battlegrounds: gains ${presence.com_battlegrounds} VP`) + log('No presence: 0 VP') } + log_gap('Democrat:') if (presence.dem_spaces > 0) { - log(`Democrat has presence: gains ${value_presence} VP`) + log(`Presence: +${value_presence} VP`) + if (presence.dem_battlegrounds > 0) { + log(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + } } else { - log('Democrat has no presence') - } - if (presence.dem_battlegrounds > 0) { - log(`And ${presence.dem_battlegrounds} battlegrounds: gains ${presence.dem_battlegrounds} VP`) + log('No presence: 0 VP') } - } + +//Calculate change VP let dem_vp = 0 if (presence.dem_spaces > 0) {dem_vp += value_presence} if (presence.dem_domination) {dem_vp += value_presence} @@ -4856,6 +4864,7 @@ function vm_the_chinese_solution() { function vm_the_crowd_turns_against_ceausescu() { game.persistent_events['the_crowd_turns_against_ceausescu'] = true game.table_cards.push(54) + game.playable_cards[97] = 1 vm_next() } @@ -5633,7 +5642,7 @@ states.vm_play_event_from_discard = { }, prompt() { if (game.valid_cards.length === 0) { - view.prompt = 'No valid cards in discard.' + view.prompt = `${clean_name(cards[this_card()].name)}: no valid cards in discard.` gen_action('done') } else if (game.temp === 0) { view.prompt = `${event_prompt()}.` @@ -5919,7 +5928,7 @@ states.vm_honecker = { states.vm_inflationary_currency = { get inactive() { - return `resolve ${cards[game.played_card].name}.` + return `resolve ${clean_name(cards[game.played_card].name)}.` }, prompt() { view.prompt = 'Inflationary Currency: choose a country where your opponent has power.' @@ -6033,7 +6042,7 @@ states.vm_kiss_of_death = { game.state = 'vm_kiss_of_death_finish' }, pass() { - log('No cards to discard') + log('No card to discard') vm_next() } } -- cgit v1.2.3