fixed "Accept your Fate" tarot reading

This commit is contained in:
Chr1Z93 2024-08-02 10:01:01 +02:00
parent 1b03926cb2
commit 1faacc2128

View File

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