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

View File

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

View File

@ -282,8 +282,7 @@ function removeOneUse(playerColor, hoveredObject)
end
end
local playerName = Player[playerColor].steam_name
broadcastToAll(playerName .. " removed a token: " .. tokenName, playerColor)
broadcastToAll(getColoredName(playerColor) .. " removed a token: " .. tokenName, playerColor)
local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)
playermatApi.discardListOfObjects(discardForMatColor, { targetObject })
@ -404,12 +403,10 @@ function takeClueFromLocation(playerColor, hoveredObject)
local clickableClues = optionPanelApi.getOptions()["useClueClickers"]
-- 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
playerName = Player[playerColor].steam_name
matColor = playermatApi.getMatColor(playerColor)
else
playerName = playerColor
matColor = playerColor
end
@ -431,9 +428,9 @@ function takeClueFromLocation(playerColor, hoveredObject)
end
if cardName then
broadcastToAll(playerName .. " took one clue from " .. cardName .. ".", "White")
broadcastToAll(getColoredName(playerColor) .. " took one clue from " .. cardName .. ".", "White")
else
broadcastToAll(playerName .. " took one clue.", "White")
broadcastToAll(getColoredName(playerColor) .. " took one clue.", "White")
end
victoryDisplayApi.update()
@ -472,3 +469,14 @@ function getFirstSeatedPlayer()
return color
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
function onObjectLeaveZone(zone, object)
if zone.isDestroyed() or object.isDestroyed() then return end
if zone.type == "Hand" and object.hasTag("CardWithHelper") then
object.call("updateDisplay")
end

View File

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