exclusion of bless/curse tokens for findAllTokens
This commit is contained in:
parent
9dd8fe8ad6
commit
f82d29b9e0
@ -6,6 +6,7 @@ Cleans up the table for the next scenario in a campaign:
|
||||
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
|
||||
local soundCubeApi = require("core/SoundCubeApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
|
||||
-- these objects will be ignored
|
||||
local IGNORE_GUIDS = {
|
||||
@ -168,7 +169,7 @@ function cleanUp(_, color)
|
||||
updateCounters(CLUE_CLICKER_GUIDS, 0, "Clue clickers")
|
||||
resetSkillTrackers()
|
||||
resetDoomCounter()
|
||||
removeBlessCurse(color)
|
||||
blessCurseManagerApi.removeAll(color)
|
||||
removeLines()
|
||||
discardHands()
|
||||
tokenSpawnTrackerApi.resetAll()
|
||||
@ -181,6 +182,7 @@ end
|
||||
---------------------------------------------------------
|
||||
-- modular functions, called by other functions
|
||||
---------------------------------------------------------
|
||||
|
||||
function updateCounters(tableOfGUIDs, tableOfNewValues, info)
|
||||
if tonumber(tableOfNewValues) then
|
||||
local value = tableOfNewValues
|
||||
@ -267,17 +269,6 @@ function getTrauma()
|
||||
end
|
||||
end
|
||||
|
||||
-- get rid of bless/curse tokens via bless/curse manager
|
||||
function removeBlessCurse(color)
|
||||
local BlessCurseManager = getObjectFromGUID("5933fb")
|
||||
|
||||
if BlessCurseManager ~= nil then
|
||||
BlessCurseManager.call("doRemove", color)
|
||||
else
|
||||
printToAll("Bless / Curse manager could not be found and thus bless/curse tokens were skipped.", "Yellow")
|
||||
end
|
||||
end
|
||||
|
||||
-- remove drawn lines
|
||||
function removeLines()
|
||||
if options["removeDrawnLines"] then
|
||||
|
@ -63,14 +63,21 @@ function onLoad(saved_state)
|
||||
self.addContextMenuItem("Remove all", doRemove)
|
||||
self.addContextMenuItem("Reset", doReset)
|
||||
|
||||
-- initializing tables
|
||||
-- initializing tables
|
||||
initializeState()
|
||||
broadcastCount("Curse")
|
||||
broadcastCount("Bless")
|
||||
end
|
||||
|
||||
function resetTables()
|
||||
numInPlay = { Bless = 0, Curse = 0 }
|
||||
tokensTaken = { Bless = {}, Curse = {} }
|
||||
sealedTokens = {}
|
||||
Wait.time(initializeState, 1)
|
||||
end
|
||||
|
||||
function initializeState()
|
||||
resetTables()
|
||||
|
||||
-- count tokens in the bag
|
||||
local chaosbag = Global.call("findChaosBag")
|
||||
local tokens = {}
|
||||
@ -95,9 +102,6 @@ function initializeState()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
broadcastCount("Curse")
|
||||
broadcastCount("Bless")
|
||||
end
|
||||
|
||||
function broadcastCount(token)
|
||||
@ -133,15 +137,15 @@ function doRemove(color)
|
||||
broadcastToColor("Removed " .. removeTakenTokens("Bless") .. " Bless and " ..
|
||||
removeTakenTokens("Curse") .. " Curse tokens from play.", color, "White")
|
||||
|
||||
doReset(color)
|
||||
resetTables()
|
||||
tokenArrangerApi.layout()
|
||||
end
|
||||
|
||||
-- context menu function 2
|
||||
function doReset(color)
|
||||
playerColor = color
|
||||
numInPlay = { Bless = 0, Curse = 0 }
|
||||
tokensTaken = { Bless = {}, Curse = {} }
|
||||
initializeState()
|
||||
broadcastCount("Curse")
|
||||
broadcastCount("Bless")
|
||||
tokenArrangerApi.layout()
|
||||
end
|
||||
|
||||
|
@ -26,6 +26,12 @@ do
|
||||
getObjectFromGUID(MANAGER_GUID).call("broadcastStatus", playerColor)
|
||||
end
|
||||
|
||||
-- removes all bless / curse tokens from the chaos bag and play
|
||||
---@param playerColor String Color of the player to show the broadcast to
|
||||
BlessCurseManagerApi.removeAll = function(playerColor)
|
||||
getObjectFromGUID(MANAGER_GUID).call("doRemove", playerColor)
|
||||
end
|
||||
|
||||
-- adds Wendy's menu to the hovered card (allows sealing of tokens)
|
||||
---@param color String Color of the player to show the broadcast to
|
||||
BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)
|
||||
|
@ -646,11 +646,15 @@ function emptyChaosBag()
|
||||
end
|
||||
end
|
||||
|
||||
-- find all chaos tokens that are on the table to the chaos bag (e.g. sealed on cards)
|
||||
-- move all regular chaos tokens that are on the table to the chaos bag (e.g. sealed on cards)
|
||||
function findAllChaosTokens()
|
||||
local chaosbag = findChaosBag()
|
||||
for _, obj in ipairs(getObjects()) do
|
||||
if tokenChecker.isChaosToken(obj) and not obj.hasTag("tempToken") then
|
||||
local name = obj.getName()
|
||||
if tokenChecker.isChaosToken(obj) and
|
||||
not obj.hasTag("tempToken") and
|
||||
name ~= "Bless" and
|
||||
name ~= "Curse" then
|
||||
chaosbag.putObject(obj)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user