diff --git a/unpacked.ttslua b/unpacked.ttslua index bf9ff0cf1..657299c49 100644 --- a/unpacked.ttslua +++ b/unpacked.ttslua @@ -324,27 +324,18 @@ function isCardOrDeck(x) return x.tag == 'Card' or isDeck(x) end -function drawEncountercard(params) --[[ Parameter Table Position, Table Rotation]] - local position = params[1] - local rotation = params[2] - local isFaceUp = params[3] +function drawEncountercard(color) --[[ Parameter Player color ]] local faceUpRotation - if (isFaceUp) then - faceUpRotation = 0 - else - faceUpRotation = 180 - end local items = findInRadiusBy(ENCOUNTER_DECK_POS, 4, isCardOrDeck) if #items > 0 then for i, v in ipairs(items) do if v.tag == 'Deck' then - v.takeObject({index = 0, position = position, rotation = {0,rotation.y,faceUpRotation}}) + v.deal(1, color) return end end -- we didn't find the deck so just pull the first thing we did find - items[1].setPositionSmooth(position, false, false) - items[1].setRotationSmooth({0,rotation.y,faceUpRotation}, false, false) + items[1].deal(1, color) return end -- nothing here, time to reshuffle @@ -352,11 +343,11 @@ function drawEncountercard(params) --[[ Parameter Table Position, Table Rotation end IS_RESHUFFLING = false -function reshuffleEncounterDeck(position, rotation) +function reshuffleEncounterDeck(color) -- finishes moving the deck back and draws a card local function move(deck) deck.setPositionSmooth(ENCOUNTER_DECK_SPAWN_POS, true, false) - deck.takeObject({index = 0, position = position, rotation = rotation, flip = false}) + deck.deal(1, color) Wait.time(function() IS_RESHUFFLING = false end, 1) end -- bail out if we're mid reshuffle diff --git a/unpacked/Custom_Tile Playermat 1 White 8b081b.ttslua b/unpacked/Custom_Tile Playermat 1 White 8b081b.ttslua index b49bf41d4..df5bd53c6 100644 --- a/unpacked/Custom_Tile Playermat 1 White 8b081b.ttslua +++ b/unpacked/Custom_Tile Playermat 1 White 8b081b.ttslua @@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick) end function drawEncountercard(object, player, isRightClick) -local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET) -Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick}) +Global.call("drawEncountercard", PLAYER_COLOR) end function spawnToken(position, tokenType) diff --git a/unpacked/Custom_Tile Playermat 2 Orange bd0ff4.ttslua b/unpacked/Custom_Tile Playermat 2 Orange bd0ff4.ttslua index c94483537..6df119814 100644 --- a/unpacked/Custom_Tile Playermat 2 Orange bd0ff4.ttslua +++ b/unpacked/Custom_Tile Playermat 2 Orange bd0ff4.ttslua @@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick) end function drawEncountercard(object, player, isRightClick) -local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET) -Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick}) +Global.call("drawEncountercard", PLAYER_COLOR) end function spawnToken(position, tokenType) diff --git a/unpacked/Custom_Tile Playermat 3 Green 383d8b.ttslua b/unpacked/Custom_Tile Playermat 3 Green 383d8b.ttslua index 77cdf233e..6240fbdab 100644 --- a/unpacked/Custom_Tile Playermat 3 Green 383d8b.ttslua +++ b/unpacked/Custom_Tile Playermat 3 Green 383d8b.ttslua @@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick) end function drawEncountercard(object, player, isRightClick) -local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET) -Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick}) +Global.call("drawEncountercard", PLAYER_COLOR) end function spawnToken(position, tokenType) diff --git a/unpacked/Custom_Tile Playermat 4 Red 0840d5.ttslua b/unpacked/Custom_Tile Playermat 4 Red 0840d5.ttslua index 9351f882d..4d20cf51f 100644 --- a/unpacked/Custom_Tile Playermat 4 Red 0840d5.ttslua +++ b/unpacked/Custom_Tile Playermat 4 Red 0840d5.ttslua @@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick) end function drawEncountercard(object, player, isRightClick) -local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET) -Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick}) +Global.call("drawEncountercard", PLAYER_COLOR) end function spawnToken(position, tokenType)