diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-18 10:23:34 +0100 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-18 10:23:34 +0100 |
commit | 6d8ac00db1366e7b0c790e679bc439c8fcac5fed (patch) | |
tree | 46a390ba813d75c9e46a847f96d653fdd0eacecd /play.js | |
parent | b8fd0a468328c0706d24e5a2250594dcae53d5f0 (diff) | |
download | 1989-dawn-of-freedom-6d8ac00db1366e7b0c790e679bc439c8fcac5fed.tar.gz |
Added action toggles
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -182,12 +182,12 @@ function is_card_enabled(card) { function on_click_space(evt) {
if (evt.button === 0) {
const space = evt.target.my_space;
- console.log('on_click_space_called with space:', space);
+ //console.log('on_click_space_called with space:', space);
if (send_action('infl', space)) {
- console.log('send_action with infl:', space);
+ //console.log('send_action with infl:', space);
evt.stopPropagation();
} else if (send_action('sc', space)) {
- console.log('send_action with sc:', space);
+ //console.log('send_action with sc:', space);
evt.stopPropagation();
} else {
// console.log('send_action failed for space:', space);
@@ -199,9 +199,9 @@ function on_click_space(evt) { function on_click_card(evt) {
if (evt.button === 0) {
const card = evt.target.my_card;
- console.log('on_click_card_called with card:', card);
+ //console.log('on_click_card_called with card:', card);
if (is_action('card', card)) {
- console.log('in action card')
+ //console.log('in action card')
if (send_action('card', card)) {
evt.stopPropagation();
}
@@ -211,15 +211,15 @@ function on_click_card(evt) { function is_action(action) {
//console.log('is_action called with: ', action)
- console.log('view.actions', view.actions)
+ //console.log('view.actions', view.actions)
if (view.actions && view.actions[action])
return true
return false
}
function is_card_action(action, card) {
- console.log('is_card_action called with action', action, 'card', card)
- console.log('view.actions', view.actions, 'view.actions[action]', view.actions[action])
+ //console.log('is_card_action called with action', action, 'card', card)
+ //console.log('view.actions', view.actions, 'view.actions[action]', view.actions[action])
if (view.actions && view.actions[action] && view.actions[action].includes(card))
return true
return false
@@ -417,9 +417,15 @@ function on_update() { if (view.hand.length && view.is_pwr_struggle === false) {
document.getElementById("hand_panel").classList.remove("hide")
+ //console.log('view.actions.card', view.actions.card)
for (let c of view.hand) {
let card = ui.cards[c]
document.getElementById("hand").appendChild(card);
+ if (view.actions && view.actions.card && view.actions.card.includes(c)) {
+ card.classList.add('action')
+ } else {
+ card.classList.remove('action')
+ }
if (view.valid_cards.includes(c)) {
card.classList.add('selected')
} else {
@@ -450,7 +456,7 @@ if (!view.is_pwr_struggle) { }
// DISCARD FOR EVENTS
-console.log('view.discard',view.discard)
+//console.log('view.discard',view.discard)
if(view.discard) {
//document.getElementById("discard").replaceChildren()
document.getElementById("discard_panel").classList.remove("hide")
@@ -484,6 +490,7 @@ for (let c of view.strategy_removed) { if (view.played_card > 0) {
document.getElementById("played_card_panel").classList.remove("hide")
document.getElementById("played_card").appendChild(ui.cards[view.played_card]);
+ document.getElementById("played_card").classList.remove("hand_card")
} else {
document.getElementById("played_card_panel").classList.add("hide")
}
@@ -517,7 +524,7 @@ if (!view.is_pwr_struggle) { document.getElementById("opp_hand_panel").classList.add("hide")
}
} else {
- console.log('power struggle, show opp hand', view.show_opp_hand, 'view opp hand', view.opp_hand )
+ //console.log('power struggle, show opp hand', view.show_opp_hand, 'view opp hand', view.opp_hand )
if (view.show_opp_hand && view.opp_hand && view.opp_hand.length > 0) {
document.getElementById("opp_hand_panel").classList.remove("hide")
for (let c of view.opp_hand) {
@@ -699,7 +706,7 @@ if (view.persistent_events.includes(97)) { action_button("end_round", "End Round")
action_button("undo", "Undo")
-console.log('view.strategy_deck', view.strategy_deck)
+console.log('view.actions', view.actions)
}
// =========================== LOG FUNCTIONS ==============================================
|