From 2c4d84400c0769a896f7715dfa9365b763b38acd Mon Sep 17 00:00:00 2001 From: Whimsical-Cloudheart <88459121+Whimsical-Cloudheart@users.noreply.github.com> Date: Tue, 28 May 2024 07:29:02 -0300 Subject: [PATCH 1/4] Update GameKeyHandler.ttslua Added a confirmation to players for discarding decks or locations --- src/core/GameKeyHandler.ttslua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 1570280b..88ad8778 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -135,11 +135,17 @@ function discardObject(playerColor, hoveredObject) return end - -- warning for locations since these are usually not meant to be discarded - if hoveredObject.hasTag("Location") then - broadcastToAll("Watch out: A location was discarded.", "Yellow") + -- These should probably not be discarded normally. Ask player for confirmation. + if (hoveredObject.type == "Deck") or hoveredObject.hasTag("Location") then + local suspect = (hoveredObject.type == "Deck") and "Deck" or "Location" + Player[playerColor].showConfirmDialog("Discard " .. suspect .. "?", function () performDiscard(hoveredObject, playerColor) end) + return end + performDiscard(hoveredObject, playerColor) +end + +function performDiscard(hoveredObject, playerColor) -- initialize list of objects to discard local discardTheseObjects = { hoveredObject } From 377b436feba148fb29255851d53a17b21db4c4d3 Mon Sep 17 00:00:00 2001 From: Whimsical-Cloudheart <88459121+Whimsical-Cloudheart@users.noreply.github.com> Date: Tue, 28 May 2024 07:39:59 -0300 Subject: [PATCH 2/4] Update GameKeyHandler.ttslua --- src/core/GameKeyHandler.ttslua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 88ad8778..3e7ccd0c 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -174,7 +174,7 @@ function discardTopDeck(playerColor, hoveredObject) else takenCard = hoveredObject end - Wait.frames(function() discardObject(playerColor, takenCard) end, 1) + Wait.frames(function() performDiscard(takenCard, playerColor) end, 1) end -- helper function to get the player to trigger the discard function for From f6bff32b149199db1b938fe171984345fae8a0dd Mon Sep 17 00:00:00 2001 From: Whimsical-Cloudheart <88459121+Whimsical-Cloudheart@users.noreply.github.com> Date: Tue, 28 May 2024 08:39:40 -0300 Subject: [PATCH 3/4] Update GameKeyHandler.ttslua Reversed order of performDiscard's arguments --- src/core/GameKeyHandler.ttslua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 3e7ccd0c..adb2d4bf 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -138,14 +138,14 @@ function discardObject(playerColor, hoveredObject) -- These should probably not be discarded normally. Ask player for confirmation. if (hoveredObject.type == "Deck") or hoveredObject.hasTag("Location") then local suspect = (hoveredObject.type == "Deck") and "Deck" or "Location" - Player[playerColor].showConfirmDialog("Discard " .. suspect .. "?", function () performDiscard(hoveredObject, playerColor) end) + Player[playerColor].showConfirmDialog("Discard " .. suspect .. "?", function () performDiscard(playerColor, hoveredObject) end) return end - performDiscard(hoveredObject, playerColor) + performDiscard(playerColor, hoveredObject) end -function performDiscard(hoveredObject, playerColor) +function performDiscard(playerColor, hoveredObject) -- initialize list of objects to discard local discardTheseObjects = { hoveredObject } @@ -174,7 +174,7 @@ function discardTopDeck(playerColor, hoveredObject) else takenCard = hoveredObject end - Wait.frames(function() performDiscard(takenCard, playerColor) end, 1) + Wait.frames(function() performDiscard(playerColor, hoveredObject) end, 1) end -- helper function to get the player to trigger the discard function for From 7ce026fb3ddb7ea6b30643efead0133683441e7e Mon Sep 17 00:00:00 2001 From: Whimsical-Cloudheart <88459121+Whimsical-Cloudheart@users.noreply.github.com> Date: Tue, 28 May 2024 08:54:17 -0300 Subject: [PATCH 4/4] Update GameKeyHandler.ttslua --- src/core/GameKeyHandler.ttslua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index adb2d4bf..e3faced4 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -174,7 +174,7 @@ function discardTopDeck(playerColor, hoveredObject) else takenCard = hoveredObject end - Wait.frames(function() performDiscard(playerColor, hoveredObject) end, 1) + Wait.frames(function() performDiscard(playerColor, takenCard) end, 1) end -- helper function to get the player to trigger the discard function for