Draw encounter cards into players hands, instead of threat areas
This commit is contained in:
parent
1c1a16f37b
commit
9f1f967933
@ -324,27 +324,18 @@ function isCardOrDeck(x)
|
|||||||
return x.tag == 'Card' or isDeck(x)
|
return x.tag == 'Card' or isDeck(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawEncountercard(params) --[[ Parameter Table Position, Table Rotation]]
|
function drawEncountercard(color) --[[ Parameter Player color ]]
|
||||||
local position = params[1]
|
|
||||||
local rotation = params[2]
|
|
||||||
local isFaceUp = params[3]
|
|
||||||
local faceUpRotation
|
local faceUpRotation
|
||||||
if (isFaceUp) then
|
|
||||||
faceUpRotation = 0
|
|
||||||
else
|
|
||||||
faceUpRotation = 180
|
|
||||||
end
|
|
||||||
local items = findInRadiusBy(ENCOUNTER_DECK_POS, 4, isCardOrDeck)
|
local items = findInRadiusBy(ENCOUNTER_DECK_POS, 4, isCardOrDeck)
|
||||||
if #items > 0 then
|
if #items > 0 then
|
||||||
for i, v in ipairs(items) do
|
for i, v in ipairs(items) do
|
||||||
if v.tag == 'Deck' then
|
if v.tag == 'Deck' then
|
||||||
v.takeObject({index = 0, position = position, rotation = {0,rotation.y,faceUpRotation}})
|
v.deal(1, color)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- we didn't find the deck so just pull the first thing we did find
|
-- we didn't find the deck so just pull the first thing we did find
|
||||||
items[1].setPositionSmooth(position, false, false)
|
items[1].deal(1, color)
|
||||||
items[1].setRotationSmooth({0,rotation.y,faceUpRotation}, false, false)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- nothing here, time to reshuffle
|
-- nothing here, time to reshuffle
|
||||||
@ -352,11 +343,11 @@ function drawEncountercard(params) --[[ Parameter Table Position, Table Rotation
|
|||||||
end
|
end
|
||||||
|
|
||||||
IS_RESHUFFLING = false
|
IS_RESHUFFLING = false
|
||||||
function reshuffleEncounterDeck(position, rotation)
|
function reshuffleEncounterDeck(color)
|
||||||
-- finishes moving the deck back and draws a card
|
-- finishes moving the deck back and draws a card
|
||||||
local function move(deck)
|
local function move(deck)
|
||||||
deck.setPositionSmooth(ENCOUNTER_DECK_SPAWN_POS, true, false)
|
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)
|
Wait.time(function() IS_RESHUFFLING = false end, 1)
|
||||||
end
|
end
|
||||||
-- bail out if we're mid reshuffle
|
-- bail out if we're mid reshuffle
|
||||||
|
@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function drawEncountercard(object, player, isRightClick)
|
function drawEncountercard(object, player, isRightClick)
|
||||||
local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)
|
Global.call("drawEncountercard", PLAYER_COLOR)
|
||||||
Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawnToken(position, tokenType)
|
function spawnToken(position, tokenType)
|
||||||
|
@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function drawEncountercard(object, player, isRightClick)
|
function drawEncountercard(object, player, isRightClick)
|
||||||
local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)
|
Global.call("drawEncountercard", PLAYER_COLOR)
|
||||||
Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawnToken(position, tokenType)
|
function spawnToken(position, tokenType)
|
||||||
|
@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function drawEncountercard(object, player, isRightClick)
|
function drawEncountercard(object, player, isRightClick)
|
||||||
local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)
|
Global.call("drawEncountercard", PLAYER_COLOR)
|
||||||
Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawnToken(position, tokenType)
|
function spawnToken(position, tokenType)
|
||||||
|
@ -396,8 +396,7 @@ function drawChaostokenButton(object, player, isRightClick)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function drawEncountercard(object, player, isRightClick)
|
function drawEncountercard(object, player, isRightClick)
|
||||||
local toPosition = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)
|
Global.call("drawEncountercard", PLAYER_COLOR)
|
||||||
Global.call("drawEncountercard", {toPosition, self.getRotation(), isRightClick})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawnToken(position, tokenType)
|
function spawnToken(position, tokenType)
|
||||||
|
Loading…
Reference in New Issue
Block a user