Draw encounter cards into players hands, instead of threat areas

This commit is contained in:
Adam Goldsmith 2020-11-29 00:06:51 -05:00
parent 1c1a16f37b
commit 9f1f967933
5 changed files with 9 additions and 22 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)