summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/rules.js b/rules.js
index ab50255..1265b8d 100644
--- a/rules.js
+++ b/rules.js
@@ -979,8 +979,10 @@ states.draw_power_cards = {
},
draw() {
push_undo()
- console.log('called draw cards, game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
+ 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')
if (presence.dem_spaces > 0) {
game.dem_pwr_hand_limit = 6 + 2*(presence.dem_spaces - 1)
} else {
@@ -992,8 +994,8 @@ states.draw_power_cards = {
game.com_pwr_hand_limit = 0
}
// Events which affect cards drawn
-
- if (game.persistent_events['roundtable_talks']) {
+ console.log('test')
+ if (game.persistent_events['roundtable_talks'] && game.com_pwr_hand_limit >= 2) {
log('Democrat receives 2 cards from Communist due to C17')
game.dem_pwr_hand_limit += 2
game.com_pwr_hand_limit -= 2
@@ -1001,7 +1003,7 @@ states.draw_power_cards = {
game.persistent_events['roundtable_talks'] = false
}
- if (game.persistent_events['national_salvation_front'] && (game.pwr_struggle_in === 'Romania' || game.pwr_struggle_in === 'Bulgaria')) {
+ if (game.persistent_events['national_salvation_front'] && game.dem_pwr_hand_limit >=2 && (game.pwr_struggle_in === 'Romania' || game.pwr_struggle_in === 'Bulgaria')) {
log('Communist receives 2 cards from Democrat due to C102')
game.dem_pwr_hand_limit -= 2
game.com_pwr_hand_limit += 2
@@ -1011,6 +1013,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)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand_limit, game.com_pwr_hand_limit)
game.valid_cards = all_power_cards
@@ -3225,12 +3228,12 @@ function draw_deck(deck) {
}
function draw_cards(deck, democrat_hand, communist_hand, dem_hand_limit, com_hand_limit) {
- //console.log('game.valid_cards at start of draw cards: ', game.valid_cards)
+ console.log('game.valid_cards at start of draw cards: ', game.valid_cards)
let turn = 'communist'; // Start with the communist player
- //console.log('game.strategy_deck', game.strategy_deck)
- //console.log('deck', deck, 'democrat_hand', democrat_hand, 'communist_hand', communist_hand, 'dem_hand_limit', dem_hand_limit, 'com_hand_limit', com_hand_limit)
+ console.log('game.strategy_deck', game.strategy_deck)
+ console.log('deck', deck, 'democrat_hand', democrat_hand, 'communist_hand', communist_hand, 'dem_hand_limit', dem_hand_limit, 'com_hand_limit', com_hand_limit)
while (democrat_hand.length < dem_hand_limit || communist_hand.length < com_hand_limit) {
- //console.log('deck.length: ', deck.length)
+ console.log('deck.length: ', deck.length)
//console.log('discard.length', game.strategy_discard )
if (deck.length === 0) {
log_h3('--- Reshuffle ---')
@@ -3241,16 +3244,16 @@ function draw_cards(deck, democrat_hand, communist_hand, dem_hand_limit, com_han
else if (turn === 'communist' && communist_hand.length < com_hand_limit) {
communist_hand.push(draw_card(deck));
- //console.log('game.valid_cards after communist draw: ', JSON.stringify(game.valid_cards));
+ console.log('game.valid_cards after communist draw: ', JSON.stringify(game.valid_cards));
turn = 'democrat';
} else if(turn === 'communist' && communist_hand.length === com_hand_limit) {
turn = 'democrat';
}
else if (turn === 'democrat' && democrat_hand.length < dem_hand_limit) {
democrat_hand.push(draw_card(deck));
- //console.log('democrat_hand: ', democrat_hand)
+ console.log('democrat_hand: ', democrat_hand)
- //console.log('game.valid_cards after democrat draw: ', JSON.stringify(game.valid_cards));
+ console.log('game.valid_cards after democrat draw: ', JSON.stringify(game.valid_cards));
turn = 'communist';
}
else if (turn === 'democrat' && democrat_hand.length === dem_hand_limit) {