diff options
author | Frans Bongers <fransbongers@macbookpro.home> | 2025-03-20 07:37:14 +0100 |
---|---|---|
committer | Frans Bongers <fransbongers@macbookpro.home> | 2025-03-20 07:37:14 +0100 |
commit | 1543df45147d7cbc2a0c63753fd0f433f1f73d55 (patch) | |
tree | ff3d052d770b3c93f185225081a8ca589bd8fca5 | |
parent | d059b9babc8e92b272fbf11d3801a47313a02d07 (diff) | |
download | land-and-freedom-1543df45147d7cbc2a0c63753fd0f433f1f73d55.tar.gz |
fix remove_attack_from_fronts state
-rw-r--r-- | rules.js | 12 | ||||
-rw-r--r-- | rules.ts | 12 |
2 files changed, 12 insertions, 12 deletions
@@ -1649,13 +1649,13 @@ states.remove_attack_from_fronts = { card_id === 6 ? 'Remove an attack from a Front.' : 'Remove attacks from a Front.'; - const front_data = f ?? {}; + const front_data = f ?? []; let is_front_with_attacks = false; data_1.FRONTS.forEach((id) => { if (game.fronts[id].value >= 0 || game.fronts[id].status !== null) { return; } - if (card_id === 6 && front_data[id]) { + if (card_id === 6 && front_data.includes(id)) { return; } is_front_with_attacks = true; @@ -1673,10 +1673,10 @@ states.remove_attack_from_fronts = { const { f, v: card_id } = get_active_node_args(); const removed_value = card_id === 6 ? 1 : Math.min(3, Math.abs(game.fronts[id].value)); update_front(id, removed_value, get_active_faction()); - const fronts = f ?? {}; - fronts[id] = removed_value; + const fronts = f ?? []; + fronts.push(id); update_active_node_args({ f: fronts }); - if (card_id === 6 && Object.keys(fronts).length === 3) { + if (card_id === 6 && fronts.length === 3) { resolve_active_and_proceed(); } else if (card_id === 39 || card_id === 16) { @@ -1691,7 +1691,7 @@ states.remove_attack_from_fronts = { }, skip() { const { f, v: card_id } = get_active_node_args(); - const values = Object.values(f ?? {}); + const values = f ?? []; if (card_id === 39 && values.length > 0) { insert_after_active_node(create_state_node('attack_front', get_active_faction(), { t: data_1.ANY, @@ -2025,14 +2025,14 @@ states.remove_attack_from_fronts = { card_id === 6 ? 'Remove an attack from a Front.' : 'Remove attacks from a Front.'; - const front_data = f ?? {}; + const front_data = f ?? []; let is_front_with_attacks = false; FRONTS.forEach((id) => { if (game.fronts[id].value >= 0 || game.fronts[id].status !== null) { return; } - if (card_id === 6 && front_data[id]) { + if (card_id === 6 && front_data.includes(id)) { return; } is_front_with_attacks = true; @@ -2054,12 +2054,12 @@ states.remove_attack_from_fronts = { update_front(id, removed_value, get_active_faction()); - const fronts = f ?? {}; - fronts[id] = removed_value; + const fronts = f ?? []; + fronts.push(id); update_active_node_args({ f: fronts }); - if (card_id === 6 && Object.keys(fronts).length === 3) { + if (card_id === 6 && fronts.length === 3) { resolve_active_and_proceed(); } else if (card_id === 39 || card_id === 16) { insert_after_active_node( @@ -2075,7 +2075,7 @@ states.remove_attack_from_fronts = { }, skip() { const { f, v: card_id } = get_active_node_args(); - const values: number[] = Object.values(f ?? {}); + const values = f ?? []; if (card_id === 39 && values.length > 0) { insert_after_active_node( create_state_node('attack_front', get_active_faction(), { |