adding requested changes

This commit is contained in:
Chr1Z93 2022-11-16 18:58:59 +01:00
parent 61e8e0d2e0
commit 9f1415901e
13 changed files with 53 additions and 49 deletions

View File

@ -33,8 +33,8 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"LuaScript_path": "InvestigatorSkillTracker.af7ed7.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",

View File

@ -1 +0,0 @@
require("playermat/InvestigatorSkillTracker")

View File

@ -33,8 +33,8 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"LuaScript_path": "InvestigatorSkillTracker.b4a5f7.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",

View File

@ -1 +0,0 @@
require("playermat/InvestigatorSkillTracker")

View File

@ -33,8 +33,8 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"LuaScript_path": "InvestigatorSkillTracker.e598c2.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",

View File

@ -1 +0,0 @@
require("playermat/InvestigatorSkillTracker")

View File

@ -33,8 +33,8 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"LuaScript_path": "InvestigatorSkillTracker.e74881.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",

View File

@ -1 +0,0 @@
require("playermat/InvestigatorSkillTracker")

View File

@ -8,8 +8,8 @@ PLAY_ZONE_SCALE = { x = 36, y = 5.1, z = 14.5 }
DRAW_DECK_POSITION = { x = -54.8, y = 2.5, z = 4.29 } DRAW_DECK_POSITION = { x = -54.8, y = 2.5, z = 4.29 }
DISCARD_PILE_POSITION = { x = -58.9, y = 4, z = 4.29 } DISCARD_PILE_POSITION = { x = -58.9, y = 4, z = 4.29 }
TRASHCAN = getObjectFromGUID("147e80") TRASHCAN_GUID = "147e80"
STAT_TRACKER = getObjectFromGUID("e598c2") STAT_TRACKER_GUID = "e598c2"
RESOURCE_COUNTER = getObjectFromGUID("4406f0") RESOURCE_COUNTER_GUID = "4406f0"
require("playermat/Playmat") require("playermat/Playmat")

View File

@ -8,8 +8,8 @@ PLAY_ZONE_SCALE = { x = 36, y = 5.1, z = 14.5 }
DRAW_DECK_POSITION = { x = -54.86, y = 2.5, z = -27.82 } DRAW_DECK_POSITION = { x = -54.86, y = 2.5, z = -27.82 }
DISCARD_PILE_POSITION = { x = -58.96, y = 4, z = -27.82 } DISCARD_PILE_POSITION = { x = -58.96, y = 4, z = -27.82 }
TRASHCAN = getObjectFromGUID("f7b6c8") TRASHCAN_GUID = "f7b6c8"
STAT_TRACKER = getObjectFromGUID("b4a5f7") STAT_TRACKER_GUID = "b4a5f7"
RESOURCE_COUNTER = getObjectFromGUID("816d84") RESOURCE_COUNTER_GUID = "816d84"
require("playermat/Playmat") require("playermat/Playmat")

View File

@ -8,8 +8,8 @@ PLAY_ZONE_SCALE = { x = 30, y = 5, z = 14.5 }
DRAW_DECK_POSITION = { x = -37.26, y = 2.5, z = 26.4 } DRAW_DECK_POSITION = { x = -37.26, y = 2.5, z = 26.4 }
DISCARD_PILE_POSITION = { x = -37.26, y = 4, z = 30.50 } DISCARD_PILE_POSITION = { x = -37.26, y = 4, z = 30.50 }
TRASHCAN = getObjectFromGUID("5f896a") TRASHCAN_GUID = "5f896a"
STAT_TRACKER = getObjectFromGUID("af7ed7") STAT_TRACKER_GUID = "af7ed7"
RESOURCE_COUNTER = getObjectFromGUID("cd15ac") RESOURCE_COUNTER_GUID = "cd15ac"
require("playermat/Playmat") require("playermat/Playmat")

View File

@ -8,8 +8,8 @@ PLAY_ZONE_SCALE = { x = 30, y = 5, z = 14.5 }
DRAW_DECK_POSITION = { x = -13.78, y = 2.5, z = -26.37 } DRAW_DECK_POSITION = { x = -13.78, y = 2.5, z = -26.37 }
DISCARD_PILE_POSITION = { x = -13.78, y = 4, z = -30.48 } DISCARD_PILE_POSITION = { x = -13.78, y = 4, z = -30.48 }
TRASHCAN = getObjectFromGUID("4b8594") TRASHCAN_GUID = "4b8594"
STAT_TRACKER = getObjectFromGUID("e74881") STAT_TRACKER_GUID = "e74881"
RESOURCE_COUNTER = getObjectFromGUID("a4b60d") RESOURCE_COUNTER_GUID = "a4b60d"
require("playermat/Playmat") require("playermat/Playmat")

View File

@ -1,7 +1,3 @@
---------------------------------------------------------
-- general setup (identical for each playmat)
---------------------------------------------------------
-- set true to enable debug logging and show Physics.cast() -- set true to enable debug logging and show Physics.cast()
local DEBUG = false local DEBUG = false
@ -21,11 +17,13 @@ local DISCARD_BUTTON_OFFSETS = {
} }
local PLAY_ZONE_ROTATION = self.getRotation() local PLAY_ZONE_ROTATION = self.getRotation()
activeInvestigatorId = "00000"
--------------------------------------------------------- local TRASHCAN
-- general code (identical for each playmat) local STAT_TRACKER
--------------------------------------------------------- local RESOURCE_COUNTER
-- global variable so it can be reset by the Clean Up Helper
activeInvestigatorId = "00000"
function onSave() return JSON.encode({zoneID = zoneID, playerColor = PLAYER_COLOR, activeInvestigatorId = activeInvestigatorId}) end function onSave() return JSON.encode({zoneID = zoneID, playerColor = PLAYER_COLOR, activeInvestigatorId = activeInvestigatorId}) end
@ -35,6 +33,10 @@ function onLoad(save_state)
PLAYER_CARDS = DATA_HELPER.getTable('PLAYER_CARD_DATA') PLAYER_CARDS = DATA_HELPER.getTable('PLAYER_CARD_DATA')
PLAYER_CARD_TOKEN_OFFSETS = DATA_HELPER.getTable('PLAYER_CARD_TOKEN_OFFSETS') PLAYER_CARD_TOKEN_OFFSETS = DATA_HELPER.getTable('PLAYER_CARD_TOKEN_OFFSETS')
TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)
STAT_TRACKER = getObjectFromGUID(STAT_TRACKER_GUID)
RESOURCE_COUNTER = getObjectFromGUID(RESOURCE_COUNTER_GUID)
for i = 1, 6 do for i = 1, 6 do
makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], {-3.85, 3, 10.38}, i) makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], {-3.85, 3, 10.38}, i)
end end
@ -203,7 +205,9 @@ function doUpkeep(_, color, alt_click)
if notes.uses ~= nil then if notes.uses ~= nil then
local count = notes.uses[1].count local count = notes.uses[1].count
local replenish = notes.uses[1].replenish local replenish = notes.uses[1].replenish
if count and replenish then replenishTokens(obj, count, replenish) end if count and replenish then
replenishTokens(obj, count, replenish)
end
end end
end end
elseif obj.getDescription() == "Action Token" and obj.is_face_down then elseif obj.getDescription() == "Action Token" and obj.is_face_down then
@ -216,9 +220,9 @@ function doUpkeep(_, color, alt_click)
if activeInvestigatorId ~= nil then if activeInvestigatorId ~= nil then
local miniId = string.match(activeInvestigatorId, "%d%d%d%d%d") .. "-m" local miniId = string.match(activeInvestigatorId, "%d%d%d%d%d") .. "-m"
for _, obj in ipairs(getObjects()) do for _, obj in ipairs(getObjects()) do
if obj.tag == "Card" then if obj.tag == "Card" and obj.is_face_down then
local notes = JSON.decode(obj.getGMNotes()) local notes = JSON.decode(obj.getGMNotes())
if obj.is_face_down and notes ~= nil and notes.type == "Minicard" and (notes.id == miniId or notes.id == "09080-m") then if notes ~= nil and notes.type == "Minicard" and (notes.id == miniId or notes.id == "09080-m") then
obj.flip() obj.flip()
end end
end end
@ -236,11 +240,16 @@ function doUpkeep(_, color, alt_click)
-- draw a card (with handling for Patrice and Forced Learning) -- draw a card (with handling for Patrice and Forced Learning)
if activeInvestigatorId == "06005" then if activeInvestigatorId == "06005" then
local handSize = #Player[PLAYER_COLOR].getHandObjects() if forcedLearning then
if handSize >= 5 then return end printToColor("Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.", messageColor)
local cardsToDraw = 5 - handSize else
printToColor("Drawing " .. cardsToDraw .. " cards (Patrice)", messageColor) local handSize = #Player[PLAYER_COLOR].getHandObjects()
drawCardsWithReshuffle(cardsToDraw) if handSize < 5 then
local cardsToDraw = 5 - handSize
printToColor("Drawing " .. cardsToDraw .. " cards (Patrice)", messageColor)
drawCardsWithReshuffle(cardsToDraw)
end
end
elseif forcedLearning then elseif forcedLearning then
printToColor("Drawing 2 cards, discard 1 (Forced Learning)", messageColor) printToColor("Drawing 2 cards, discard 1 (Forced Learning)", messageColor)
drawCardsWithReshuffle(2) drawCardsWithReshuffle(2)
@ -257,7 +266,6 @@ end
-- draw X cards (shuffle discards if necessary) -- draw X cards (shuffle discards if necessary)
function drawCardsWithReshuffle(numCards) function drawCardsWithReshuffle(numCards)
if type(numCards) ~= "number" then numCards = 1 end
getDrawDiscardDecks() getDrawDiscardDecks()
-- Norman Withers handling -- Norman Withers handling
@ -456,10 +464,8 @@ function spawnTokensFor(object)
spawnTokenGroup(object, token, tokenCount) spawnTokenGroup(object, token, tokenCount)
else else
local data = getPlayerCardData(object) local data = getPlayerCardData(object)
if data == nil then error('attempt to spawn tokens for ' .. object.getName() .. ': no token data') end
token = data['tokenType'] token = data['tokenType']
tokenCount = data['tokenCount'] tokenCount = data['tokenCount']
log(object.getName() .. '[' .. object.getDescription() .. ']' .. ' : ' .. data['tokenType'] .. ' : ' .. data['tokenCount'])
log("Spawning tokens for "..object.getName()..'['..object.getDescription()..']: '..tokenCount.."x "..token) log("Spawning tokens for "..object.getName()..'['..object.getDescription()..']: '..tokenCount.."x "..token)
spawnTokenGroup(object, token, tokenCount) spawnTokenGroup(object, token, tokenCount)
end end
@ -530,10 +536,10 @@ function maybeUpdateActiveInvestigator(card)
for _, obj in ipairs(search) do for _, obj in ipairs(search) do
local obj = obj.hit_object local obj = obj.hit_object
if obj.getDescription() == "Action Token" and obj.getStateId() > 0 then if obj.getDescription() == "Action Token" and obj.getStateId() > 0 then
if self.positionToLocal(obj.getPosition()).x > -0.95 then if obj.getScale().x < 0.4 then
small_token = obj small_token = obj
else else
objState(obj, state_table[notes.class]) setObjectState(obj, state_table[notes.class])
end end
end end
end end
@ -541,26 +547,26 @@ function maybeUpdateActiveInvestigator(card)
-- update the small token with special action for certain investigators -- update the small token with special action for certain investigators
-- Ursula Downs: Investigate action -- Ursula Downs: Investigate action
if activeInvestigatorId == "04002" then if activeInvestigatorId == "04002" then
objState(small_token, 8) setObjectState(small_token, 8)
-- Daisy Walker (only for normal front, not parallel): Tome action -- Daisy Walker (only for normal front, not parallel): Tome action
elseif activeInvestigatorId == "01002" or activeInvestigatorId == "01002-r" or activeInvestigatorId == "01002-pb" then elseif activeInvestigatorId == "01002" or activeInvestigatorId == "01502" or activeInvestigatorId == "01002-pb" then
objState(small_token, 9) setObjectState(small_token, 9)
-- Tony Morgan: Engage/Fight action -- Tony Morgan: Engage/Fight action
elseif activeInvestigatorId == "06003" then elseif activeInvestigatorId == "06003" then
objState(small_token, 10) setObjectState(small_token, 10)
-- Finn Edwards: Evade action -- Finn Edwards: Evade action
elseif activeInvestigatorId == "04003" then elseif activeInvestigatorId == "04003" then
objState(small_token, 11) setObjectState(small_token, 11)
-- Bob Jenkins: Play Item action -- Bob Jenkins: Play Item action
elseif activeInvestigatorId == "08016" then elseif activeInvestigatorId == "08016" then
objState(small_token, 14) setObjectState(small_token, 14)
else else
objState(small_token, state_table[notes.class]) setObjectState(small_token, state_table[notes.class])
end end
end end
end end
function objState(obj, stateId) function setObjectState(obj, stateId)
if obj.getStateId() ~= stateId then obj.setState(stateId) end if obj.getStateId() ~= stateId then obj.setState(stateId) end
end end
@ -580,6 +586,8 @@ function spawnToken(position, tokenType)
Global.call('spawnToken', {position, tokenType, PLAY_ZONE_ROTATION}) Global.call('spawnToken', {position, tokenType, PLAY_ZONE_ROTATION})
end end
-- called by custom data helpers to add player card data
---@param args table Contains only one entry, the GUID of the custom data helper
function updatePlayerCards(args) function updatePlayerCards(args)
local custom_data_helper = getObjectFromGUID(args[1]) local custom_data_helper = getObjectFromGUID(args[1])
data_player_cards = custom_data_helper.getTable("PLAYER_CARD_DATA") data_player_cards = custom_data_helper.getTable("PLAYER_CARD_DATA")