updated hand zone handling for heleprs
This commit is contained in:
parent
7f9e6292fd
commit
2d828ee4db
@ -201,15 +201,19 @@ function onObjectEnterZone(zone, object)
|
||||
local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, "Trash")
|
||||
trash.putObject(object)
|
||||
elseif zone.type == "Hand" and object.type == "Card" then
|
||||
-- make sure the card is face-up
|
||||
if object.is_face_down then
|
||||
object.flip()
|
||||
end
|
||||
|
||||
-- disable any helpers on the card
|
||||
if object.hasTag("CardWithHelper") then
|
||||
object.clearContextMenu()
|
||||
object.call("shutOff")
|
||||
object.call("setHelperState", false)
|
||||
end
|
||||
|
||||
-- maybe reset data about sealed tokens (if that function exists)
|
||||
if object.hasTag("CardThatSeals") then
|
||||
local func = object.getVar("resetSealedTokens") -- check if function exists (it won't for older custom content)
|
||||
local func = object.getVar("resetSealedTokens")
|
||||
if func ~= nil then
|
||||
object.call("resetSealedTokens")
|
||||
end
|
||||
@ -222,9 +226,12 @@ function onObjectLeaveZone(zone, object)
|
||||
-- 1 frame delay to avoid error messages when exiting the game
|
||||
Wait.frames(
|
||||
function()
|
||||
-- end here if one of the objects doesn't exist
|
||||
if zone.isDestroyed() or object.isDestroyed() then return end
|
||||
|
||||
-- resync the state of the helper on the card with the option panel
|
||||
if zone.type == "Hand" and object.hasTag("CardWithHelper") then
|
||||
object.call("updateDisplay")
|
||||
object.call("syncDisplayWithOptionPanel")
|
||||
end
|
||||
end, 1)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user