summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-10-26 15:14:48 +0100
committeriainp5 <iain.pearce.ip@gmail.com>2024-10-26 15:14:48 +0100
commitc2df9cc16c98db5286509e2bf6deef028b111fac (patch)
tree521016e5e8fedbb6f2385bb4c9558072f540c1fa /rules.js
parent264161f150688577c757835dafbd78645106172c (diff)
download1989-dawn-of-freedom-c2df9cc16c98db5286509e2bf6deef028b111fac.tar.gz
New power cards
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js79
1 files changed, 48 insertions, 31 deletions
diff --git a/rules.js b/rules.js
index a691129..bebde72 100644
--- a/rules.js
+++ b/rules.js
@@ -18,9 +18,9 @@ const leaders = [1, 4, 5, 6, 7]
const support_loss_roll = [0, 0, 1, 1, 2, 2, 3, 4]
const vp_roll = [0, 0, 1, 1, 2, 2, 3, 4]
const countries = ['Poland', 'Hungary', 'East_Germany', 'Bulgaria', 'Czechoslovakia', 'Romania']
-const elite_spaces = [12, 15, 27, 43, 51, 69]
+const elite_spaces = [11, 14, 26, 42, 50, 68]
const all_power_cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 ]
-const numberless_cards = [25, 26, 27, 28, 29, 30, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52]
+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]
@@ -194,9 +194,9 @@ exports.view = function(state, player) {
if (game.is_pwr_struggle) {
view.power_struggle_discard = game.power_struggle_discard
view.played_power_card = game.played_power_card
- } else {
- view.strategy_discard = game.strategy_discard
- }
+ }
+ view.strategy_discard = game.strategy_discard
+
if (player === game.active && game.vm && game.vm.draw)
view.drawn = game.vm.draw
@@ -1276,7 +1276,7 @@ states.raise_stakes_1 = {
inactive: 'raise the stakes.',
prompt () {
- // console.log('raise stakes 1 - valid cards', game.valid_cards)
+ console.log('raise stakes 1 - com hand', game.com_pwr_hand, 'dem hand', game.dem_pwr_hand)
// 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.'
@@ -1421,13 +1421,21 @@ states.power_struggle = {
}
if (game.phase === 1) {
if (game.valid_cards.length > 0) {
- view.prompt = `${power_cards[game.played_power_card].name} played. You must match or concede.`
- gen_action('concede')
+ if (leader_cards.includes(game.played_power_card)) {
+ view.prompt = `${power_cards[game.played_power_card].name} played as a ${game.proxy_power_card}. You must match or concede.`
+ } else {
+ view.prompt = `${power_cards[game.played_power_card].name} played. You must match or concede.`
+ }
+ gen_action('concede')
for (let card of game.valid_cards) {
gen_action_power_card(card)
}
} else if (game.valid_cards.length === 0) {
- view.prompt = `${power_cards[game.played_power_card].name} played. You must concede.`
+ if (leader_cards.includes(game.played_power_card)) {
+ view.prompt = `${power_cards[game.played_power_card].name} played as a ${game.proxy_power_card}. You must concede.`
+ } else {
+ view.prompt = `${power_cards[game.played_power_card].name} played. You must concede.`
+ }
gen_action('concede')
}
}
@@ -1448,6 +1456,7 @@ states.power_struggle = {
discard(card)
game.valid_cards=[]
game.return_state = 'power_struggle'
+ if (game.phase === 0) {delete game.proxy_power_card}
if (card === 52) {
log_gap(`Played P52: P${power_cards[game.played_power_card].number} no longer playable`)
@@ -1463,9 +1472,9 @@ states.power_struggle = {
if (card >= 37 && card <= 48) { /*When a leader is played */
game.played_power_card = card
game.phase = 3
- } else if (card === 49){ /*Scare Tactics */
+ } else if (card === 51){ /*Scare Tactics */
game.return = ''
- goto_vm(349) /*Can I combine these 3 into a single stage where you goto_vm(300 + card) ? */
+ goto_vm(351) /*Can I combine these 3 into a single stage where you goto_vm(300 + card) ? */
} else if (card === 50) { /*Support Surges */
if (game.active === DEM) {
game.return = COM
@@ -1473,9 +1482,9 @@ states.power_struggle = {
game.return = DEM
}
goto_vm(350)
- } else if (game.phase === 0 && card === 51) { /*Support Falters */
+ } else if (game.phase === 0 && card === 49) { /*Support Falters */
next_player()
- goto_vm(351)
+ goto_vm(349)
} else {
game.played_power_card = card
game.phase = 1
@@ -1527,28 +1536,28 @@ states.power_struggle = {
},
strike () {
log(`Played: P${power_cards[game.played_power_card].number} as a Strike`)
- game.played_power_card = 9
+ game.proxy_power_card = 'Strike'
game.phase = 1
next_player()
do_valid_cards()
},
march () {
log(`Played: P${power_cards[game.played_power_card].number} as a March`)
- game.played_power_card = 21
+ game.proxy_power_card = 'March'
game.phase = 1
next_player()
do_valid_cards()
},
rally () {
log(`Played: P${power_cards[game.played_power_card].number} as a Rally in the Square`)
- game.played_power_card = 53
+ game.proxy_power_card = 'Rally in the Square'
game.phase = 1
next_player()
do_valid_cards()
},
petition () {
log(`Played: P${power_cards[game.played_power_card].number} as a Petition`)
- game.played_power_card = 54
+ game.proxy_power_card = 'Petition'
game.phase = 1
next_player()
do_valid_cards()
@@ -1629,8 +1638,8 @@ states.support_loss ={
let rally_win = 0
let petition_win = 0
log(`Roll: D${roll}`)
- if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.played_power_card === 53) { rally_win = 2}
- if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.played_power_card === 54) { petition_win = 2}
+ if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.proxy_power_card === 'Rally in the Square') { rally_win = 2}
+ if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.proxy_power_card === 'Petition') { petition_win = 2}
let modified_roll = roll + game.raised_stakes + rally_win - petition_win
// Roll modifiers
@@ -1647,7 +1656,7 @@ states.support_loss ={
log(`+${game.raised_stakes} from Raising the Stakes`)
}
if (rally_win !== 0) {
- log('+2 from winning on a P25')
+ log('+2 from winning on a P1')
}
if (petition_win !== 0) {
log('-2 from winning on a P31')
@@ -1715,8 +1724,8 @@ states.vp_roll = {
log(`Roll: D${roll}`)
let rally_win = 0
let petition_win = 0
- if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.played_power_card === 53) {rally_win = 2}
- if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.played_power_card === 54) {petition_win = 2}
+ if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.proxy_power_card === 'Rally in the Square') { rally_win = 2}
+ if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.proxy_power_card === 'Petition') { petition_win = 2}
let modified_roll = roll + game.raised_stakes + rally_win - petition_win
if (game.active === DEM && game.persistent_events.includes(62)) {
log('+1 from C62')
@@ -1729,7 +1738,7 @@ states.vp_roll = {
log(`+${game.raised_stakes} from Raising the Stakes`)
}
if (rally_win !== 0) {
- log('+2 from winning on a P25')
+ log('+2 from winning on a P1')
}
if (petition_win !== 0) {
log('-2 from winning on a P31')
@@ -2810,9 +2819,13 @@ function valid_cards(player_hand, presence) {
} else if (game.phase === 1) {
for (let c of player_hand) {
let card = power_cards.find(card => card && card.number === c);
+ console.log('card', card, )
if (card.name === power_cards[game.played_power_card].name) {
valid_cards_set.add(card.number);
- } else if (leaders.includes(card.socio) && presence[card.socio]) {
+ } else if (card.name === game.proxy_power_card) {
+ valid_cards_set.add(card.number)
+ }
+ else if (leaders.includes(card.socio) && presence[card.socio]) {
valid_cards_set.add(card.number);
} else if (card.number === 52) {valid_cards_set.add(card.number)}
}
@@ -9911,11 +9924,8 @@ CODE[208] = [ // Tiananmen Square space 8 event
[ vm_return ],
]
-CODE[349] = [ // Scare Tactics
- [ vm_scare_tactics ],
- [ vm_valid_spaces_country_opp ],
- [ vm_prompt, ()=>` from ${country_name(game.vm_active_country)}` ],
- [ vm_remove_opp_infl, 1 ],
+CODE[349] = [ // Support Falters
+ [ vm_support_falters ],
[ vm_return ],
]
@@ -9924,9 +9934,16 @@ CODE[350] = [ // Support Surges
[ vm_return ],
]
-CODE[351] = [ // Support Falters
- [ vm_support_falters ],
+CODE[351] = [ // Scare Tactics
+ [ vm_scare_tactics ],
+ [ vm_valid_spaces_country_opp ],
+ [ vm_prompt, ()=>` from ${country_name(game.vm_active_country)}` ],
+ [ vm_remove_opp_infl, 1 ],
[ vm_return ],
]
+
+
+
+
// #endregion