summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-10-20 17:20:28 +0100
committeriainp5 <iain.pearce.ip@gmail.com>2024-10-20 17:20:28 +0100
commit02e68e9059d5302901705dbf0bf8631d996d4f9a (patch)
treee45b84459a999ced2a3e1f088518e217212ad004 /rules.js
parent6d8ac00db1366e7b0c790e679bc439c8fcac5fed (diff)
download1989-dawn-of-freedom-02e68e9059d5302901705dbf0bf8631d996d4f9a.tar.gz
Teisuru comments set 1
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js302
1 files changed, 142 insertions, 160 deletions
diff --git a/rules.js b/rules.js
index 6ea9327..1e68bea 100644
--- a/rules.js
+++ b/rules.js
@@ -108,7 +108,7 @@ function start_game() {
// Draw cards
- console.log('start game')
+ //console.log('start game')
game.strategy_deck = draw_deck(cards)
reset_power()
@@ -222,12 +222,12 @@ exports.view = function(state, player) {
view.opp_hand = game.communist_hand_red
}
view.set_aside = game.democrat_set_aside /*Is this being used? */
- view.power_hand = game.dem_pwr_hand.sort((a, b) => a - b)
+ view.power_hand = [...game.dem_pwr_hand].sort((a, b) => a - b)
} else if (player === COM) {
view.hand = game.communist_hand
- view.opp_hand = game.dem_pwr_hand.sort((a, b) => a - b)
- view.power_hand = game.com_pwr_hand.sort((a, b) => a - b)
+ view.opp_hand = [...game.dem_pwr_hand].sort((a, b) => a - b)
+ view.power_hand = [...game.com_pwr_hand].sort((a, b) => a - b)
}
if (player === DEM) {
@@ -317,7 +317,7 @@ exports.action = function (state, player, action, arg) {
states.com_init = {
inactive: 'place starting SPs.',
prompt() {
- console.log('state:', game.state, 'game.valid_spaces', game.valid_spaces)
+ //console.log('state:', game.state, 'game.valid_spaces', game.valid_spaces)
if (game.starting_infl.dem_starting_infl === 2 && game.available_ops === 0 ) {
view.prompt = 'Place starting SPs: done. Start Turn 1.';
gen_action("start");
@@ -370,7 +370,7 @@ states.com_init = {
states.dem_init = {
inactive: 'place starting SPs.',
prompt() {
- console.log('state:', game.state)
+ //console.log('state:', game.state)
if (game.available_ops == 0) {
view.prompt = 'Place starting SPs: done.';
gen_action("done");
@@ -410,7 +410,6 @@ states.dem_init = {
states.choose_card = {
inactive: 'choose a card.',
prompt() {
- console.log('state:', game.state)
if ((game.active===DEM && game.democrat_hand.length === 0) || game.active === COM && game.communist_hand.length === 0) {
view.prompt = 'No cards remaining: you must pass.'
gen_action('pass')
@@ -496,11 +495,11 @@ states.play_card ={
}
//Check for events
- console.log('event_is_playable(game.played_card)', event_is_playable(game.played_card))
+ //console.log('event_is_playable(game.played_card)', event_is_playable(game.played_card))
if (event_is_playable(game.played_card)) {
- console.log('card is playable')
+ //console.log('card is playable')
//Check for Tiananmen Square Track awards special abilities
- console.log('game.tst_7', game.tst_7)
+ //console.log('game.tst_7', game.tst_7)
if ((game.active === DEM && cards[game.played_card].side === 'C' && game.dem_tst_position >= 7 && game.com_tst_position < 7 && !game.tst_7) || (game.active === COM && cards[game.played_card].side === 'D' && game.com_tst_position >= 7 && game.dem_tst_position < 7 && !game.tst_7)){
gen_action('tst_7')
}
@@ -523,7 +522,7 @@ states.play_card ={
},
event() {
push_undo()
- console.log('played event, game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
+ //console.log('played event, game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
log_gap(`Played C${cards[game.played_card].number} for the event`)
game.vm_infl_to_do = false
if (scoring_cards.includes(game.played_card)) {game.phase = 0}
@@ -531,7 +530,7 @@ states.play_card ={
game.return = game.active
if (switch_events.includes(game.played_card)) {next_player()}
game.vm_event = game.played_card
- console.log('before event, game.vm_infl_to_do', game.vm_infl_to_do)
+ //console.log('before event, game.vm_infl_to_do', game.vm_infl_to_do)
goto_vm(game.vm_event)
},
opp_event() {
@@ -633,7 +632,7 @@ states.resolve_opponent_event = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- console.log('in resolve opponent event: discard', game.strategy_discard)
+ //console.log('in resolve opponent event: discard', game.strategy_discard)
if (game.vm_infl_to_do) {
view.prompt = 'Event resolved. Choose to play card for:'
gen_action('influence')
@@ -868,7 +867,7 @@ states.tiananmen_square_attempt_success = {
},
done () {
push_undo()
- console.log('going to tst award, game.return_state', game.return_state)
+ //console.log('going to tst award, game.return_state', game.return_state)
goto_vm(game.vm_event)
},
end_round () {
@@ -1026,7 +1025,6 @@ states.support_check_prep = {
} /*else { */
}
game.state = 'do_support_check'
- console.log('game.state after space selected:', game.state)
//}
},
end_round() {
@@ -1039,6 +1037,7 @@ states.support_check_prep = {
if (game.return !== game.active) {
next_player()
}
+ log_h2('Raise the Stakes')
game.state = 'raise_stakes_1'
return
}
@@ -1050,7 +1049,7 @@ states.support_check_prep = {
states.do_support_check = {
inactive: 'do support checks.',
prompt () {
- console.log('in do_support_check')
+ // console.log('in do_support_check')
view.prompt = `Support check: ${spaces[game.selected_space].name_unique}. Roll a die.`
gen_action('roll')
},
@@ -1105,11 +1104,11 @@ states.draw_power_cards = {
draw() {
push_undo()
game.power_struggle_deck = [...all_power_cards]
- console.log('game.power_struggle_deck.length', game.power_struggle_deck.length)
- console.log('called draw cards, country', game.pwr_struggle_in, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
- console.log('test3')
+ // console.log('game.power_struggle_deck.length', game.power_struggle_deck.length)
+ //console.log('called draw cards, country', game.pwr_struggle_in, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
+ //console.log('test3')
let presence = check_presence(game.pwr_struggle_in)
- console.log('test2')
+ //console.log('test2')
if (presence.dem_spaces > 0) {
game.dem_pwr_hand_limit = 6 + 2*(presence.dem_spaces - 1)
} else {
@@ -1155,7 +1154,7 @@ states.draw_power_cards = {
//Draw Power Cards
game.is_pwr_struggle = true
- console.log('game.dem_pwr_hand_limit', game.dem_pwr_hand_limit, 'game.com_pwr_hand_limit', game.com_pwr_hand_limit)
+ //console.log('game.dem_pwr_hand_limit', game.dem_pwr_hand_limit, 'game.com_pwr_hand_limit', game.com_pwr_hand_limit)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand_limit, game.com_pwr_hand_limit)
if (game.active === DEM) {
game.valid_cards = [...game.dem_pwr_hand]
@@ -1169,18 +1168,18 @@ states.draw_power_cards = {
//Check if The Crowd Turns Against Ceausescu occurs
if (game.table_cards.includes(54) && game.pwr_struggle_in === 'Romania') {
- console.log('draw cards: crowd subcheck, game.active', game.active)
+ //console.log('draw cards: crowd subcheck, game.active', game.active)
if (game.active === COM) {
game.return = COM
next_player()
}
- log_h3('The Crowd Turns Against Ceausescu')
+ log_h3('C54')
game.persistent_events.push(54)
game.state = 'the_crowd_turns_against_ceausescu_prep'
} else {
log_h2('Raise the Stakes')
game.state = 'raise_stakes_1'
- console.log('game.state', game.state, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
+ //console.log('game.state', game.state, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
}
}
}
@@ -1196,10 +1195,11 @@ states.the_crowd_turns_against_ceausescu_prep = {
draw() {
game.ceausescu_cards = []
draw_cards(game.power_struggle_deck, game.ceausescu_cards, game.com_pwr_hand, 15, game.com_pwr_hand.length)
- console.log('game.ceausescu_cards', game.ceausescu_cards)
+ //console.log('game.ceausescu_cards', game.ceausescu_cards)
game.temp = game.ceausescu_cards.filter(card => card && card >=25 && card <= 30).length
log(`Drew ${pluralize(game.temp, 'Rally in the Square')}.`)
game.vm_available_ops = game.temp * 3
+ log(`Democrat takes a ${game.vm_available_ops} Action Round`)
game.state = 'vm_the_crowd_turns_against_ceausescu'
}
}
@@ -1265,8 +1265,8 @@ states.raise_stakes_1 = {
inactive: 'raise the stakes.',
prompt () {
- console.log('raise stakes 1 - valid cards', game.valid_cards)
- console.log('raise the stakes: game.played_power_card', game.played_power_card, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
+ // console.log('raise stakes 1 - valid cards', game.valid_cards)
+ // console.log('raise the stakes: game.played_power_card', game.played_power_card, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
if ((game.active === DEM && game.dem_pwr_hand < 3) || (game.active === COM && game.com_pwr_hand < 3)) {
view.prompt = 'Raise the stakes: you must pass.'
gen_action('pass')
@@ -1314,13 +1314,13 @@ states.raise_stakes_1 = {
log_gap('Raised the stakes')
game.raised_stakes_discard = 0
next_player()
- console.log('game.active', game.active)
+ //console.log('game.active', game.active)
if (game.active === DEM) {
game.valid_cards = [...game.dem_pwr_hand]
} else {
game.valid_cards = [...game.com_pwr_hand]
}
- console.log('game.valid_cards', game.valid_cards)
+ // console.log('game.valid_cards', game.valid_cards)
game.state = 'raise_stakes_2'
}
}
@@ -1396,7 +1396,7 @@ states.begin_power_struggle = {
states.power_struggle = {
inactive: 'play a card.',
prompt () {
- console.log('game.tactics_fails', game.tactics_fails)
+ //console.log('game.tactics_fails', game.tactics_fails)
if (game.phase === 0) {
if (game.valid_cards.length > 0) {
view.prompt = "Play a card."
@@ -1576,7 +1576,7 @@ states.power_struggle = {
states.support_loss ={
inactive: 'do Support Loss.',
prompt () {
- console.log('game.played_power_card', game.played_power_card)
+ //console.log('game.played_power_card', game.played_power_card)
if (game.phase === 0) {
view.prompt = 'You lost the Power Struggle. Roll a die for Support Loss.'
gen_action('roll')
@@ -1631,7 +1631,9 @@ states.support_loss ={
log('Does not remove SPs')
}
game.phase++
- valid_spaces_support_loss()
+ if (game.available_ops > 0) {
+ valid_spaces_support_loss()
+ }
},
infl (space) {
game.remove_opponent_infl = false /* Don't know why this is needed... */
@@ -1700,10 +1702,10 @@ states.vp_roll = {
log(`-${vp_change} VP`)
}
if (roll >= 4)
- console.log('VP before', game.vp)
+ //console.log('VP before', game.vp)
if (game.active === DEM) {game.vp += vp_change}
else {game.vp -= vp_change}
- console.log('VP after', game.vp)
+ //console.log('VP after', game.vp)
if (game.active === DEM && modified_roll >= 4) {
game.phase = 1
} else {
@@ -1811,7 +1813,7 @@ states.finish_scoring ={
gen_action('done')
} ,
done() {
- console.log('game.return_state', game.return_state)
+ //console.log('game.return_state', game.return_state)
log_msg_gap('Power Struggle resolved') /*At this point log card dicarded or permanently removed? */
if (game.persistent_events.includes(111)) {
game.state = 'new_years_eve_party'
@@ -1903,7 +1905,7 @@ states.final_scoring_held = {
gen_action('bonus')
},
bonus() {
- console.log('game.revolutions: ', game.revolutions)
+ // console.log('game.revolutions: ', game.revolutions)
const held_countries = game.revolutions.filter(value => value === false).length
let vp_gain = 4*held_countries
log(`Communist holds ${held_countries} countries: -${vp_gain} VP`)
@@ -2137,7 +2139,7 @@ states.new_years_eve_party = {
states.stasi_end_round = {
inactive: 'choose next card due to Stasi.',
prompt() {
- console.log('game.stasi_card', game.stasi_card)
+ //console.log('game.stasi_card', game.stasi_card)
let available_cards = game.democrat_hand
if (available_cards.length === 0) {
view.prompt = 'Stasi: no cards remaining.'
@@ -2152,7 +2154,7 @@ states.stasi_end_round = {
},
card(card) {
push_undo()
- log_gap(`Stasi: selected C${cards[card].number}`)
+ log_gap(`Democract selected C${cards[card].number} as next card.`)
game.stasi_card = card
game.state = 'stasi_finish'
},
@@ -2223,7 +2225,7 @@ states.stasi_play_card = {
},
card(card) {
push_undo()
- log_msg_gap(`Stasi: played C${card}`)
+ //log_msg_gap(`Stasi: played C${card}`)
game.played_card = card
let find_card
find_card = game.democrat_hand.indexOf(card);
@@ -2277,7 +2279,7 @@ states.stasi_resolve_common_european_home = {
function add_infl(space) {
push_undo()
- console.log('adding infl to', space)
+ //console.log('adding infl to', space)
//console.log('at start, event', game.persistent_events['austria_hungary_border_reopened'], 'ahbr', game.austria_hungary_border_reopened, 'tracker', game.austria_hungary_border_reopened_tracker)
//log(`Added 1 influence in %${space}`)
log_summary(`Added £ SP in %${space}`)
@@ -2329,14 +2331,14 @@ function add_infl(space) {
//console.log(`in Genscher / AHBR check, game.persistent_events['genscher']`, game.persistent_events['genscher'])
if (game.active === DEM) {
if (game.persistent_events.includes(63) || (game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker)) {
- console.log('in gensher subcheck - remove non-East German controlled ')
+ //console.log('in gensher subcheck - remove non-East German controlled ')
game.valid_spaces = game.valid_spaces.filter(n => !(check_opp_control(n) && spaces[n].country !== 'East_Germany'))
} else {
- console.log('remove all controlled spaces')
+ //console.log('remove all controlled spaces')
game.valid_spaces = game.valid_spaces.filter(n => !check_opp_control(n))
}
} else {
- console.log('remove all dem controlled spaces')
+ //console.log('remove all dem controlled spaces')
game.valid_spaces = game.valid_spaces.filter(n => !check_opp_control(n))
}
}
@@ -2394,7 +2396,7 @@ function do_sc(space) {
game.vp ++
if (check_vp()) {
game.state = 'game.over'
- console.log('after check_vp, game.state', game.state)
+ //console.log('after check_vp, game.state', game.state)
return
}
}
@@ -2431,46 +2433,46 @@ function do_sc(space) {
let card_ops = get_card_ops(this_card())
roll += card_ops
- logi(`+${card_ops} ops`)
+ logi(`+${card_ops} from card ops`)
}
if (game.support_check_modifier > 0) {
roll += game.support_check_modifier
- logi(`+${game.support_check_modifier} event`)
+ logi(`+${game.support_check_modifier} from event`)
}
// Events which modify SC rolls
//Tear Gas
if (game.active === COM && game.persistent_events.includes(30) && spaces[space].socio === 6) {
roll ++
- logi('+1 C30')
+ logi('+1 from C30')
permanently_remove(30)
game.persistent_events = game.persistent_events.filter(n => n !== 30)
}
//FRG Embassies
if (game.active === DEM && spaces[space].region === 'Eastern Europe' && game.persistent_events.includes(74)) {
roll++
- logi('+1 C74')
+ logi('+1 from C74')
}
//GrenzTruppen
if (game.active === DEM && spaces[space].country === 'East_Germany' && game.persistent_events.includes(59)) {
roll--
- logi('-1 C59')
+ logi('-1 from C59')
}
//Stand Fast
if ((game.active === COM && game.stand_fast === DEM && check_dem_control(space)) || (game.active === DEM && game.stand_fast === COM && check_com_control(space))){
roll--
- logi('-1 C100')
+ logi('-1 from C100')
}
//Elena
if (game.active === DEM && game.persistent_events.includes(101) && spaces[space].country === 'Romania') {
roll--
- logi('-1 C101')
+ logi('-1 from C101')
}
//Austria Hungary Border Reopened
if (game.active === DEM && game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker) {
roll++
- logi(`+1 C58`)
+ logi(`+1 from C58`)
}
// Continue with logic - check for adjacency
@@ -2478,7 +2480,7 @@ function do_sc(space) {
// Events which affect adjacency - The Wall
const adj = count_adj(space)
- console.log('adj', adj)
+ //console.log('adj', adj)
if (game.active === COM && game.persistent_events.includes(9) && spaces[space].country === 'East_Germany') {
logi('No adjacency for Democrats due to C9')
logi('C9 no longer in effect')
@@ -2495,19 +2497,19 @@ function do_sc(space) {
roll += adj.dem_adj
roll -= adj.com_adj
if (adj.dem_adj > 0) {
- logi(`+${adj.dem_adj} adjacency`)
+ logi(`+${adj.dem_adj} from adjacency`)
}
if (adj.com_adj > 0) {
- logi(`-${adj.com_adj} opponent adjacency`)
+ logi(`-${adj.com_adj} from opponent adjacency`)
}
} else {
roll += adj.com_adj
roll -= adj.dem_adj
if (adj.com_adj > 0) {
- logi(`+${adj.com_adj} adjacency`)
+ logi(`+${adj.com_adj} from adjacency`)
}
if (adj.dem_adj > 0) {
- logi(`-${adj.dem_adj} opponent adjacency`)
+ logi(`-${adj.dem_adj} from opponent adjacency`)
}
}
}
@@ -2515,12 +2517,12 @@ function do_sc(space) {
}
// Support check calcs
- log(`Total: ${roll}`)
+ log(`Modified total: ${roll}`)
const stability = spaces[space].stability
logi(`-${stability*2} (stability * 2)`)
const change_infl = Math.max(0, roll - stability*2)
if (change_infl > 0) {
- log_msg_gap(`Change: ${change_infl} SP`)
+ log_msg_gap(`Change influence: ${change_infl} SP`)
if(game.active === DEM) {
if (change_infl > game.comInfl[space]) {
const residual = change_infl - game.comInfl[space]
@@ -2547,7 +2549,7 @@ function do_sc(space) {
check_control_change(space)
} else {
- log_msg_gap('Change: 0 SP')
+ log_msg_gap('Change influence: 0 SP')
}
if (game.active === COM && game.persistent_events.includes(39) && spaces[space].space_id === 66) {
log_msg_gap('+1 VP from C39')
@@ -2567,7 +2569,6 @@ function do_sc(space) {
}
-
function valid_spaces_setup() {
game.valid_spaces = []
let valid_spaces_set = new Set();
@@ -2595,7 +2596,7 @@ function valid_spaces_setup() {
function valid_spaces_sc() {
let valid_spaces_set = new Set();
- console.log('valid spaces sc, persistent events', game.persistent_events)
+ //console.log('valid spaces sc, persistent events', game.persistent_events)
for (let i = 1 ; i <= 75; i++) {
space = spaces[i]
@@ -2903,7 +2904,7 @@ function do_tst_attempt() {
roll ++
logi('+1 from C53')
}
- log(`Total: ${roll}`)
+ log(`Modified total: ${roll}`)
// TIANANMEN SQUARE ATTEMPT
game.return = game.active
@@ -3079,7 +3080,7 @@ function score_country(country) {
let com_vp = 0
//Check for presence
let presence = check_presence(country)
- console.log('presence: ', presence)
+// console.log('presence: ', presence)
//If one side has domination or control
if (presence.dem_control || presence.dem_domination) {
@@ -3216,7 +3217,7 @@ function get_end_infl_prompt() {
}
function permanently_remove(card) {
- console.log('permanently removing card:', card)
+ //console.log('permanently removing card:', card)
if (game.strategy_removed.includes(card)) {return}
//log_msg_gap(`C${cards[card].number} permanently removed`)
remove_from_discard(card)
@@ -3233,7 +3234,7 @@ function permanently_remove(card) {
function check_vp() {
if (game.vp >= 20) {
goto_game_over(DEM, `${DEM} won an Automatic Victory!`)
- console.log('after goto_game_over, game.state', game.state)
+ //console.log('after goto_game_over, game.state', game.state)
return true
} else if(game.vp <= -20) {
goto_game_over(COM, `${COM} won an Automatic Victory!`)
@@ -3255,7 +3256,7 @@ function goto_game_over(result, victory) {
game.victory = victory
log_h1("Game Over")
log(game.victory)
- console.log('game over, game.state', game.state)
+ //console.log('game over, game.state', game.state)
return
}
@@ -3323,7 +3324,7 @@ function select_card(card){
game.persistent_events = game.persistent_events.filter(n => n !== 99)
}
game.state = 'play_card'
- console.log('game.state', game.state)
+ //console.log('game.state', game.state)
}
function find_event(card) {
@@ -3347,7 +3348,7 @@ function get_events(card){
}
function event_is_playable(card) {
- console.log('game.stasi_card', game.stasi_card, 'card', card)
+// console.log('game.stasi_card', game.stasi_card, 'card', card)
//Reformer never playable here
if (card === 67) {
return false
@@ -3504,10 +3505,10 @@ function finish_the_wall() {
// =========== MOVING THROUGH TURNS ============
function end_round() {
- console.log('end round, game.persistent_events.includes(13)', game.persistent_events.includes(13))
+// console.log('end round, game.persistent_events.includes(13)', game.persistent_events.includes(13))
//Check if the game is over!
if (game.state === 'game_over') {
- console.log('in end')
+ // console.log('in end')
return}
//Check if the card has been removed or played to table, and if a card has been not been played. If not, discard.
@@ -3552,16 +3553,17 @@ function end_round() {
return [...new Set(duplicates)];
}
- console.log('game.strategy_deck', game.strategy_deck, 'game.strategy_discard', game.strategy_discard, 'game.strategy_removed', game.strategy_removed, 'game.table_cards', game.table_cards, 'game.communist_hand', game.communist_hand, 'game.democrat_hand', game.democrat_hand)
+ //console.log('game.strategy_deck', game.strategy_deck, 'game.strategy_discard', game.strategy_discard, 'game.strategy_removed', game.strategy_removed, 'game.table_cards', game.table_cards, 'game.communist_hand', game.communist_hand, 'game.democrat_hand', game.democrat_hand)
if (check_duplicates(card_check)) {
+ console.log('card check', card_check)
const duplicates = find_duplicates(card_check)
- console.log('discard', game.strategy_discard, 'removed', game.strategy_removed, 'game.table_cards', game.table_cards, 'com hand', game.communist_hand, 'dem hand', game.democrat_hand)
+ console.log('game.strategy_deck', game.strategy_deck, 'game.strategy_discard', game.strategy_discard, 'game.strategy_removed', game.strategy_removed, 'game.table_cards', game.table_cards, 'game.communist_hand', game.communist_hand, 'game.democrat_hand', game.democrat_hand)
throw new Error(`Duplicate cards detected: ${duplicates.join(', ')}`)
}
- console.log('cards in game', card_check.length)
+ //console.log('cards in game', card_check.length)
card_check = card_check.sort((a, b) => a - b)
- console.log('cards in game', card_check)
+ //console.log('cards in game', card_check)
if (game.turn <= 3) {
if (card_check.length !== 40) {
throw new Error(`Wrong number of cards: ${card_check.length}`)
@@ -3576,7 +3578,7 @@ function end_round() {
- console.log('game.dem_tst_position ', game.dem_tst_position , 'game.com_tst_position ', game.com_tst_position )
+ //console.log('game.dem_tst_position ', game.dem_tst_position , 'game.com_tst_position ', game.com_tst_position )
//Check if the Reformer is playable
check_reformer()
@@ -3632,9 +3634,10 @@ function end_round() {
next_player()
} else {
log_h3('Democratic Action Round')
- log_h3('C13')
+
}
if (game.democrat_hand.includes(game.stasi_card)) {
+ log_h3('C13')
game.state = 'stasi_play_card'
} else {
game.stasi_card = 0
@@ -3660,12 +3663,13 @@ function end_round() {
return
}
if (game.round_player === DEM) {
- console.log('checking stasi', game.persistent_events.includes(13))
+ // console.log('checking stasi', game.persistent_events.includes(13))
if(game.persistent_events.includes(13)) {
- console.log('stasi sub function')
+ // console.log('stasi sub function')
if (game.active !== DEM) {
next_player()
}
+ log_h3('C13')
game.state = 'stasi_end_round'
return
} else if(game.round_player === DEM && game.persistent_events.includes(5)){
@@ -3935,6 +3939,7 @@ function discard(card) {
//console.log('in discard(card)')
let find_card
if (!game.is_pwr_struggle) {
+
if (game.active === COM) {
find_card = game.communist_hand.indexOf(card)
game.communist_hand.splice(find_card, 1)
@@ -3942,9 +3947,10 @@ function discard(card) {
find_card = game.democrat_hand.indexOf(card)
game.democrat_hand.splice(find_card, 1)
}
- game.strategy_discard.push(card)
- log(`Discarded C${cards[card].number}`)
-
+ if (!game.strategy_discard.includes(card)) {
+ game.strategy_discard.push(card)
+ log(`Discarded C${cards[card].number}`)
+ }
} else if (game.is_pwr_struggle) {
if (game.active === COM) {
find_card = game.com_pwr_hand.indexOf(card);
@@ -3953,6 +3959,7 @@ function discard(card) {
find_card = game.dem_pwr_hand.indexOf(card);
game.dem_pwr_hand.splice(find_card, 1);
}
+
game.power_struggle_discard.push(card)
//log(`Discarded P${power_cards[card].number}`)
}
@@ -3968,8 +3975,9 @@ function silent_discard(card) {
find_card = game.democrat_hand.indexOf(card)
game.democrat_hand.splice(find_card, 1)
}
- game.strategy_discard.push(card)
-
+ if (!game.strategy_discard.includes(card)) {
+ game.strategy_discard.push(card)
+ }
} else if (game.is_pwr_struggle) {
if (game.active === COM) {
find_card = game.com_pwr_hand.indexOf(card);
@@ -4065,7 +4073,6 @@ function check_control_change(space_id) {
// Check if the Tyrant is Gone has been fulfilled
if (game.the_tyrant_is_gone > 0 && check_dem_control(game.the_tyrant_is_gone)) {
- console.log('in tyrant')
log('+2 VP from C97')
game.vp += 2
if (check_vp()) {
@@ -4225,7 +4232,6 @@ function log_summary(msg) {
}
function pop_summary() {
- console.log('summary', game.summary)
if (game.summary.length > 0) {
for (let [n, msg] of game.summary) {
if (n > 1) {
@@ -4340,13 +4346,13 @@ function vm_exec() {
}
function vm_inst(a) {
- console.log('game.vm.fp', game.vm.fp, 'game.vm.ip', game.vm.ip)
+ //console.log('game.vm.fp', game.vm.fp, 'game.vm.ip', game.vm.ip)
return CODE[game.vm.fp][game.vm.ip][a]
}
function vm_next() {
game.vm.ip++;
- console.log('vm_next called, game.vm.ip', game.vm.ip)
+ //console.log('vm_next called, game.vm.ip', game.vm.ip)
vm_exec();
}
@@ -4369,8 +4375,8 @@ function vm_log() {
}
function vm_if() {
- console.log('game.temp', game.temp)
- console.log('vm_operand(1)', vm_operand(1))
+ //console.log('game.temp', game.temp)
+// console.log('vm_operand(1)', vm_operand(1))
if (!vm_operand(1)) {
let balance = 1
while (balance > 0) {
@@ -4403,11 +4409,11 @@ function vm_endif() {
}
function vm_goto_step(step) {
- console.log('vm_goto_step called, target:', step)
- console.log('game.vm.ip', game.vp.ip)
+ // console.log('vm_goto_step called, target:', step)
+ //console.log('game.vm.ip', game.vp.ip)
for (let i = game.vm.ip; i < CODE[game.vm.fp].length; i++) {
- console.log('i', i)
- console.log('step', CODE[game.vm.fp][i][0])
+ //console.log('i', i)
+ //console.log('step', CODE[game.vm.fp][i][0])
if (CODE[game.vm.fp][i][0] === step) {
game.vm.ip = i;
vm_exec();
@@ -4420,8 +4426,8 @@ function vm_goto_step(step) {
function vm_goto(op, nop, dir, step) {
- console.log('vm_inst(0)', vm_inst(0), op, nop)
- console.log('vm_inst(0)', vm_inst(1), op, nop)
+ //console.log('vm_inst(0)', vm_inst(0), op, nop)
+// console.log('vm_inst(0)', vm_inst(1), op, nop)
let balance = 1
while (balance > 0) {
game.vm.ip += dir
@@ -4467,7 +4473,7 @@ function pop_vm_prompt() {
function vm_return() {
- console.log('in vm_return, game.vm_infl_to_do', game.vm_infl_to_do, 'return state', game.return_state)
+ //console.log('in vm_return, game.vm_infl_to_do', game.vm_infl_to_do, 'return state', game.return_state)
//Remove temporary vm variables
delete game.support_check_modifier
@@ -4507,7 +4513,7 @@ function vm_return() {
function vm_end_event() {
//game.view_opp_hand = false
- console.log('in vm_return, game.return:', game.return, 'game.return_state:', game.return_state, 'game.vm_infl_to_do', game.vm_infl_to_do, 'game.vm_event_to_do', game.vm_event_to_do)
+// console.log('in vm_return, game.return:', game.return, 'game.return_state:', game.return_state, 'game.vm_infl_to_do', game.vm_infl_to_do, 'game.vm_event_to_do', game.vm_event_to_do)
/*if (!game.vm_infl_to_do && !game.vm_event_to_do) {
if (game.round_player !== game.active) {
change_player()
@@ -4523,7 +4529,7 @@ function vm_end_event() {
}
if (game.return_state && game.return_state !== '') {
game.state = game.return_state
- console.log( 'game.state', game.state)
+ //console.log( 'game.state', game.state)
}
else if (game.vm_infl_to_do) {
game.state = 'resolve_opponent_event'} /*Can use game.return state for this? */
@@ -4573,7 +4579,7 @@ function vm_valid_spaces_opponent () {
}
}
game.valid_spaces = valid_spaces
- console.log('game.valid_spaces', game.valid_spaces)
+// console.log('game.valid_spaces', game.valid_spaces)
vm_next()
}
@@ -4668,7 +4674,7 @@ function vm_valid_spaces_country_opp () {
function vm_valid_spaces_country_sc () {
let valid_spaces = []
let country = ''
- console.log('in vm_valid_spaces_country_sc')
+ //console.log('in vm_valid_spaces_country_sc')
if (vm_operand(1)) {
country = vm_operand(1) }
else {
@@ -4767,7 +4773,6 @@ function vm_active_country () {
function vm_take_control_prep() {
game.vm_available_ops = vm_operand(1)
game.state = 'vm_take_control'
- console.log('in vm_take_control_prep game.state', game.state)
}
function vm_take_control(space) {
@@ -4799,7 +4804,7 @@ function vm_take_control(space) {
function vm_do_add_infl(space) {
push_undo()
- console.log('in vm_do_add_infl, space', space, 'ops', game.vm_available_ops, 'ahbr tracker', game.austria_hungary_border_reopened_tracker, 'ahbr in events', game.persistent_events.includes(58))
+ //console.log('in vm_do_add_infl, space', space, 'ops', game.vm_available_ops, 'ahbr tracker', game.austria_hungary_border_reopened_tracker, 'ahbr in events', game.persistent_events.includes(58))
//log(`Added 1 influence in %${space}.`)
@@ -4836,10 +4841,9 @@ function vm_do_add_infl(space) {
// Check whether spaces are controlled
check_control_change(space)
- console.log('before check, ahbr in events', game.persistent_events.includes(58), 'tracker', game.austria_hungary_border_reopened_tracker)
// Check Austria Hungary Border Reopened is true and condition has been met
if (game.vm_available_ops === 0 && game.active === DEM && game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker) {
- console.log('in award extra op')
+ //console.log('in award extra op')
game.vm_available_ops ++
log('+1 Op from C58')
game.austria_hungary_border_reopened_tracker = false
@@ -4855,10 +4859,8 @@ function vm_do_add_infl(space) {
if (game.active === DEM) {
//Check Genscher and AHBR
if (game.persistent_events.includes(63) || (game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker)) {
- console.log('in gensher subcheck - remove non-East German controlled ')
game.valid_spaces = game.valid_spaces.filter(n => !(check_com_control(n) && spaces[n].country !== 'East_Germany'))
} else {
- console.log('remove all controlled spaces')
game.valid_spaces = game.valid_spaces.filter(n => !check_com_control(n))
}
} else {
@@ -5244,7 +5246,6 @@ function vm_brought_in_for_questioning() {
game.active = DEM
}
//game.return = game.active
- console.log('in bifg, game.return', game.return)
game.phase = 0
game.state = 'vm_brought_in_for_questioning'
}
@@ -5462,7 +5463,6 @@ function vm_goodbye_lenin() {
game.communist_hand_red = []
// Select Red cards to show
for (let card of game.communist_hand) {
- console.log('checking card ', card, 'red', cards[card].red)
if (cards[card].red) {
game.communist_hand_red.push(card)
}
@@ -5488,7 +5488,6 @@ function vm_government_resigns() {
}
function vm_grenztruppen() {
- console.log('in grenztruppen - player active:', game.active)
game.persistent_events.push(59)
permanently_remove(59)
//game.table_cards.push(59)
@@ -5597,7 +5596,6 @@ function vm_kremlin_coup() {
game.temp.push(country)
}
})
- console.log('game.temp', game.temp)
game.state = 'vm_kremlin_coup_choose_country'
}
@@ -5608,7 +5606,6 @@ function vm_laszlo_tokes() {
}
function vm_legacy_of_martial_law() {
- console.log('in martial law, game.vm_infl_to_do', game.vm_infl_to_do)
game.vm_available_ops = 1
game.state = 'vm_switch_infl'
}
@@ -5708,7 +5705,7 @@ function vm_poszgay() {
}
function vm_power_struggle() {
- console.log('in vm_power_struggle. game.vm_event', game.vm_event, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
+ //console.log('in vm_power_struggle. game.vm_event', game.vm_event, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
game.is_pwr_struggle = true
/* TO DELETE?
@@ -5716,7 +5713,6 @@ function vm_power_struggle() {
*/
if (game.vm_event > 0) {
- console.log('vm_power_struggle, in game.vm_event check')
game.pwr_struggle_in = countries[scoring_cards.indexOf(game.vm_event)]
log_h2(`C${game.vm_event}`)
}
@@ -5731,13 +5727,11 @@ function vm_power_struggle() {
//Check for Securitate
if (game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(70)) {
- console.log('in Securitate subcheck')
log('C70: Democrat reveals Power Struggle cards')
game.view_opp_hand = true
}
log_h2('Deal Cards')
game.state = 'draw_power_cards'
- console.log('game.state',game.state)
}
function vm_presidential_visit() {
@@ -5771,6 +5765,7 @@ function vm_reformer_rehabilitated () {
permanently_remove(67)
game.discard = true
for (let card of game.strategy_discard) {
+ if (!event_is_playable(card)) continue
if (card === game.played_card) continue
if (game.table_cards.includes(card)) continue
if (scoring_cards.includes(card)) continue
@@ -5832,7 +5827,6 @@ function vm_solidarity_legalised() {
log_msg_gap(`C2 in effect`)
game.playable_cards.push(3)
game.persistent_events.push(2)
- console.log('game.persistent_events', game.persistent_events)
vm_next()
}
@@ -5890,7 +5884,6 @@ function vm_the_baltic_way() {
if (check_vp()) {
return
}
- console.log('game.state', game.state)
vm_next()
}
@@ -5931,8 +5924,6 @@ function vm_the_tyrant_is_gone() {
game.valid_spaces.push(space.space_id)
}
}
-
- console.log('game.vm_event', game.vm_event, 'game.played_card', game.played_card)
game.state = 'vm_the_tyrant_is_gone'
}
@@ -6027,7 +6018,6 @@ function discarded_card() {
// =================== TIANANMEN SQUARE TRACK FUNCTIONS ====================
function vm_tst_3() {
- console.log('function vm_tst_3, game.return_state', game.return_state)
log_gap('Tiananmen Square Track award')
game.state = 'vm_tst_3_prep'
}
@@ -6082,7 +6072,6 @@ states.vm_end_event = {
return `resolve ${clean_name(cards[this_card()].name)}.`
},
prompt () {
- console.log('in vm_end_event, game.vm_infl_to_do', game.vm_infl_to_do, 'game.return_state', game.return_state)
view.prompt = `${clean_name(cards[this_card()].name)}: done.`
if (game.vm_infl_to_do || game.return_state === 'vm_tst_8') {
gen_action('done')
@@ -6095,7 +6084,6 @@ states.vm_end_event = {
vm_end_event()
},
end_round() {
- console.log('end round clicked - vm_end_event called')
push_undo()
game.return_state = ''
vm_end_event()
@@ -6107,7 +6095,6 @@ states.vm_take_control = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt () {
- console.log('game.vm_available_ops', game.vm_available_ops)
if (game.vm_available_ops > 0 && game.valid_spaces.length === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: all spaces controlled. Continue.`
gen_action('done')
@@ -6130,6 +6117,7 @@ states.vm_take_control = {
vm_take_control(space)
game.vm_available_ops--
if (game.vm_available_ops === 0) {
+ game.valid_spaces = []
vm_next()
}
},
@@ -6146,7 +6134,6 @@ states.vm_take_control = {
states.vm_add_infl = {
inactive: 'add Support Points.',
prompt () {
- console.log('in vm add infl')
if (game.vm_available_ops > 0 && game.valid_spaces.length === 0 ) {
view.prompt = `${clean_name(cards[this_card()].name)}. No available spaces remaining. Add SPs: done.`
gen_action('done')
@@ -6255,7 +6242,11 @@ states.vm_add_x_infl = {
},
// inactive: `resolve ${cards[this_card()].name}: add influence.`,
prompt () {
- if (game.vm_available_ops > 0 ) {
+ if (game.vm_event === 101 && game.valid_spaces.length === 0) {
+ view.prompt = `${clean_name(cards[this_card()].name)}: the Romanian Elite space no longer exists.`
+ gen_action('done')
+ }
+ else if (game.vm_available_ops > 0 ) {
view.prompt = `${clean_name(cards[this_card()].name)}: Add ${game.vm_available_ops} SPs to ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
@@ -6281,12 +6272,12 @@ states.vm_add_x_infl = {
//game.vm_event_done = true
//vm_next()
- }
- /*done () {
+ },
+ done () {
push_undo()
game.vm_event_done = true
vm_next()
- }*/
+ }
}
states.vm_add_limited_infl = {
@@ -6336,7 +6327,6 @@ states.vm_remove_infl = {
inactive: 'remove Support Points.',
prompt () {
// Keep this so that there is an undo option in, e.g., Scare Tactics
- console.log('in vm_remove infl, vm_infl_to_do', game.vm_infl_to_do)
if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no further SPs to remove.`
gen_action('done')
@@ -6504,7 +6494,6 @@ states.vm_remove_all_infl = {
states.vm_support_check_prep = {
inactive: 'do support checks.',
prompt () {
- console.log('in states.vm_support_check_prep, game.vm_available_ops: ', game.vm_available_ops)
/*if (game.vm_available_ops === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}. Support check: done.`
gen_action('done')
@@ -6578,7 +6567,7 @@ states.vm_ceh_support_check_prep = {
//console.log('game.austria_hungary_border_reopened_checked', game.austria_hungary_border_reopened_checked)
if (game.persistent_events.includes(58)) {
if (game.active === DEM && game.vm_available_ops > 1) {
- console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', game.persistent_events.includes(58))
+
if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events.includes(58) && game.active === DEM) {
game.state = 'vm_austria_hungary_border_reopened_check'
return
@@ -6671,7 +6660,6 @@ states.vm_do_support_check = {
clear_undo()
do_sc(game.selected_space)
game.vm_available_ops--
- console.log('game.vm_available_ops', game.vm_available_ops)
if (game.vm_available_ops === 0) {
game.valid_spaces = []
vm_next()
@@ -6750,6 +6738,7 @@ states.vm_brought_in_for_questioning = {
}
},
discard() {
+ clear_undo()
game.vm_event = discard_card(game.democrat_hand)
game.phase = 1
if (cards[game.vm_event].side === 'C' && (cards[game.vm_event].playable || game.playable_cards.includes(game.vm_event))) {
@@ -6761,7 +6750,6 @@ states.vm_brought_in_for_questioning = {
game.return = DEM
}
}
- console.log('BIFQ discard: game.return', game.return)
if (!auto_resolve_events.includes(game.vm_event) && !switch_events.includes(game.vm_event)) {
next_player()
}
@@ -6851,7 +6839,7 @@ states.vm_common_european_home_choose = {
},
card(card) {
push_undo()
- log(`Played with C${cards[card].number}`)
+ //log(`Played with C${cards[card].number}`)
game.valid_cards = []
silent_discard(card)
game.vm_event = card
@@ -6876,6 +6864,7 @@ states.vm_common_european_home_play = {
},
influence(){
push_undo()
+ log_gap(`Played C${cards[game.vm_event].number} to place SPs`)
game.vm_available_ops = cards[game.vm_event].ops
valid_spaces_infl()
// If ABHR - Set AHBR tracker to true
@@ -6886,12 +6875,14 @@ states.vm_common_european_home_play = {
},
support_check() {
push_undo()
+ log_gap(`Played C${cards[game.vm_event].number} for support checks`)
game.vm_available_ops = 2
game.state = 'vm_ceh_support_check_prep'
valid_spaces_sc()
},
tst() {
push_undo()
+ log_gap(`Played C${cards[game.vm_event].number} to the Tiananmen Square Track`)
game.state = 'vm_tiananmen_square_attempt'
}
}
@@ -6961,7 +6952,6 @@ states.vm_play_event_from_discard = {
game.vm_available_ops = cards[card].ops
game.discard = false
//game.return = game.active Does turning this off cause problems?
- console.log('card:', card)
if (switch_events.includes(card)) {next_player()}
goto_vm(card)
},
@@ -7041,11 +7031,9 @@ states.vm_deutsche_marks = {
event() {
push_undo()
log(`Played C${cards[game.vm_event].number} for the event`)
- console.log('game.active', game.active)
if (!game.vm_infl_to_do) {
game.return = game.active
}
- console.log('DM Event played, game.return', game.return)
goto_vm(game.vm_event)
},
influence() {
@@ -7178,9 +7166,8 @@ states.vm_goodbye_lenin = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- console.log('in vm_goodbye lenin')
if (game.valid_cards.length > 0 ) {
- view.prompt = 'Choose a card to play for the event, or play Goodbye Lenin for operations'
+ view.prompt = `Play a red event from your opponent's hand, or play Goodbye Lenin for operations.`
for (let card of game.valid_cards) {
gen_action_card(card)
gen_action('ops')
@@ -7229,7 +7216,6 @@ states.vm_goodbye_lenin_ops = {
log(`+1 from C50`)
game.vm_available_ops++
}*/
- console.log('goodbye lenin: influence selected')
valid_spaces_infl()
// If ABHR - Set AHBR tracker to true
@@ -7277,7 +7263,6 @@ states.vm_honecker = {
let card_index = game.strategy_discard.indexOf(card)
game.strategy_discard.splice(card_index, 1)
game.communist_hand.push(card)
- console.log('removed after honecker', game.strategy_removed)
vm_next()
},
pass(){
@@ -7300,7 +7285,6 @@ states.vm_inflationary_currency = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- console.log('game.revolutions', game.revolutions, 'length', game.revolutions.length)
if ((game.active === COM && game.revolutions.every(n => n === false)) || (game.active === DEM && game.revolutions.every(n => n === true))) {
view.prompt = 'Inflationary Currency: no countries to choose.'
gen_action('pass')
@@ -7432,6 +7416,7 @@ states.vm_kiss_of_death = {
}
},
discard() {
+ clear_undo()
game.vm_event = discard_card(game.communist_hand)
if (cards[game.vm_event].side !== "C") {
next_player()
@@ -7452,7 +7437,6 @@ states.vm_kiss_of_death_finish = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- console.log('game.vm_event', game.vm_event)
if (game.vm_event > 0 && game.vm_event !== 21 && (cards[game.vm_event].side === 'D' || cards[game.vm_event].side === 'N')) {
view.prompt = `Play ${clean_name(cards[game.vm_event].name)} for the event.`
console.log('kiss of death before event button: game.stategy_discard', game.strategy_discard)
@@ -7464,10 +7448,8 @@ states.vm_kiss_of_death_finish = {
},
event() {
//game.return = game.active
- console.log('kiss of death event section, discard', game.strategy_discard)
// Remove game.vm_event from the discard
//game.strategy_discard = game.strategy_discard.filter(n => n !== game.vm_event)
- console.log('kiss of death event section 2, discard', game.strategy_discard)
goto_vm(game.vm_event)
},
@@ -7484,9 +7466,7 @@ states.vm_kremlin_coup_choose_country = {
if (game.temp.length > 0) {
view.prompt = 'Kremlin Coup! Select a country where the Communist retains power.'
for (let country of countries) {
- console.log(`checking`, country)
if (game.temp.includes(country)) {
- console.log('country in game.temp')
gen_action(`${country.toLowerCase()}`)
}
}
@@ -7869,6 +7849,7 @@ states.vm_nomenklatura = {
game.valid_spaces.push(space.space_id)
}
}
+ check_systematization()
game.vm_available_ops = 3
game.state = 'vm_nomenklatura_add'
}
@@ -7879,7 +7860,6 @@ states.vm_nomenklatura_remove = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- console.log('in nomenklatura, game.valid_spaces.length', game.valid_spaces.length)
if (game.valid_spaces.length === 0 ) {
view.prompt = 'Nomenklatura. No SPs to remove: pass.'
gen_action('pass')
@@ -8413,7 +8393,6 @@ states.vm_warsaw_pact_summit = {
}
game.vm_available_ops = 2
//game.state = 'vm_support_check_prep'
- console.log('game.phase',game.phase)
vm_next()
}
}
@@ -8564,7 +8543,6 @@ states.vm_workers_revolt_finish = {
states.vm_tst_3_prep = {
inactive: 'resolve Tiananmen Square Track award.',
prompt() {
- console.log('tst award prep, game.return_state', game.return_state)
view.prompt = 'Tiananmen Square Track award: draw 3 cards.'
gen_action('draw')
},
@@ -8586,7 +8564,6 @@ states.vm_tst_3_prep = {
states.vm_tst_3 = {
inactive: 'resolve Tiananmen Square Track bonus.',
prompt() {
- console.log('tst award, game.return_state', game.return_state)
if (game.temp < 2) {
view.prompt = `Discard 2 of the drawn cards.`
for (let card of game.valid_cards) {
@@ -8809,15 +8786,15 @@ states.vm_support_surges_1 = {
},
draw() {
if (game.active === DEM) {
- console.log('hand before', game.dem_pwr_hand)
+ //console.log('hand before', game.dem_pwr_hand)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length+1, game.com_pwr_hand.length)
game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length-1]
- console.log('hand after', game.dem_pwr_hand, 'game.temp', game.temp)
+ //console.log('hand after', game.dem_pwr_hand, 'game.temp', game.temp)
} else {
- console.log('hand before', game.com_pwr_hand)
+ //console.log('hand before', game.com_pwr_hand)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length, game.com_pwr_hand.length+1)
game.temp = game.com_pwr_hand[game.com_pwr_hand.length-1]
- console.log('hand after', game.com_pwr_hand, 'game.temp', game.temp)
+ //console.log('hand after', game.com_pwr_hand, 'game.temp', game.temp)
}
game.state = 'vm_support_surges_2'
@@ -8831,8 +8808,16 @@ states.vm_support_surges_1 = {
states.vm_support_surges_2 = {
inactive: 'draw cards.',
prompt() {
- if (numberless_cards.includes(game.temp)) {
+ let special = [49,50,51,52]
+ let elite_leader = [37,38,39,40]
+ if (special.includes(game.temp)) {
view.prompt = `Support Surges: you drew ${power_cards[game.temp].name}. Draw a second card.`
+ }
+ else if (elite_leader.includes(game.temp)) {
+ view.prompt = `Support Surges: you drew an ${power_cards[game.temp].name}. Draw a second card.`
+ }
+ else if (numberless_cards.includes(game.temp)) {
+ view.prompt = `Support Surges: you drew a ${power_cards[game.temp].name}. Draw a second card.`
} else {
view.prompt = `Support Surges: you drew a ${power_cards[game.temp].name} ${power_cards[game.temp].value}. Draw a second card.`
}
@@ -8840,10 +8825,8 @@ states.vm_support_surges_2 = {
},
draw() {
if (game.active === DEM) {
- console.log('hand before', game.dem_pwr_hand)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length+1, game.com_pwr_hand.length)
game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length - 1]
- console.log('hand before', game.dem_pwr_hand, 'game.temp', game.temp)
} else {
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length, game.com_pwr_hand.length+1)
game.temp = game.com_pwr_hand[game.com_pwr_hand.length - 1]
@@ -8890,7 +8873,6 @@ states.vm_support_falters = {
}
},
discard() {
- console.log('game.com_pwr_hand', game.com_pwr_hand)
if (game.active === DEM) {discard_card(game.dem_pwr_hand)}
else {discard_card(game.com_pwr_hand)}
game.vm_available_ops --