added investigator counter to handler
This commit is contained in:
parent
5cd37055a8
commit
7b0fd216ef
@ -51,6 +51,7 @@ local GuidReferences = {
|
||||
DeckImporter = "a28140",
|
||||
DoomCounter = "85c4c6",
|
||||
DoomInPlayCounter = "652ff3",
|
||||
InvestigatorCounter = "f182ee",
|
||||
MasterClueCounter = "4a3aa4",
|
||||
MythosArea = "9f334f",
|
||||
NavigationOverlayHandler = "797ede",
|
||||
|
@ -2,8 +2,6 @@
|
||||
-- general setup
|
||||
---------------------------------------------------------
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
-- Location connection directional options
|
||||
local BIDIRECTIONAL = 0
|
||||
local ONE_WAY = 1
|
||||
@ -27,7 +25,8 @@ local collisionEnabled = false
|
||||
-- used for recreating the link to a custom data helper after image change
|
||||
customDataHelper = nil
|
||||
|
||||
local DEFAULT_URL = "http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/"
|
||||
local DEFAULT_URL =
|
||||
"http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/"
|
||||
|
||||
local SHIFT_OFFSETS = {
|
||||
left = { x = 0.00, y = 0, z = 7.67 },
|
||||
@ -129,12 +128,14 @@ function onCollisionEnter(collisionInfo)
|
||||
if shouldSpawnTokens(card) then
|
||||
tokenManager.spawnForCard(card)
|
||||
end
|
||||
|
||||
-- If this card was being dragged, clear the dragging connections. A multi-drag/drop may send
|
||||
-- the dropped card immediately into a deck, so this has to be done here
|
||||
if draggingGuids[card.getGUID()] ~= nil then
|
||||
card.setVectorLines(nil)
|
||||
draggingGuids[card.getGUID()] = nil
|
||||
end
|
||||
|
||||
maybeTrackLocation(card)
|
||||
end
|
||||
|
||||
@ -451,11 +452,13 @@ function addOneWayVector(origin, target, vectorOwner, lines)
|
||||
-- Calculate card distance to be closer for horizontal positions than vertical, since cards are
|
||||
-- taller than they are wide
|
||||
local heading = Vector(originPos):sub(targetPos):heading("y")
|
||||
local distanceFromCard = DIRECTIONAL_ARROW_DISTANCE * 0.7 + DIRECTIONAL_ARROW_DISTANCE * 0.3 * math.abs(math.sin(math.rad(heading)))
|
||||
local distanceFromCard = DIRECTIONAL_ARROW_DISTANCE * 0.7 +
|
||||
DIRECTIONAL_ARROW_DISTANCE * 0.3 * math.abs(math.sin(math.rad(heading)))
|
||||
|
||||
-- Calculate the three possible arrow positions. These are offset by half the arrow length to
|
||||
-- make them visually balanced by keeping the arrows centered, not tracking the point
|
||||
local midpoint = Vector(originPos):add(targetPos):scale(Vector(0.5, 0.5, 0.5)):moveTowards(targetPos, ARROW_ARM_LENGTH / 2)
|
||||
local midpoint = Vector(originPos):add(targetPos):scale(Vector(0.5, 0.5, 0.5)):moveTowards(targetPos,
|
||||
ARROW_ARM_LENGTH / 2)
|
||||
local closeToOrigin = Vector(originPos):moveTowards(targetPos, distanceFromCard + ARROW_ARM_LENGTH / 2)
|
||||
local closeToTarget = Vector(targetPos):moveTowards(originPos, distanceFromCard - ARROW_ARM_LENGTH / 2)
|
||||
|
||||
@ -474,8 +477,10 @@ end
|
||||
--- positioning and scaling, as well as highlighting connections during a drag operation
|
||||
---@param lines Table List of vector line elements. Mutable, will be updated to add this arrow
|
||||
function addArrowLines(arrowheadPos, originPos, vectorOwner, lines)
|
||||
local arrowArm1 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y", -1 * ARROW_ANGLE):add(arrowheadPos)
|
||||
local arrowArm2 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y", ARROW_ANGLE):add(arrowheadPos)
|
||||
local arrowArm1 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y",
|
||||
-1 * ARROW_ANGLE):add(arrowheadPos)
|
||||
local arrowArm2 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y",
|
||||
ARROW_ANGLE):add(arrowheadPos)
|
||||
|
||||
local head = vectorOwner.positionToLocal(arrowheadPos)
|
||||
local arm1 = vectorOwner.positionToLocal(arrowArm1)
|
||||
@ -508,6 +513,7 @@ function shiftContentsRight(playerColor)
|
||||
end
|
||||
|
||||
function shiftContents(playerColor, direction)
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
local zone = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayAreaZone" })
|
||||
if not zone then
|
||||
broadcastToColor("Scripting zone couldn't be found.", playerColor, "Red")
|
||||
|
@ -14,7 +14,7 @@ do
|
||||
-- Returns the current value of the investigator counter from the playmat
|
||||
---@return Integer. Number of investigators currently set on the counter
|
||||
PlayAreaApi.getInvestigatorCount = function()
|
||||
getInvestigatorCounter().getVar("val")
|
||||
return getInvestigatorCounter().getVar("val")
|
||||
end
|
||||
|
||||
-- Updates the current value of the investigator counter from the playmat
|
||||
|
@ -365,18 +365,16 @@ do
|
||||
if uses == nil then return end
|
||||
|
||||
-- go through tokens to spawn
|
||||
local type, token, tokenCount
|
||||
local tokenCount
|
||||
for i, useInfo in ipairs(uses) do
|
||||
type = useInfo.type
|
||||
token = useInfo.token
|
||||
tokenCount = (useInfo.count or 0)
|
||||
+ (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()
|
||||
if extraUses ~= nil and extraUses[type] ~= nil then
|
||||
tokenCount = tokenCount + extraUses[type]
|
||||
tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()
|
||||
if extraUses ~= nil and extraUses[useInfo.type] ~= nil then
|
||||
tokenCount = tokenCount + extraUses[useInfo.type]
|
||||
end
|
||||
-- Shift each spawned group after the first down so they don't pile on each other
|
||||
TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)
|
||||
TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)
|
||||
end
|
||||
|
||||
tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())
|
||||
end
|
||||
|
||||
@ -400,9 +398,8 @@ do
|
||||
---@param playerData Table Player card data structure retrieved from the DataHelper. Should be
|
||||
-- the right data for this card.
|
||||
internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)
|
||||
token = playerData.tokenType
|
||||
tokenCount = playerData.tokenCount
|
||||
--log("Spawning data helper tokens for "..card.getName()..'['..card.getDescription()..']: '..tokenCount.."x "..token)
|
||||
local token = playerData.tokenType
|
||||
local tokenCount = playerData.tokenCount
|
||||
TokenManager.spawnTokenGroup(card, token, tokenCount)
|
||||
tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())
|
||||
end
|
||||
@ -435,7 +432,6 @@ do
|
||||
return 0
|
||||
end
|
||||
|
||||
--log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)
|
||||
if ((card.is_face_down and locationData.clueSide == 'back')
|
||||
or (not card.is_face_down and locationData.clueSide == 'front')) then
|
||||
if locationData.type == 'fixed' then
|
||||
|
Loading…
x
Reference in New Issue
Block a user