From 49ddeaffa0db635136f00b31b94c57c1459b3d6e Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sat, 21 Sep 2024 16:42:52 +0100 Subject: New branch to work on updated display --- play.html | 9 ++++++++- play.js | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/play.html b/play.html index 0d24f6d..3ce179a 100644 --- a/play.html +++ b/play.html @@ -108,7 +108,14 @@
-
Events in Play
+
Event Markers
+
+
+
+ +
+
+
Cards on the Table
diff --git a/play.js b/play.js index f003f37..162fdac 100644 --- a/play.js +++ b/play.js @@ -239,7 +239,7 @@ let ui = { dem_hand_count: document.getElementById("role_stat_dem"), com_hand_count: document.getElementById("role_stat_com"), played_card: 0, - events_panel: document.getElementById("events_panel"), + table_panel: document.getElementById("table_panel"), hand_panel: document.getElementById("hand_panel"), turn: document.getElementById("turn-tracker"), round: document.getElementById("action-round-tracker"), @@ -402,18 +402,18 @@ if (view.played_card > 0) { document.getElementById("played_card_panel").classList.add("hide") } -// EVENTS PANEL +// TABLE CARDS PANEL document.getElementById("events").replaceChildren() if (view.table_cards.length > 0) { - document.getElementById("events_panel").classList.remove("hide") + document.getElementById("table_panel").classList.remove("hide") for (let c of view.table_cards) { let card = ui.cards[c] - document.getElementById("events").appendChild(card); + document.getElementById("table_cards").appendChild(card); card.classList.remove("hand_card") card.classList.add('event_card'); } } else { - document.getElementById("events_panel").classList.add("hide") + document.getElementById("table_panel").classList.add("hide") } // OPPONENT HAND -- cgit v1.2.3 From a16e24c705fd1f98caf4332b734ff9d616705f4f Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sat, 21 Sep 2024 19:13:16 +0100 Subject: Updates to new visuals --- images/Event_Marker_Hasselhoff.gif | Bin 5383 -> 0 bytes images/Event_Marker_NYE_Party.gif | Bin 0 -> 5383 bytes play.css | 11 ++++++++--- play.html | 35 +++++++++++++++++++++-------------- play.js | 6 +++--- rules.js | 25 ++++++++++++++----------- 6 files changed, 46 insertions(+), 31 deletions(-) delete mode 100644 images/Event_Marker_Hasselhoff.gif create mode 100644 images/Event_Marker_NYE_Party.gif diff --git a/images/Event_Marker_Hasselhoff.gif b/images/Event_Marker_Hasselhoff.gif deleted file mode 100644 index b2a91d2..0000000 Binary files a/images/Event_Marker_Hasselhoff.gif and /dev/null differ diff --git a/images/Event_Marker_NYE_Party.gif b/images/Event_Marker_NYE_Party.gif new file mode 100644 index 0000000..b2a91d2 Binary files /dev/null and b/images/Event_Marker_NYE_Party.gif differ diff --git a/play.css b/play.css index f70fc16..b92274d 100644 --- a/play.css +++ b/play.css @@ -4,12 +4,12 @@ header.your_turn { background-color: orange; } #role_Dem { background-color: hsl(210,30%,80%); } #role_Com { background-color: hsl(35,40%,80%); } #turn_info { background-color: white; } -.aside_events { +/*.aside_events { font-family: "Source Sans"; font-style: normal; font-size: 16px; line-height: 1.5; -} +}*/ #log { background-color: whitesmoke; } #log .h1 { font-weight: bold; padding-top:2px; padding-bottom:2px; text-align: center; } @@ -115,7 +115,7 @@ header.your_turn { background-color: orange; } padding: 3px 1em; } -#events_panel, #played_card_panel { +#events_panel, #played_card_panel, #table_panel { min-width: 200px; width: auto; display: inline-block; @@ -123,6 +123,10 @@ header.your_turn { background-color: orange; } border-radius: 5px; } +#events { + display: flex; +} + #discard_panel { min-width: 200px; width: auto; @@ -420,6 +424,7 @@ left: 660px} .event-marker.aside { border: solid black 1.5px; + margin: 3px; } #turn_info { diff --git a/play.html b/play.html index 3ce179a..b9a53b6 100644 --- a/play.html +++ b/play.html @@ -47,17 +47,7 @@
Communist
0 cards in hand
-
- -
-
Active Event Markers:
-
None
-
- - - - -
-
+
@@ -109,14 +99,31 @@
Event Markers
-
+
+ + + + + + + + + + + + + + + +
+
-
Cards on the Table
-
+
Cards on the Table
+
diff --git a/play.js b/play.js index 162fdac..1220b41 100644 --- a/play.js +++ b/play.js @@ -403,7 +403,7 @@ if (view.played_card > 0) { } // TABLE CARDS PANEL -document.getElementById("events").replaceChildren() +document.getElementById("table_cards").replaceChildren() if (view.table_cards.length > 0) { document.getElementById("table_panel").classList.remove("hide") for (let c of view.table_cards) { @@ -503,7 +503,7 @@ for (let id in view.persistent_events) { } // CHECK WHETHER ANY EVENT MARKERS ARE SHOWING IN THE ASIDE - +/* for (let id of aside_events) { if (view.persistent_events[id]) { aside_events_showing = true; @@ -512,7 +512,7 @@ for (let id of aside_events) { if (aside_events_showing) { document.getElementById('no_events').style.display = 'none' -} +}*/ let systematization = document.getElementById('systematization') if (view.persistent_events['systematization'] > 0) { 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) { -- cgit v1.2.3 From a1e9567b3b4c2b2326abefae47c99ba874ee2c26 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sat, 21 Sep 2024 19:59:10 +0100 Subject: Updates to styling --- play.css | 21 +-------------------- rules.js | 6 +++++- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/play.css b/play.css index b92274d..37cfbee 100644 --- a/play.css +++ b/play.css @@ -425,6 +425,7 @@ left: 660px} .event-marker.aside { border: solid black 1.5px; margin: 3px; + position: relative; } #turn_info { @@ -444,27 +445,11 @@ left: 660px} } -#eco_glasnost { - position: relative; - /*top: 1500px; - left: 1050px;*/ -} - -#helsinki_final_act { - position: relative; - display: flex; -} #solidarity_legalised { top: 216px; left: 612px; } -#st_nicholas_church { - position: relative; - /*top: 181px; - left: 320px;*/ -} - #systematization { height: 65px; width: 65px; @@ -480,10 +465,6 @@ left: 660px} left: 170px; } -#we_are_the_people { - position: relative; -} - /* =========== CARDS ================= */ /* diff --git a/rules.js b/rules.js index 1265b8d..ed69ff5 100644 --- a/rules.js +++ b/rules.js @@ -873,7 +873,11 @@ states.tst_goddess = { log_side() } game.phase = 0 - game.state = 'choose_card' + if (game.persistent_events['general_strike']) { + game.state = 'general_strike' + } else { + game.state = 'choose_card' + } } } -- cgit v1.2.3 From 2fdac12b7a6e9a454dda1ef6b1bd74e29ca6b32d Mon Sep 17 00:00:00 2001 From: iainp5 Date: Mon, 23 Sep 2024 09:27:34 +0100 Subject: Updates to event markers --- play.html | 2 +- play.js | 26 ++++++++++++++++++++------ rules.js | 8 +++++++- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/play.html b/play.html index b9a53b6..e938d88 100644 --- a/play.html +++ b/play.html @@ -111,7 +111,7 @@ - + diff --git a/play.js b/play.js index 1220b41..c3b1bf2 100644 --- a/play.js +++ b/play.js @@ -23,10 +23,21 @@ const countries= [ ] const aside_events = [ - "eco_glasnost", - "helsinki_final_act", + "honecker", "st_nicholas_church", - "we_are_the_people" + "helsinki_final_act", + "eco_glasnost", + "we_are_the_people", + "foreign_currency_debt_burden", + "li_peng", + "austria_hungary_border_reopened", + "grenztruppen", + "presidential_visit", + "securitate", + "laslzo_tokes", + "stand_fast", + "elena", + "new_years_eve_party" ] let aside_events_showing = false let show_discard = false @@ -503,7 +514,7 @@ for (let id in view.persistent_events) { } // CHECK WHETHER ANY EVENT MARKERS ARE SHOWING IN THE ASIDE -/* + for (let id of aside_events) { if (view.persistent_events[id]) { aside_events_showing = true; @@ -511,8 +522,10 @@ for (let id of aside_events) { } if (aside_events_showing) { - document.getElementById('no_events').style.display = 'none' -}*/ + document.getElementById('events_panel').classList.remove("hide") +} else { + document.getElementById('events_panel').classList.add("hide") +} let systematization = document.getElementById('systematization') if (view.persistent_events['systematization'] > 0) { @@ -569,6 +582,7 @@ if (view.persistent_events['the_tyrant_is_gone'] > 0) { action_button("done", "Done") action_button("undo", "Undo") + console.log('view.persistent_events', view.persistent_events) } diff --git a/rules.js b/rules.js index ed69ff5..07644c2 100644 --- a/rules.js +++ b/rules.js @@ -83,7 +83,7 @@ exports.setup = function (seed, scenario, options) { discard: false, view_opp_hand: false, strategy_removed: [], - persistent_events: {austria_hungary_border_reopened: false, civic_forum: false, eco_glasnost: false, elena: false, foreign_currency_debt_burden: '', frg_embassies: false, general_strike: false, genscher: false, grenztruppen: false, helsinki_final_act: false, honecker: false, li_peng: false, ligachev: false, national_salvation_front: false, perestroika: false, presidential_visit: false, prudence: '', roundtable_talks: false, securitate: false, sinatra_doctrine: false, solidarity_legalised: false, stand_fast: '', stasi: false, st_nicholas_church: false, systematization: 0, tear_gas: false, the_crowd_turns_against_ceausescu: false, the_tyrant_is_gone: 0, the_wall: false, the_wall_must_go: false, we_are_the_people: false, yakovlev: false}, + persistent_events: {austria_hungary_border_reopened: false, civic_forum: false, eco_glasnost: false, elena: false, foreign_currency_debt_burden: '', frg_embassies: false, general_strike: false, genscher: false, grenztruppen: false, helsinki_final_act: false, honecker: false, laszlo_tokes: false, li_peng: false, ligachev: false, national_salvation_front: false, perestroika: false, presidential_visit: false, prudence: '', roundtable_talks: false, securitate: false, sinatra_doctrine: false, solidarity_legalised: false, stand_fast: '', stasi: false, st_nicholas_church: false, systematization: 0, tear_gas: false, the_crowd_turns_against_ceausescu: false, the_tyrant_is_gone: 0, the_wall: false, the_wall_must_go: false, we_are_the_people: false, yakovlev: false}, power_struggle_deck: [], power_struggle_discard: [], dem_hand_limit: 8, @@ -4789,6 +4789,7 @@ function vm_kremlin_coup() { } function vm_laszlo_tokes() { + game.persistent_events['laszlo_tokes'] = true game.playable_cards[107].playable = 1 game.state = 'vm_laszlo_tokes' } @@ -4822,6 +4823,11 @@ function vm_malta_summit() { game.state = 'vm_malta_summit' } +function vm_massacre_in_timisoara() { + game.persistent_events['laszlo_tokes'] = false + vm_next() +} + function vm_modrow() { game.playable_cards[15].playable = 0 game.state = 'vm_modrow' -- cgit v1.2.3 From 6435b401b8c666eab9bd41848ac074536a11d444 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Mon, 23 Sep 2024 16:33:29 +0100 Subject: Fix for markers which are not true/false --- play.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/play.js b/play.js index c3b1bf2..de1670c 100644 --- a/play.js +++ b/play.js @@ -514,11 +514,19 @@ for (let id in view.persistent_events) { } // CHECK WHETHER ANY EVENT MARKERS ARE SHOWING IN THE ASIDE - +aside_events_showing = false for (let id of aside_events) { if (view.persistent_events[id]) { aside_events_showing = true; } + + //Special check for events which are not true/false + if (view.persistent_events['foreign_currency_debt_burden'] !== '') { + aside_events_showing = true + } + if (view.persistent_events['stand_fast'] !== '') { + aside_events_showing = true + } } if (aside_events_showing) { -- cgit v1.2.3 From ebfa35806351a4ef202bb7b8f11bea44a2adf017 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Mon, 23 Sep 2024 17:38:31 +0100 Subject: Final updates --- play.js | 9 +++++++-- rules.js | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/play.js b/play.js index de1670c..48df886 100644 --- a/play.js +++ b/play.js @@ -505,14 +505,19 @@ if (view.ceausescu_cards.length > 0 && view.is_pwr_struggle === true) { // UPDATE EVENT MARKERS for (let id in view.persistent_events) { - let marker = document.getElementById(id); + let marker = document.getElementById(id) if (marker && view.persistent_events[id]) { - marker.style.display = 'block'; + marker.style.display = 'block' } else if (marker && !view.persistent_events[id]) { marker.style.display = 'none' + } else if (marker && view.persistent_events[id] !== "") { + marker.style.display = 'block' + } else if(marker && view.persistent_events[id] === '') { + marker.style.display = 'none' } } + // CHECK WHETHER ANY EVENT MARKERS ARE SHOWING IN THE ASIDE aside_events_showing = false for (let id of aside_events) { diff --git a/rules.js b/rules.js index 07644c2..b201509 100644 --- a/rules.js +++ b/rules.js @@ -1065,7 +1065,7 @@ states.the_crowd_turns_against_ceausescu = { return `resolve ${cards[54].name}.` }, prompt() { - view.prompt = `You have ${game.temp} influence points. Play for:` + view.prompt = `You have ${game.temp} operations points. Play for:` gen_action('influence') gen_action('support_check') }, @@ -8242,6 +8242,7 @@ CODE[105] = [ // Public Against Violence* CODE[106] = [ // Social Democratic Platform Adopted* [ vm_social_democratic_platform_adopted ], [ vm_valid_spaces_country ], + [ vm_prompt, ()=>`${country_name(game.vm_active_country)}`], [ vm_add_infl_free, 2 ], [ vm_valid_spaces_country_sc ], [ vm_prompt, ()=>`make a Support Check in ${country_name(game.vm_active_country)}` ], -- cgit v1.2.3