From 0107355996f4ac74bdb8a87ef7a821229861dd01 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 21 Oct 2023 12:28:42 +0200 Subject: [PATCH] increase same counters instead --- config.json | 1 - objects/ArkhamDeckCutter.445115.json | 45 ---------------------------- src/util/DeckCutter.ttslua | 30 ------------------- src/util/TokenSpawnTool.ttslua | 22 ++++++++++++++ 4 files changed, 22 insertions(+), 76 deletions(-) delete mode 100644 objects/ArkhamDeckCutter.445115.json delete mode 100644 src/util/DeckCutter.ttslua diff --git a/config.json b/config.json index 810bf746..e1e364ce 100644 --- a/config.json +++ b/config.json @@ -127,7 +127,6 @@ "DataHelper.708279", "BlessCurseManager.5933fb", "Notecard.d8d357", - "ArkhamDeckCutter.445115", "ScriptingTrigger.a2f932", "EdgeoftheEarth.895eaa", "TheDream-Eaters.a16a1a", diff --git a/objects/ArkhamDeckCutter.445115.json b/objects/ArkhamDeckCutter.445115.json deleted file mode 100644 index a34b4112..00000000 --- a/objects/ArkhamDeckCutter.445115.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0, - "g": 0, - "r": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "445115", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": true, - "LuaScript": "require(\"util/DeckCutter\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Checker_black", - "Nickname": "Arkham Deck Cutter", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 78, - "posY": 1.208, - "posZ": 6.315, - "rotX": 0, - "rotY": 270, - "rotZ": 180, - "scaleX": 0.25, - "scaleY": 0.25, - "scaleZ": 0.25 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/src/util/DeckCutter.ttslua b/src/util/DeckCutter.ttslua deleted file mode 100644 index 822f72f2..00000000 --- a/src/util/DeckCutter.ttslua +++ /dev/null @@ -1,30 +0,0 @@ --- cut 3 (6) cards from a deck if numpad 1 (2) is pressed -function onScriptingButtonDown(index, player_color) - if not (index >= 1 and index <= 2) then return end - - local count = index * 3 - local player = Player[player_color] - local object = player.getHoverObject() - - if not object then - broadcastToColor("Hover over a deck and try again.", player_color, "Orange") - return - end - if object.tag ~= "Deck" then - broadcastToColor("Hover over a deck and try again.", player_color, "Orange") - return - end - if count >= object.getQuantity() then - broadcastToColor("Deck is too small to cut " .. count .. " cards.", player_color, "Orange") - return - end - - local pos = object.positionToWorld(Vector(0, 0, -3.5)) - for _ = 1, count do - object.takeObject { - index = 0, - position = pos, - smooth = false - } - end -end diff --git a/src/util/TokenSpawnTool.ttslua b/src/util/TokenSpawnTool.ttslua index c0b89257..91193734 100644 --- a/src/util/TokenSpawnTool.ttslua +++ b/src/util/TokenSpawnTool.ttslua @@ -59,6 +59,28 @@ function onScriptingButtonDown(index, playerColor) if stateID ~= nil and stateID ~= 1 then callback = function(spawned) spawned.setState(stateID) end end + -- check hovered object for "resourceCounter" tokens and increase them instead + elseif tokenType == "resourceCounter" then + local hoverObj = Player[playerColor].getHoverObject() + if hoverObj then + if tokenType == hoverObj.getMemo() then + hoverObj.call("addOrSubtract") + return + end + end + -- check hovered object for "damage" and "horror" tokens and increase them instead + elseif tokenType == "damage" or tokenType == "horror" then + local hoverObj = Player[playerColor].getHoverObject() + if hoverObj then + if tokenType == hoverObj.getMemo() then + local stateInfo = hoverObj.getStates() + local stateId = hoverObj.getStateId() + if stateId <= #stateInfo then + hoverObj.setState(stateId + 1) + return + end + end + end end tokenManager.spawnToken(position, tokenType, rotation, callback)