Round 2 of comment response

This commit is contained in:
Buhallin 2022-12-28 10:32:54 -08:00
parent 98e73a11be
commit 2b94cea679
No known key found for this signature in database
GPG Key ID: DB3C362823852294

View File

@ -1,6 +1,6 @@
do do
local tokenSpawnTracker = require("core/token/TokenSpawnTrackerApi") local tokenSpawnTracker = require("core/token/TokenSpawnTrackerApi")
local playAreaApi = require("core/PlayAreaApi") local playArea = require("core/PlayAreaApi")
local PLAYER_CARD_TOKEN_OFFSETS = { local PLAYER_CARD_TOKEN_OFFSETS = {
[1] = { [1] = {
@ -124,8 +124,9 @@ do
local internal = { } local internal = { }
-- Spawns tokens for the card. This function is built to just throw a card at it and let it do -- Spawns tokens for the card. This function is built to just throw a card at it and let it do
-- the work. It will check to see if the card has already spawned, find appropriate data from -- the work once a card has hit an area where it might spawn tokens. It will check to see if
-- either the uses metadata or the Data Helper, and spawn the tokens. -- the card has already spawned, find appropriate data from either the uses metadata or the Data
-- Helper, and spawn the tokens.
---@param card Object Card to maybe spawn tokens for ---@param card Object Card to maybe spawn tokens for
---@param extraUses Table A table of <use type>=<count> which will modify the number of tokens ---@param extraUses Table A table of <use type>=<count> which will modify the number of tokens
--- spawned for that type. e.g. Akachi's playmat should pass "Charge"=1 --- spawned for that type. e.g. Akachi's playmat should pass "Charge"=1
@ -328,7 +329,7 @@ do
type = useInfo.type type = useInfo.type
token = useInfo.token token = useInfo.token
tokenCount = (useInfo.count or 0) tokenCount = (useInfo.count or 0)
+ (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount() + (useInfo.countPerInvestigator or 0) * playArea.getInvestigatorCount()
if extraUses ~= nil and extraUses[type] ~= nil then if extraUses ~= nil and extraUses[type] ~= nil then
tokenCount = tokenCount + extraUses[type] tokenCount = tokenCount + extraUses[type]
end end
@ -401,7 +402,7 @@ do
if locationData.type == 'fixed' then if locationData.type == 'fixed' then
return locationData.value return locationData.value
elseif locationData.type == 'perPlayer' then elseif locationData.type == 'perPlayer' then
return locationData.value * playAreaApi.getInvestigatorCount() return locationData.value * playArea.getInvestigatorCount()
end end
error('unexpected location type: ' .. locationData.type) error('unexpected location type: ' .. locationData.type)
end end