Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions items/inversions/reverse_tarots.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ local princess = {
use = function(self, card, area, copier)
G.GAME.entr_princess = true
for i, v in ipairs(G.I.CARD) do
if v.config and v.config.center and v.config.center.set == "Planet" and Entropy.FlipsideInversions[v.config.center.key] then
v:set_ability(G.P_CENTERS[Entropy.FlipsideInversions[v.config.center.key]])
if v.config and v.config.center and v.config.center.set == "Planet" and Entropy.Inversion(v.config.center) then
v:set_ability(G.P_CENTERS[Entropy.Inversion(v.config.center)])
end
end
end,
Expand Down Expand Up @@ -229,8 +229,8 @@ local servant = {
use = function(self, card, area, copier)
local cards = Entropy.GetHighlightedCards({G.hand, G.consumeables}, card, 1, card.ability.select)
for i, v in pairs(cards) do
if Entropy.FlipsideInversions[v.config.center.key] then
local set = G.P_CENTERS[Entropy.FlipsideInversions[v.config.center.key]].set
if Entropy.Inversion(v.config.center) then
local set = G.P_CENTERS[Entropy.Inversion(v.config.center)].set
for i = 1, card.ability.create do
G.E_MANAGER:add_event(Event({
func = function()
Expand All @@ -251,7 +251,7 @@ local servant = {
can_use = function(self, card)
local cards = Entropy.GetHighlightedCards({G.hand, G.consumeables}, card, 1, card.ability.select)
local num = #cards
return num > 0 and num <= card.ability.select and Entropy.TableAny(cards, function(value) return Entropy.FlipsideInversions[value.config.center.key] end)
return num > 0 and num <= card.ability.select and Entropy.TableAny(cards, function(value) return Entropy.Inversion(value.config.center) end)
end,
loc_vars = function(self, q, card)
return {
Expand Down
18 changes: 11 additions & 7 deletions lib/hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1827,9 +1827,9 @@ function Card:set_ability(center, initial, delay_sprites)
if G.SETTINGS.paused then
matref(self, center, initial, delay_sprites)
else
if self.config and self.config.center and Entropy.FlipsideInversions and Entropy.FlipsideInversions[self.config.center.key]
if self.config and self.config.center and Entropy.FlipsideInversions and not Entropy.is_inverted(center)
and pseudorandom("marked") < 0.10 and G.GAME.Marked and G.STATE == G.STATES.SHOP and (not self.area or not self.area.config.collection) then
matref(self, G.P_CENTERS[Entropy.FlipsideInversions[self.config.center.key]], initial, delay_sprites)
matref(self, G.P_CENTERS[Entropy.Inversion(center)], initial, delay_sprites)
elseif self.config and self.config.center
and pseudorandom("trump_card") < 0.10 and G.GAME.TrumpCard and G.STATE == G.STATES.SMODS_BOOSTER_OPENED
and TrumpCardAllow[center.set] and (not self.area or not self.area.config.collection) then
Expand Down Expand Up @@ -1868,7 +1868,7 @@ G.FUNCS.use_card = function(e, mute, nosave)
local card = e.config.ref_table
card.ability.bypass_aleph = true
ref(e, mute, nosave)
if Entropy.FlipsideInversions[card.config.center.key] and not Entropy.FlipsidePureInversions[card.config.center.key] and not card.config.center.hidden then
if Entropy.is_inverted(card.config.center) and not card.config.center.hidden then
G.GAME.last_inversion = {
key = card.config.center.key,
set = card.config.center.set
Expand Down Expand Up @@ -1919,8 +1919,12 @@ local set_abilityref = Card.set_ability
function Card:set_ability(center, f, s)
if type(center) == "string" then center = G.P_CENTERS[center] end
if (self.config and self.config.center and self.config.center.key ~= "m_entr_disavowed" and (not self.entr_aleph or self.ability.bypass_aleph)) or G.SETTINGS.paused then
if center and Entropy.FlipsideInversions[center.key] and not G.SETTINGS.paused and (G.GAME.modifiers.entr_twisted or center.set == "Planet" and G.GAME.entr_princess) and not self.multiuse and (not self.ability or not self.ability.fromflipside) then
set_abilityref(self, G.P_CENTERS[Entropy.FlipsideInversions[center.key]] or center, f, s)
if center and Entropy.Inversion(center) and not G.SETTINGS.paused and (G.GAME.modifiers.entr_twisted or center.set == "Planet" and G.GAME.entr_princess) and not self.multiuse and (not self.ability or not self.ability.fromflipside) then
if Entropy.allow_spawning(center) and Entropy.allow_spawning(G.P_CENTERS[Entropy.Inversion(center)]) then
set_abilityref(self, G.P_CENTERS[Entropy.Inversion(center)] or center, f, s)
else
set_abilityref(self, Entropy.GetPooledCenter(G.P_CENTERS[Entropy.Inversion(center)].set), f, s)
end
else
set_abilityref(self, center, f, s)
end
Expand All @@ -1936,7 +1940,7 @@ end
local set_abilityref = Card.set_ability
function Card:set_ability(center, ...)
if type(center) == "string" then center = G.P_CENTERS[center] end
if center and Entropy.FlipsideInversions[center.key] and not Entropy.FlipsidePureInversions[center.key] and G.GAME.next_inversions_prophecy and not G.SETTINGS.paused then
if center and Entropy.is_inverted(center) and G.GAME.next_inversions_prophecy and not G.SETTINGS.paused then
set_abilityref(self, G.P_CENTERS[G.GAME.next_inversions_prophecy], ...)
G.GAME.inversions_prophecy_counter = (G.GAME.inversions_prophecy_counter or 2) - 1
else
Expand All @@ -1954,7 +1958,7 @@ G.FUNCS.use_card = function(e, mute, nosave)
if card.config.center.set ~= "Booster" and Entropy.DeckOrSleeve("doc") then
local num = 1
for i, v in pairs(G.GAME.entr_bought_decks or {}) do if v == "b_entr_doc" or v == "sleeve_entr_doc" then num = num + 1 end end
if Entropy.FlipsideInversions[card.config.center.key] and not Entropy.FlipsidePureInversions[card.config.center.key] then
if Entropy.is_inverted(card.config.center) then
ease_entropy(2*num*Entropy.DeckOrSleeve("doc"))
else
ease_entropy(1*num*Entropy.DeckOrSleeve("doc"))
Expand Down
17 changes: 13 additions & 4 deletions lib/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@ function Entropy.FilterTable(table, func)
end

function Entropy.Inversion(card)
return Entropy.FlipsideInversions[card.config.center.key]
if not card then return end
return Entropy.FlipsideInversions[card.key or card.config.center.key]
end

function Entropy.is_inverted(card)
return Entropy.FlipsideInversions[card.config.center.key] and not Entropy.FlipsidePureInversions[card.config.center.key]
if not card then return end
return Entropy.FlipsideInversions[card.key or card.config.center.key] and not Entropy.FlipsidePureInversions[card.key or card.config.center.key]
end

function Entropy.inversion_queue(card, _c, first_pass)
local info_queue = {}
if Entropy.Inversion(card) and first_pass and Entropy.show_flipside(card, _c) and Entropy.config.inversion_queues > 1 then
if _c.key ~= "c_entr_flipside" then
local inversion = G.P_CENTERS[(Entropy.FlipsideInversions[_c.key] or (_c.ability and Entropy.FlipsideInversions[_c.ability.name]))]
local inversion = G.P_CENTERS[Entropy.Inversion(_c)]
info_queue[#info_queue+1] = {key = "inversion_allowed", set = "Other", vars = {G.localization.descriptions[inversion.set][inversion.key].name}}
if Entropy.config.inversion_queues > 2 then
info_queue[#info_queue+1] = inversion
Expand Down Expand Up @@ -1419,7 +1421,7 @@ function Entropy.get_arrow_color(operator)
return colours[operator]
end

function Entropy.GetPooledCenter(_type)
function Entropy.GetPooledCenter(_type, twisted)
local area = area or G.jokers
local center = G.P_CENTERS.b_red

Expand Down Expand Up @@ -1895,3 +1897,10 @@ function Entropy.get_bg_colour()
end
return G.GAME.entr_alt and G.C.ALTBG or G.C.BLIND['Small']
end

function Entropy.allow_spawning(center)
for i, v in pairs(G.I.CARD) do
if v.config and v.config.center and center and v.config.center.key == center.key then return SMODS.showman(center.key) or nil end
end
return true
end