Merge pull request #76 from argonui/diana
Add startsInHand handling for the deck loader
This commit is contained in:
commit
12f7ed0e3e
@ -2,6 +2,7 @@
|
|||||||
"id": "05014",
|
"id": "05014",
|
||||||
"type": "Event",
|
"type": "Event",
|
||||||
"class": "Neutral",
|
"class": "Neutral",
|
||||||
|
"startsInHand": true,
|
||||||
"cost": 2,
|
"cost": 2,
|
||||||
"traits": "Insight.",
|
"traits": "Insight.",
|
||||||
"cycle": "The Circle Undone"
|
"cycle": "The Circle Undone"
|
||||||
|
@ -387,7 +387,7 @@ function loadCards(slots, investigatorId, customizations, playerColor, commandMa
|
|||||||
local deckPos = Zones.getZonePosition(playerColor, zone)
|
local deckPos = Zones.getZonePosition(playerColor, zone)
|
||||||
deckPos.y = 3
|
deckPos.y = 3
|
||||||
|
|
||||||
local spreadCallback = nil
|
local callback = nil
|
||||||
-- If cards are spread too close together TTS groups them weirdly, selecting multiples
|
-- If cards are spread too close together TTS groups them weirdly, selecting multiples
|
||||||
-- when hovering over a single card. This distance is the minimum to avoid that
|
-- when hovering over a single card. This distance is the minimum to avoid that
|
||||||
local spreadDistance = 1.15
|
local spreadDistance = 1.15
|
||||||
@ -399,14 +399,16 @@ function loadCards(slots, investigatorId, customizations, playerColor, commandMa
|
|||||||
elseif (playerColor == "Green") then
|
elseif (playerColor == "Green") then
|
||||||
deckPos.x = deckPos.x + (#zoneCards - 1) * spreadDistance
|
deckPos.x = deckPos.x + (#zoneCards - 1) * spreadDistance
|
||||||
end
|
end
|
||||||
spreadCallback = function(deck) deck.spread(spreadDistance) end
|
callback = function(deck) deck.spread(spreadDistance) end
|
||||||
|
elseif zone == "Deck" then
|
||||||
|
callback = function(deck) deckSpawned(deck, playerColor) end
|
||||||
end
|
end
|
||||||
Spawner.spawnCards(
|
Spawner.spawnCards(
|
||||||
zoneCards,
|
zoneCards,
|
||||||
deckPos,
|
deckPos,
|
||||||
Zones.getDefaultCardRotation(playerColor, zone),
|
Zones.getDefaultCardRotation(playerColor, zone),
|
||||||
true, -- Sort deck
|
true, -- Sort deck
|
||||||
spreadCallback)
|
callback)
|
||||||
|
|
||||||
coroutine.yield(0)
|
coroutine.yield(0)
|
||||||
end
|
end
|
||||||
@ -444,6 +446,22 @@ function loadCards(slots, investigatorId, customizations, playerColor, commandMa
|
|||||||
startLuaCoroutine(self, "coinside")
|
startLuaCoroutine(self, "coinside")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Callback handler for the main deck spawning. Looks for cards which should start in hand, and
|
||||||
|
-- draws them for the appropriate player.
|
||||||
|
-- @param deck Callback-provided spawned deck object
|
||||||
|
-- @param playerColor Color of the player to draw the cards to
|
||||||
|
function deckSpawned(deck, playerColor)
|
||||||
|
local handPos = Player[playerColor].getHandTransform(1).position -- Only one hand zone per player
|
||||||
|
local deckCards = deck.getData().ContainedObjects
|
||||||
|
-- Process in reverse order so taking cards out doesn't upset the indexing
|
||||||
|
for i = #deckCards, 1, -1 do
|
||||||
|
local cardMetadata = JSON.decode(deckCards[i].GMNotes) or { }
|
||||||
|
if cardMetadata.startsInHand then
|
||||||
|
deck.takeObject({ index = i - 1, position = handPos, flip = true, smooth = true})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Conver the Raven Quill's selections from card IDs to card names. This could be more elegant
|
-- Conver the Raven Quill's selections from card IDs to card names. This could be more elegant
|
||||||
-- but the inputs are very static so we're using some brute force.
|
-- but the inputs are very static so we're using some brute force.
|
||||||
-- @param An ArkhamDB string indicating the customization selections for The Raven's Quill. Should
|
-- @param An ArkhamDB string indicating the customization selections for The Raven's Quill. Should
|
||||||
|
Loading…
x
Reference in New Issue
Block a user