Merge pull request #793 from argonui/tarot

Fixed "Accept your Fate" tarot reading
This commit is contained in:
dscarpac 2024-08-02 13:23:21 -05:00 committed by GitHub
commit 62c8041e16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,15 +12,15 @@ READING = {
}
function onLoad()
self.addContextMenuItem("Chaos", chaos, false)
self.addContextMenuItem("Balance", balance, false)
self.addContextMenuItem("Choice", choice, false)
self.addContextMenuItem("Destiny (Campaign)", destiny, false)
self.addContextMenuItem("Accept Your Fate", fate, false)
self.addContextMenuItem("Chaos", chaos)
self.addContextMenuItem("Balance", balance)
self.addContextMenuItem("Choice", choice)
self.addContextMenuItem("Destiny (Campaign)", destiny)
self.addContextMenuItem("Accept Your Fate", fate)
math.randomseed(os.time())
end
function chaos(color)
function chaos()
self.shuffle()
self.takeObject({
position = self.getPosition() + CARD_OFFSET,
@ -29,7 +29,7 @@ function chaos(color)
})
end
function balance(color)
function balance()
self.shuffle()
for i = 1, 2 do
self.takeObject({
@ -66,9 +66,9 @@ end
function fate(color)
local i = 0
for _, card in ipairs(self.getObjects()) do
for _, reading in ipairs(READING) do
if string.match(card.name, reading) ~= nil then
for _, tarotName in ipairs(READING) do
for _, card in ipairs(self.getObjects()) do
if string.match(card.name, tarotName) ~= nil then
i = i + 1
self.takeObject({
guid = card.guid,
@ -76,6 +76,7 @@ function fate(color)
rotation = ORIENTATIONS[1],
smooth = true
})
break
end
end
end