From f83ef7dae8b8934aa4bf536757439b3f1f7f55b0 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 22 Mar 2025 16:11:41 +0100 Subject: fix off by one in swap_card_tableau_hand --- rules.js | 8 ++++---- rules.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rules.js b/rules.js index 8474e71..ab8007f 100644 --- a/rules.js +++ b/rules.js @@ -1889,10 +1889,10 @@ states.swap_card_tableau_hand = { if (selected_cards.length === selected_at_start + 2) { const hand = game.hands[faction]; const tableau = game.tableaus[faction]; - array_remove_item(hand, selected_cards[selected_at_start + 1]); - array_remove_item(tableau, selected_cards[selected_at_start + 2]); - hand.push(selected_cards[selected_at_start + 2]); - tableau.push(selected_cards[selected_at_start + 1]); + array_remove_item(hand, selected_cards[selected_at_start + 0]); + array_remove_item(tableau, selected_cards[selected_at_start + 1]); + hand.push(selected_cards[selected_at_start + 1]); + tableau.push(selected_cards[selected_at_start + 0]); game.selected_cards[faction].length = selected_at_start; resolve_active_and_proceed(); } diff --git a/rules.ts b/rules.ts index 2698106..9c5be20 100644 --- a/rules.ts +++ b/rules.ts @@ -2302,10 +2302,10 @@ states.swap_card_tableau_hand = { if (selected_cards.length === selected_at_start + 2) { const hand = game.hands[faction]; const tableau = game.tableaus[faction]; - array_remove_item(hand, selected_cards[selected_at_start + 1]); - array_remove_item(tableau, selected_cards[selected_at_start + 2]); - hand.push(selected_cards[selected_at_start + 2]); - tableau.push(selected_cards[selected_at_start + 1]); + array_remove_item(hand, selected_cards[selected_at_start + 0]); + array_remove_item(tableau, selected_cards[selected_at_start + 1]); + hand.push(selected_cards[selected_at_start + 1]); + tableau.push(selected_cards[selected_at_start + 0]); game.selected_cards[faction].length = selected_at_start; resolve_active_and_proceed(); } -- cgit v1.2.3