Merge branch 'argonui:main' into kohaku

This commit is contained in:
dscarpac 2024-07-02 15:26:07 -05:00 committed by GitHub
commit e94c8431ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 49 additions and 33 deletions

View File

@ -27,6 +27,8 @@
"HandTrigger.be2f17", "HandTrigger.be2f17",
"HandTrigger.0285cc", "HandTrigger.0285cc",
"HandTrigger.a70eee", "HandTrigger.a70eee",
"ScriptingTrigger.a2f932",
"FogOfWarTrigger.3aab97",
"TableLegBottomRight.afc863", "TableLegBottomRight.afc863",
"TableLegBottomLeft.c8edca", "TableLegBottomLeft.c8edca",
"TableLegTopLeft.393bf7", "TableLegTopLeft.393bf7",
@ -97,7 +99,6 @@
"Damagetokens.480bda", "Damagetokens.480bda",
"Resourcetokens.9fadf9", "Resourcetokens.9fadf9",
"Connectionmarkers.170f10", "Connectionmarkers.170f10",
"FogOfWarTrigger.3aab97",
"ChaosTokenReserve.106418", "ChaosTokenReserve.106418",
"ClueCounter.37be78", "ClueCounter.37be78",
"ClueCounter.1769ed", "ClueCounter.1769ed",
@ -127,7 +128,6 @@
"ChaosBag.fea079", "ChaosBag.fea079",
"DataHelper.708279", "DataHelper.708279",
"BlessCurseManager.5933fb", "BlessCurseManager.5933fb",
"ScriptingTrigger.a2f932",
"EdgeoftheEarth.895eaa", "EdgeoftheEarth.895eaa",
"TheDream-Eaters.a16a1a", "TheDream-Eaters.a16a1a",
"TheFeastofHemlockVale.c740af", "TheFeastofHemlockVale.c740af",

View File

@ -155,10 +155,10 @@ end
function endSearch(_, _, isRightClick) function endSearch(_, _, isRightClick)
local handCards = Player[handColor].getHandObjects() local handCards = Player[handColor].getHandObjects()
local j = 0 local handCount = #handCards
for i = #handCards, 1, -1 do for i = handCount, 1, -1 do
j = j + 1 Wait.time(function() deckLib.placeOrMergeIntoDeck(handCards[i], drawDeckPosition, setAsideRotation) end,
Wait.time(function() deckLib.placeOrMergeIntoDeck(handCards[i], drawDeckPosition, setAsideRotation) end, j * 0.1) (handCount - i + 1) * 0.1)
end end
-- draw set aside cards (from the ground!) -- draw set aside cards (from the ground!)

View File

@ -282,8 +282,7 @@ function removeOneUse(playerColor, hoveredObject)
end end
end end
local playerName = Player[playerColor].steam_name broadcastToAll(getColoredName(playerColor) .. " removed a token: " .. tokenName, playerColor)
broadcastToAll(playerName .. " removed a token: " .. tokenName, playerColor)
local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor) local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)
playermatApi.discardListOfObjects(discardForMatColor, { targetObject }) playermatApi.discardListOfObjects(discardForMatColor, { targetObject })
@ -404,12 +403,10 @@ function takeClueFromLocation(playerColor, hoveredObject)
local clickableClues = optionPanelApi.getOptions()["useClueClickers"] local clickableClues = optionPanelApi.getOptions()["useClueClickers"]
-- handling for calling this for a specific mat via hotkey -- handling for calling this for a specific mat via hotkey
local playerName, matColor, pos local matColor, pos
if Player[playerColor] and Player[playerColor].seated then if Player[playerColor] and Player[playerColor].seated then
playerName = Player[playerColor].steam_name
matColor = playermatApi.getMatColor(playerColor) matColor = playermatApi.getMatColor(playerColor)
else else
playerName = playerColor
matColor = playerColor matColor = playerColor
end end
@ -431,9 +428,9 @@ function takeClueFromLocation(playerColor, hoveredObject)
end end
if cardName then if cardName then
broadcastToAll(playerName .. " took one clue from " .. cardName .. ".", "White") broadcastToAll(getColoredName(playerColor) .. " took one clue from " .. cardName .. ".", "White")
else else
broadcastToAll(playerName .. " took one clue.", "White") broadcastToAll(getColoredName(playerColor) .. " took one clue.", "White")
end end
victoryDisplayApi.update() victoryDisplayApi.update()
@ -472,3 +469,14 @@ function getFirstSeatedPlayer()
return color return color
end end
end end
-- returns the colored steam name or color
function getColoredName(playerColor)
local displayName = playerColor
if Player[playerColor].steam_name then
displayName = Player[playerColor].steam_name
end
-- add bb-code
return "[" .. Color.fromString(playerColor):toHex() .. "]" .. displayName .. "[-]"
end

View File

@ -207,6 +207,7 @@ end
-- TTS event for objects that leave zones -- TTS event for objects that leave zones
function onObjectLeaveZone(zone, object) function onObjectLeaveZone(zone, object)
if zone.isDestroyed() or object.isDestroyed() then return end
if zone.type == "Hand" and object.hasTag("CardWithHelper") then if zone.type == "Hand" and object.hasTag("CardWithHelper") then
object.call("updateDisplay") object.call("updateDisplay")
end end

View File

@ -256,13 +256,11 @@ function discardListOfObjects(objList)
else else
deckLib.placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, { x = 0, y = -90, z = 0 }) deckLib.placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, { x = 0, y = -90, z = 0 })
end end
-- put chaos tokens back into bag (e.g. Unrelenting)
elseif tokenChecker.isChaosToken(obj) then elseif tokenChecker.isChaosToken(obj) then
-- put chaos tokens back into bag (e.g. Unrelenting)
chaosBagApi.returnChaosTokenToBag(obj) chaosBagApi.returnChaosTokenToBag(obj)
-- don't touch locked objects (like the table etc.) or specific objects (like key tokens)
elseif not obj.getLock() and not obj.hasTag("DontDiscard") then elseif not obj.getLock() and not obj.hasTag("DontDiscard") then
-- don't touch locked objects (like the table etc.) or specific objects (like key tokens)
ownedObjects.Trash.putObject(obj) ownedObjects.Trash.putObject(obj)
end end
end end
@ -392,25 +390,24 @@ function doUpkeep(_, clickedByColor, isRightClick)
local cardsToDiscard = {} local cardsToDiscard = {}
for i = 1, #handCards do for i = 1, #handCards do
local metadata = JSON.decode(handCards[i].getGMNotes()) local md = JSON.decode(handCards[i].getGMNotes())
if metadata ~= nil and (not metadata.weakness and not metadata.hidden) then if md ~= nil and (not md.weakness and not md.hidden and md.type ~= "Enemy") then
table.insert(cardsToDiscard, handCards[i]) table.insert(cardsToDiscard, handCards[i])
end end
end end
local j = 0 -- perform discarding 1 by 1
local k = 0 local pos = returnGlobalDiscardPosition()
local count = #cardsToDiscard
for i = #cardsToDiscard, 1, -1 do for i = count, 1, -1 do
j = j + 1 Wait.time(function() deckLib.placeOrMergeIntoDeck(cardsToDiscard[i], pos, rot) end,
Wait.time(function() deckLib.placeOrMergeIntoDeck(cardsToDiscard[i], returnGlobalDiscardPosition(), self.getRotation()) end, j * 0.1) (count - i + 1) * 0.1)
end end
-- add some time if there are any cards to discard, if not, draw up to 5 immediately -- add some time if there are any cards to discard, if not, draw up to 5 immediately
if j > 0 then local k = 0
k = 0.7 + (j * 0.1) if count > 0 then
else k = 0.5 + (count * 0.1)
k = 0
end end
Wait.time(function() Wait.time(function()
@ -579,9 +576,8 @@ function doDiscardOne()
-- get a random non-hidden card (from the "choices" table) -- get a random non-hidden card (from the "choices" table)
local num = math.random(1, #choices) local num = math.random(1, #choices)
deckLib.placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation()) deckLib.placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())
broadcastToAll(getColoredName(playerColor) .. " randomly discarded card "
local playerName = Player[playerColor].steam_name or playerColor .. choices[num] .. "/" .. #hand .. ".", "White")
broadcastToAll(playerName .. " randomly discarded card " .. choices[num] .. "/" .. #hand .. ".", "White")
end end
end end
@ -1248,3 +1244,14 @@ function updatePlayerCards(args)
local playerCardData = customDataHelper.getTable("PLAYER_CARD_DATA") local playerCardData = customDataHelper.getTable("PLAYER_CARD_DATA")
tokenManager.addPlayerCardData(playerCardData) tokenManager.addPlayerCardData(playerCardData)
end end
-- returns the colored steam name or color
function getColoredName(playerColor)
local displayName = playerColor
if Player[playerColor].steam_name then
displayName = Player[playerColor].steam_name
end
-- add bb-code
return "[" .. Color.fromString(playerColor):toHex() .. "]" .. displayName .. "[-]"
end

View File

@ -39,7 +39,7 @@ do
function() function()
obj.use_hands = true obj.use_hands = true
-- this avoids a TTS bug that merges unrelated cards that are not resting -- this avoids a TTS bug that merges unrelated cards that are not resting
if #searchResult == 1 and searchResult[1] ~= obj then if #searchResult == 1 and searchResult[1] ~= obj and searchResult[1] ~= nil then
-- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put) -- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put)
pcall(function() searchResult[1].putObject(obj) end) pcall(function() searchResult[1].putObject(obj) end)
end end