harbinger handling
This commit is contained in:
parent
4594629d5e
commit
c88fb47647
@ -118,6 +118,20 @@ function startSearch(messageColor, number)
|
||||
return
|
||||
end
|
||||
|
||||
-- check for harbinger
|
||||
local harbinger
|
||||
if deckAreaObjects.topCard then
|
||||
harbinger = isHarbinger(deckAreaObjects.topCard.getGMNotes())
|
||||
elseif deckAreaObjects.draw and not deckAreaObjects.draw.is_face_down then
|
||||
local cards = deckAreaObjects.draw.getObjects()
|
||||
harbinger = isHarbinger(cards[#cards].gm_notes)
|
||||
end
|
||||
|
||||
if harbinger then
|
||||
printToColor("The Harbinger is on top of your deck, searching isn't allowed", messageColor)
|
||||
return
|
||||
end
|
||||
|
||||
-- get bounds to know the height of the deck
|
||||
local bounds = deckAreaObjects.draw.getBounds()
|
||||
drawDeckPosition = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)
|
||||
@ -170,6 +184,11 @@ function startSearch(messageColor, number)
|
||||
end
|
||||
end
|
||||
|
||||
function isHarbinger(notes)
|
||||
local md = JSON.decode(notes or "") or {}
|
||||
return md.id == "08006"
|
||||
end
|
||||
|
||||
-- place handCards back into deck and optionally shuffle
|
||||
function endSearch(_, _, isRightClick)
|
||||
local handCards = Player[handColor].getHandObjects()
|
||||
|
@ -438,14 +438,12 @@ function drawCardsWithReshuffle(numCards)
|
||||
local deckAreaObjects = getDeckAreaObjects()
|
||||
|
||||
-- Norman Withers handling
|
||||
local harbinger = false
|
||||
if deckAreaObjects.topCard and deckAreaObjects.topCard.getName() == "The Harbinger" then
|
||||
harbinger = true
|
||||
local harbinger
|
||||
if deckAreaObjects.topCard then
|
||||
harbinger = isHarbinger(deckAreaObjects.topCard.getGMNotes())
|
||||
elseif deckAreaObjects.draw and not deckAreaObjects.draw.is_face_down then
|
||||
local cards = deckAreaObjects.draw.getObjects()
|
||||
if cards[#cards].name == "The Harbinger" then
|
||||
harbinger = true
|
||||
end
|
||||
harbinger = isHarbinger(cards[#cards].gm_notes)
|
||||
end
|
||||
|
||||
if harbinger then
|
||||
@ -491,6 +489,11 @@ function drawCardsWithReshuffle(numCards)
|
||||
end
|
||||
end
|
||||
|
||||
function isHarbinger(notes)
|
||||
local md = JSON.decode(notes or "") or {}
|
||||
return md.id == "08006"
|
||||
end
|
||||
|
||||
-- get the draw deck and discard pile objects and returns the references
|
||||
---@return table: string-indexed table with references to the found objects
|
||||
function getDeckAreaObjects()
|
||||
|
Loading…
Reference in New Issue
Block a user