added action spawning ability
This commit is contained in:
parent
7ad53e2192
commit
ac09b737cb
@ -19,7 +19,8 @@
|
|||||||
"Horror.36be72",
|
"Horror.36be72",
|
||||||
"Path.7234af",
|
"Path.7234af",
|
||||||
"Resource.910e09",
|
"Resource.910e09",
|
||||||
"ResourceCounter.498ec0"
|
"ResourceCounter.498ec0",
|
||||||
|
"Neutral.04765c"
|
||||||
],
|
],
|
||||||
"ContainedObjects_path": "TokenSource.124381",
|
"ContainedObjects_path": "TokenSource.124381",
|
||||||
"Description": "",
|
"Description": "",
|
||||||
|
2285
objects/TokenSource.124381/Neutral.04765c.json
Normal file
2285
objects/TokenSource.124381/Neutral.04765c.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,9 @@
|
|||||||
|
local playmatApi = require("playermat/PlaymatApi")
|
||||||
local searchLib = require("util/SearchLib")
|
local searchLib = require("util/SearchLib")
|
||||||
local tokenManager = require("core/token/TokenManager")
|
local tokenManager = require("core/token/TokenManager")
|
||||||
local TOKEN_INDEX = {}
|
local TOKEN_INDEX = {}
|
||||||
|
|
||||||
|
TOKEN_INDEX[1] = "actionToken"
|
||||||
TOKEN_INDEX[3] = "resourceCounter"
|
TOKEN_INDEX[3] = "resourceCounter"
|
||||||
TOKEN_INDEX[4] = "damage"
|
TOKEN_INDEX[4] = "damage"
|
||||||
TOKEN_INDEX[5] = "path"
|
TOKEN_INDEX[5] = "path"
|
||||||
@ -20,6 +23,15 @@ local stateTable = {
|
|||||||
["offering"] = 8
|
["offering"] = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local actionStateTable = {
|
||||||
|
["Guardian"] = 1,
|
||||||
|
["Seeker"] = 2,
|
||||||
|
["Rogue"] = 3,
|
||||||
|
["Mystic"] = 4,
|
||||||
|
["Survivor"] = 5,
|
||||||
|
["Neutral"] = 6
|
||||||
|
}
|
||||||
|
|
||||||
---@param index number Index of the pressed key
|
---@param index number Index of the pressed key
|
||||||
---@param playerColor string Color of the triggering player
|
---@param playerColor string Color of the triggering player
|
||||||
function onScriptingButtonDown(index, playerColor)
|
function onScriptingButtonDown(index, playerColor)
|
||||||
@ -74,6 +86,21 @@ function onScriptingButtonDown(index, playerColor)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- check for nearest investigator card and change action token state to its class
|
||||||
|
elseif tokenType == "actionToken" then
|
||||||
|
local matColor = playmatApi.getMatColorByPosition(position)
|
||||||
|
local result = playmatApi.searchAroundPlaymat(matColor, "isCard")
|
||||||
|
for j, card in ipairs(result) do
|
||||||
|
local metadata = JSON.decode(card.getGMNotes()) or {}
|
||||||
|
if metadata.type == "Investigator" then
|
||||||
|
investigatorClass = metadata.class
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local stateID = actionStateTable[investigatorClass]
|
||||||
|
if stateID ~= nil and stateID ~= 6 then
|
||||||
|
callback = function(spawned) spawned.setState(stateID) end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
tokenManager.spawnToken(position, tokenType, rotation, callback)
|
tokenManager.spawnToken(position, tokenType, rotation, callback)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user