Merge pull request #194 from argonui/weakness-finder
Remove area check when drawing a random weakness
This commit is contained in:
commit
99cf04761e
@ -1,9 +1,3 @@
|
||||
|
||||
-- Position to check for weaknesses. Everything with X and Z less
|
||||
-- than these values (down and right on the table) will be checked
|
||||
local WEAKNESS_CHECK_X = 15
|
||||
local WEAKNESS_CHECK_Z = 37
|
||||
|
||||
local cardIdIndex = { }
|
||||
local classAndLevelIndex = { }
|
||||
local basicWeaknessList = { }
|
||||
@ -311,12 +305,12 @@ function buildAvailableWeaknesses()
|
||||
local weaknessesInPlay = { }
|
||||
local allObjects = getAllObjects()
|
||||
for _, object in ipairs(allObjects) do
|
||||
if (object.name == "Deck" and isInPlayArea(object)) then
|
||||
if (object.name == "Deck") then
|
||||
for _, cardData in ipairs(object.getData().ContainedObjects) do
|
||||
local cardMetadata = JSON.decode(cardData.GMNotes)
|
||||
incrementWeaknessCount(weaknessesInPlay, cardMetadata)
|
||||
end
|
||||
elseif (object.name == "Card" and isInPlayArea(object)) then
|
||||
elseif (object.name == "Card") then
|
||||
local cardMetadata = JSON.decode(object.getGMNotes())
|
||||
incrementWeaknessCount(weaknessesInPlay, cardMetadata)
|
||||
end
|
||||
@ -352,15 +346,6 @@ function incrementWeaknessCount(table, cardMetadata)
|
||||
end
|
||||
end
|
||||
|
||||
function isInPlayArea(object)
|
||||
if (object == nil) then
|
||||
return false
|
||||
end
|
||||
local position = object.getPosition()
|
||||
return position.x < WEAKNESS_CHECK_X
|
||||
and position.z < WEAKNESS_CHECK_Z
|
||||
end
|
||||
|
||||
function isBasicWeakness(cardMetadata)
|
||||
return cardMetadata ~= nil
|
||||
and cardMetadata.weakness
|
||||
|
Loading…
Reference in New Issue
Block a user