summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-11-02 20:30:17 +0000
committeriainp5 <iain.pearce.ip@gmail.com>2024-11-02 20:30:17 +0000
commit6a562473c05cea24e7876d01eb80d9e188a5cc5a (patch)
tree03054ac94c61241b106762016317c9f8081bda7d
parentebadbb3e0414803b979cc03d84d92a1971fadb0c (diff)
parent1d073110c0937e2a057efd0eeeef5223036c1187 (diff)
download1989-dawn-of-freedom-6a562473c05cea24e7876d01eb80d9e188a5cc5a.tar.gz
Merge branch 'work-in-progress' of https://github.com/iainp5/1989-Dawn-of-Freedom into work-in-progress
-rw-r--r--events.txt1
-rw-r--r--play.css13
-rw-r--r--play.js3
-rw-r--r--rules.js122
4 files changed, 114 insertions, 25 deletions
diff --git a/events.txt b/events.txt
index 84bfe37..b9b187a 100644
--- a/events.txt
+++ b/events.txt
@@ -661,7 +661,6 @@ domino_theory
CARD 90 - Civic Forum*
# +1 VP. Place 4 SPs in Czechoslovakia. The Democratic Player may make Support Checks in Czechoslovakia using the Ops value of this card if the Czech Writers space is Democratically controlled.
-permanently_remove
valid_spaces_country 'Czechoslovakia'
prompt 'Czechoslovakia'
add_infl_free 4
diff --git a/play.css b/play.css
index f4c028f..dc801f8 100644
--- a/play.css
+++ b/play.css
@@ -40,7 +40,6 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); }
#log .h1 { background-color: tan }
#log .h2 { background-color: wheat }
#log .h3 { background-color: wheat }
-#log .h3 { background-color: wheat }
#log .h2.dem { background-color: hsl(206, 85%, 80%); }
#log .h2.com { background-color: hsl(355, 70%, 80%); }
@@ -91,6 +90,11 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); }
.space.Romania.action { border-color: peachpuff; }
.space.Bulgaria.action { border-color: palegreen; }
+.space.selected {
+ border-color: aqua;
+ box-shadow: 0 0 0 1px black, inset 0 0 0 1px black;
+}
+
.space.tip {
border-color: lime;
box-shadow: 0 0 0 1px black, inset 0 0 0 1px black;
@@ -267,12 +271,7 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); }
}
.power_card {
- width: 188px;
- height: 263px;
- border-radius: 12px;
-}
-
-.power_card {
+ background-color: #093a5b;
width: 188px;
height: 263px;
border-radius: 12px;
diff --git a/play.js b/play.js
index ea3f70a..8672373 100644
--- a/play.js
+++ b/play.js
@@ -716,6 +716,9 @@ function on_update() {
for (let e of action_register)
e.classList.toggle("action", is_action(e.my_action, e.my_id))
+ for (let s = 0; s <= last_space; ++s)
+ ui.spaces[s].classList.toggle("selected", view.selected_space === s)
+
action_button("yes", "Yes")
action_button("no", "No")
action_button("start", "Start")
diff --git a/rules.js b/rules.js
index 2ee3e8a..6b3b7d8 100644
--- a/rules.js
+++ b/rules.js
@@ -386,19 +386,8 @@ exports.view = function(state, player) {
view.drawn = game.vm.draw
if (player === game.active) {
- if (game.selected_space) {
- view.valid_spaces = [game.selected_space]
- } else {
- view.valid_spaces = game.valid_spaces
- }
- } else {
- view.valid_spaces = []
- }
-
- if (player === game.active) {
- view.valid_cards = game.valid_cards
- } else {
- view.valid_cards = []
+ if (game.selected_space >= 0)
+ view.selected_space = game.selected_space
}
if (player === DEM) {
@@ -421,7 +410,7 @@ exports.view = function(state, player) {
if (game.state === "game_over") {
view.prompt = game.victory
- } else if (player === "Observer" || (game.active !== player && game.active !== "Both")) {
+ } else if (game.active !== player) {
if (states[game.state]) {
let inactive = states[game.state].inactive
if (typeof inactive === "function")
@@ -2317,6 +2306,10 @@ function valid_spaces_sc() {
if (infl !== 0 ) {
// Check Events that block support checks in a given space
if (game.persistent_events.includes(C_SOLIDARITY_LEGALIZED) && space.space_id === S_GDANSK) {continue}
+<<<<<<< HEAD
+=======
+ if (game.persistent_events.includes(C_CIVIC_FORUM) && space.space_id === S_CHARLES_UNIVERSITY) {continue}
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
if (game.persistent_events.includes(C_WE_ARE_THE_PEOPLE) && space.space_id === S_LEIPZIG) {continue}
if (game.persistent_events.includes(C_FOREIGN_CURRENCY_DEBT_BURDEN) && space.country === game.foreign_currency_debt_burden) {continue}
@@ -2849,7 +2842,11 @@ function get_aftermath_roll() {
function add_to_persistent_events(card) {
game.persistent_events.push(card)
remove_from_discard(card)
+<<<<<<< HEAD
log(`C${card} in effect:`)
+=======
+ log(`C${card} in effect`)
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
}
function permanently_remove(card) {
@@ -3022,6 +3019,11 @@ function event_is_playable(card) {
else if (game.com_tst_position === 8 && card === C_THE_CHINESE_SOLUTION) {
return true
}
+
+ //Check for Gorbachev Charms the West after Breakaway Baltic Republics
+ else if (card === C_GORBACHEV_CHARMS_THE_WEST && !game.playable_cards.includes(C_GORBACHEV_CHARMS_THE_WEST)) {
+ return false
+ }
//Then check normally
else if (game.playable_cards.includes(card)) {
return true
@@ -3033,7 +3035,15 @@ function event_is_playable(card) {
}
function get_card_ops(card) {
+<<<<<<< HEAD
let ops = cards[card].ops
+=======
+ let ops = 0
+
+ if (card) {
+ ops = cards[card].ops
+ }
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
if (game.persistent_events.includes(C_PERESTROIKA) && game.active === COM) {
if(game.state === 'choose_card' || game.state === 'stasi_play_card') {
log(`+1 op from C${C_PERESTROIKA}`)
@@ -3155,7 +3165,11 @@ function finish_the_wall() {
// =========== MOVING THROUGH TURNS ============
function end_round() {
+<<<<<<< HEAD
//Check if the game is over! WHY IS THIS NEEDED?
+=======
+ //Check if the game is over!
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
if (game.state === 'game_over') {
return}
@@ -3445,6 +3459,13 @@ function roll_d6() {
return random(6) + 1
}
+<<<<<<< HEAD
+=======
+function find_space_index(name_unique) {
+ return spaces.findIndex(space => space && space.name_unique === name_unique)
+}
+
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
function find_country_index(country) {
return countries.indexOf(country)
}
@@ -4472,13 +4493,19 @@ function vm_army_backs_revolution() {
game.persistent_events = game.persistent_events.filter(n => n !== C_SECURITATE)
game.playable_cards = game.playable_cards.filter(n => n !== C_SECURITATE)
add_to_persistent_events(C_ARMY_BACKS_REVOLUTION)
+<<<<<<< HEAD
logi(`${C_SECURITATE} no longer has any effect`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
function vm_austria_hungary_border_reopened() {
add_to_persistent_events(C_AUSTRIA_HUNGARY_BORDER_REOPENED)
+<<<<<<< HEAD
logi(`For the remainder of the turn, cards played by the Democrat have +1 Ops value if all Operations Points are used in East Germany`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
game.austria_hungary_border_reopened_tracker = false
vm_next()
}
@@ -4549,6 +4576,10 @@ function vm_civic_forum() {
if (check_vp()) {
return
}
+<<<<<<< HEAD
+=======
+ add_to_persistent_events(C_CIVIC_FORUM)
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
if (check_dem_control(S_CZECH_WRITERS)) {
vm_next()
} else {
@@ -4611,13 +4642,19 @@ function vm_domino_theory() {
function vm_eco_glasnost() {
add_to_persistent_events(C_ECO_GLASNOST)
+<<<<<<< HEAD
logi(`+1 VP for Communist support checks in Ruse for the rest of the game`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
function vm_elena(){
add_to_persistent_events(C_ELENA)
+<<<<<<< HEAD
logi(`-1 modifier to Democratic Support checks in Romania for the rest of this turn`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -4678,19 +4715,28 @@ function vm_foreign_television() {
}
function vm_frg_embassies() {
add_to_persistent_events(C_FRG_EMBASSIES)
+<<<<<<< HEAD
logi(`+1 modifier for Democratic Support Checks in Eastern Europe for the rest of this turn`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
function vm_general_strike() {
add_to_persistent_events(C_GENERAL_STRIKE)
+<<<<<<< HEAD
logi(`Each Action Round the Communist must instead discard a card and roll a die until the modified die roll exceeds 5`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
function vm_genscher() {
add_to_persistent_events(C_GENSCHER)
+<<<<<<< HEAD
logi(`Cancels +1 Ops cost to place Democratic SPs in Communist controlled spaces in East Germany for the rest of the turn`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -4725,7 +4771,10 @@ function vm_government_resigns() {
function vm_grenztruppen() {
add_to_persistent_events(C_GRENZTRUPPEN)
+<<<<<<< HEAD
logi(`-1 modifier for Democratic Support Checks in East Germany for the rest of this turn`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -4748,13 +4797,19 @@ function vm_heal_our_bleeding_wounds() {
function vm_helsinki_final_act() {
add_to_persistent_events(C_HELSINKI_FINAL_ACT)
+<<<<<<< HEAD
logi(`+1 VP for every Support Check by the Communist Player in Student or Intellectual spaces for the rest of the game`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
function vm_honecker() {
add_to_persistent_events(C_HONECKER)
+<<<<<<< HEAD
logi(`The Communist may take one extra Action Round this turn`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
game.valid_cards = []
for (let c of game.strategy_discard) {
if (scoring_cards.includes(c)) {
@@ -4835,7 +4890,10 @@ function vm_kremlin_coup() {
function vm_laszlo_tokes() {
add_to_persistent_events(C_LASZLO_TOKES)
+<<<<<<< HEAD
logi(`Allows play of C${C_MASSACRE_IN_TIMISOARA}`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
game.playable_cards.push(C_MASSACRE_IN_TIMISOARA)
game.state = 'vm_laszlo_tokes'
}
@@ -5039,14 +5097,20 @@ function vm_solidarity_legalised() {
function vm_st_nicholas_church () {
add_to_persistent_events(C_ST_NICHOLAS_CHURCH)
+<<<<<<< HEAD
logi(`Allows play of C${C_THE_MONDAY_DEMONSTRATIONS}`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
game.playable_cards.push(C_THE_MONDAY_DEMONSTRATIONS)
vm_next()
}
function vm_stasi() {
add_to_persistent_events(C_STASI)
+<<<<<<< HEAD
logi(`For the rest of this turn the Democrat must reveal the card he will play this Action Round before the Communist player plays his card`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -5102,7 +5166,10 @@ function vm_tank_column() {
function vm_tear_gas () {
add_to_persistent_events(C_TEAR_GAS)
+<<<<<<< HEAD
logi(`+1 modifier to the next Communist Support Check in a Student space`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -5125,7 +5192,10 @@ function vm_the_chinese_solution() {
function vm_the_crowd_turns_against_ceausescu() {
add_to_persistent_events(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU)
+<<<<<<< HEAD
logi(`After the players draw cards for the next Power Struggle in Romania, the Democrat draws 15 Power Struggle cards and takes 1 Action Round using Ops equal to 3 times the number of Rally cards drawn. Allows play of C${C_THE_TYRANT_IS_GONE}`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
game.playable_cards.push(C_THE_TYRANT_IS_GONE)
vm_next()
}
@@ -5138,7 +5208,10 @@ function vm_the_monday_demonstrations() {
function vm_the_sinatra_doctrine() {
add_to_persistent_events(C_THE_SINATRA_DOCTRINE)
+<<<<<<< HEAD
logi(`+1 Ops value for cards played by the Democrat for the rest of this turn`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -5171,7 +5244,10 @@ function vm_tyrant_block() {
function vm_the_wall () {
add_to_persistent_events(C_THE_WALL)
+<<<<<<< HEAD
logi(`Cancels the modifier for any Democratic controlled spaces for the next Communist Support Check in East Germany`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -5191,7 +5267,10 @@ function vm_warsaw_pact_summit() {
function vm_we_are_the_people() {
if (game.demInfl[S_LUTHERAN_CHURCH] > 0) {game.valid_spaces = [S_LUTHERAN_CHURCH]}
add_to_persistent_events(C_WE_ARE_THE_PEOPLE)
+<<<<<<< HEAD
logi(`The Communist may no longer make Support Checks in Leipzig`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
if (!game.vm_influence_added) {
game.vm_influence_added = {};
}
@@ -5223,7 +5302,10 @@ function vm_workers_revolt() {
function vm_yakovlev_counsels_gorbachev() {
add_to_persistent_events(C_YAKOVLEV_COUNSELS_GORBACHEV)
+<<<<<<< HEAD
logi(`The Democrat receives a +1 modifier to the Support Loss and Victory Point die rolls if he wins the next Power Struggle`)
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
}
@@ -7104,7 +7186,11 @@ states.vm_systematization = {
vm_eliminate(space)
game.valid_spaces = []
game.systematization = space
+<<<<<<< HEAD
//game.persistent_events.push(C_SYSTEMATIZATION) /*IS THIS STILL NEEDED? For view?*/
+=======
+ game.persistent_events.push(C_SYSTEMATIZATION) /*IS THIS STILL NEEDED? For view?*/
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187
vm_next()
},
}
@@ -8413,7 +8499,6 @@ CODE[89] = [ // Domino Theory*
]
CODE[90] = [ // Civic Forum*
- [ vm_permanently_remove ],
[ vm_valid_spaces_country, 'Czechoslovakia' ],
[ vm_prompt, 'Czechoslovakia' ],
[ vm_add_infl_free, 4 ],
@@ -8477,8 +8562,8 @@ CODE[96] = [ // The Chinese Solution*
]
CODE[97] = [ // The Tyrant is Gone*
- [ vm_if, ()=>game.persistent_events.includes(54) ],
- [ vm_valid_spaces, 'Cluj-Napoca' ],
+ [ vm_if, ()=>game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED) ],
+ [ vm_valid_spaces_com, 'Cluj-Napoca' ],
[ vm_prompt, 'the Romanian Elite Space' ],
[ vm_remove_x_opp_infl, 4 ],
[ vm_the_tyrant_is_gone ],
@@ -8638,4 +8723,7 @@ CODE[351] = [ // Scare Tactics
[ vm_return ],
]
// #endregion
+<<<<<<< HEAD
+=======
+>>>>>>> 1d073110c0937e2a057efd0eeeef5223036c1187