added button to reshuffle encounter discard pile into deck
This commit is contained in:
parent
00843ecef4
commit
3e333c3d2d
@ -82,5 +82,5 @@
|
||||
"scaleZ": 6.5
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI": ""
|
||||
"XmlUI": "\u003cInclude src=\"MythosArea.xml\"/\u003e"
|
||||
}
|
||||
|
@ -201,6 +201,27 @@ function reshuffleEncounterDeck(params)
|
||||
Wait.time(function() isReshuffling = false end, 1)
|
||||
end
|
||||
|
||||
function discardIntoDeck()
|
||||
--flag to avoid multiple calls
|
||||
if isReshuffling then return end
|
||||
isReshuffling = true
|
||||
|
||||
-- flip deck and then shuffle
|
||||
local discardPile = searchLib.atPosition(ENCOUNTER_DISCARD_POSITION, "isCardOrDeck")
|
||||
if #discardPile > 0 then
|
||||
local deck = discardPile[1]
|
||||
if not deck.is_face_down then deck.flip() end
|
||||
deck.setPositionSmooth(Vector(ENCOUNTER_DECK_POS) + Vector(0, 2, 0), false, true)
|
||||
--wait until deck is in place .75 seconds, then shuffle
|
||||
broadcastToAll("Shuffled encounter discard into deck.", "White")
|
||||
Wait.time(function() searchLib.atPosition(ENCOUNTER_DECK_POS, "isCardOrDeck")[1].shuffle() end, .75)
|
||||
else
|
||||
broadcastToAll("Encounter discard pile is already empty.", "Red")
|
||||
end
|
||||
|
||||
-- disable flag
|
||||
Wait.time(function() isReshuffling = false end, 1)
|
||||
end
|
||||
---------------------------------------------------------
|
||||
-- helper functions
|
||||
---------------------------------------------------------
|
||||
|
10
xml/MythosArea.xml
Normal file
10
xml/MythosArea.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<Panel
|
||||
position="124 40 -13"
|
||||
rotation="0 0 180"
|
||||
height="74" width="74">
|
||||
|
||||
|
||||
<Button scale="0.1 0.1 1" fontsize="62" onClick="discardIntoDeck">➡</Button>
|
||||
|
||||
|
||||
</Panel>
|
Loading…
Reference in New Issue
Block a user