Merge pull request #962 from argonui/kohaku

Kohaku: Fixed color for Bless Curse Manager messages
This commit is contained in:
dscarpac 2024-11-03 13:37:15 -06:00 committed by GitHub
commit b47d4f4fd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 24 deletions

View File

@ -175,11 +175,10 @@ function doRemove(color)
end
end
broadcastToColor("Removed " .. count.Bless .. " Bless and " .. count.Curse .. " Curse tokens from the chaos bag.",
color, "White")
broadcastToColor(
"Removed " .. removeTakenTokens("Bless") .. " Bless and " .. removeTakenTokens("Curse") .. " Curse tokens from play.",
color, "White")
broadcastToColor("Removed " .. count.Bless .. " Bless and " ..
count.Curse .. " Curse tokens from the chaos bag.", color, "White")
broadcastToColor("Removed " .. removeTakenTokens("Bless") .. " Bless and " ..
removeTakenTokens("Curse") .. " Curse tokens from play.", color, "White")
resetTables()
updateButtonLabels()
@ -214,16 +213,21 @@ function clickCurse(_, color, isRightClick)
callFunctions("Curse", isRightClick)
end
function callFunctions(type, isRightClick)
function callFunctions(tokenType, isRightClick)
if not chaosBagApi.canTouchChaosTokens() then return end
if isRightClick then
removeToken(type)
removeToken(tokenType)
else
addToken(type)
addToken(tokenType)
end
end
function callFunctionFromApi(params)
playerColor = params.playerColor or Player.getSeatedPlayers()[1]
callFunctions(params.tokenType, params.remove)
end
---------------------------------------------------------
-- called functions
---------------------------------------------------------

View File

@ -57,15 +57,17 @@ do
end
-- adds bless / curse to the chaos bag
---@param type string Type of chaos token ("Bless" or "Curse")
BlessCurseManagerApi.addToken = function(type)
getManager().call("addToken", type)
---@param tokenType string Type of chaos token ("Bless" or "Curse")
---@param playerColor? string Color of the triggering player
BlessCurseManagerApi.addToken = function(tokenType, playerColor)
getManager().call("callFunctionFromApi", { tokenType = tokenType, playerColor = playerColor, remove = false })
end
-- removes bless / curse from the chaos bag
---@param type string Type of chaos token ("Bless" or "Curse")
BlessCurseManagerApi.removeToken = function(type)
getManager().call("removeToken", type)
---@param tokenType string Type of chaos token ("Bless" or "Curse")
---@param playerColor? string Color of the triggering player
BlessCurseManagerApi.removeToken = function(tokenType, playerColor)
getManager().call("callFunctionFromApi", { tokenType = tokenType, playerColor = playerColor, remove = true })
end
BlessCurseManagerApi.getBlessCurseInBag = function()

View File

@ -45,19 +45,19 @@ function shutOff()
end
end
function addTokenToBag(_, _, tokenType)
function addTokenToBag(player, _, tokenType)
if not updated then return end
blessCurseManagerApi.addToken(tokenType)
blessCurseManagerApi.addToken(tokenType, player.color)
updated = false
Wait.frames(maybeUpdateButtonState, 2)
end
function removeAndExtraAction()
function removeAndExtraAction(player)
if not updated then return end
blessCurseManagerApi.removeToken("Bless")
blessCurseManagerApi.removeToken("Bless")
blessCurseManagerApi.removeToken("Curse")
blessCurseManagerApi.removeToken("Curse")
blessCurseManagerApi.removeToken("Bless", player.color)
blessCurseManagerApi.removeToken("Bless", player.color)
blessCurseManagerApi.removeToken("Curse", player.color)
blessCurseManagerApi.removeToken("Curse", player.color)
updated = false
Wait.frames(maybeUpdateButtonState, 2)
@ -89,9 +89,9 @@ function removeAndExtraAction()
tokenManagerApi.spawnToken(emptyPos + Vector(0, 0.7, 0), "universalActionAbility", rotation, callbackName, callbackParams)
end
function elderSignAbility()
blessCurseManagerApi.addToken("Bless")
blessCurseManagerApi.addToken("Curse")
function elderSignAbility(player)
blessCurseManagerApi.addToken("Bless", player.color)
blessCurseManagerApi.addToken("Curse", player.color)
updated = false
Wait.frames(maybeUpdateButtonState, 2)
end