Skip to content

Commit

Permalink
Optimization, bug fixes, mod tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurelius7309 committed Apr 1, 2024
1 parent b8de795 commit a5bc9a3
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 131 deletions.
29 changes: 16 additions & 13 deletions core/joker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SMODS.Joker = {
}

function SMODS.Joker:new(name, slug, config, spritePos, loc_txt, rarity, cost, unlocked, discovered, blueprint_compat,
eternal_compat, effect, atlas)
eternal_compat, effect, atlas, soul_pos)
o = {}
setmetatable(o, self)
self.__index = self
Expand All @@ -31,6 +31,7 @@ function SMODS.Joker:new(name, slug, config, spritePos, loc_txt, rarity, cost, u
x = 0,
y = 0
}
o.soul_pos = soul_pos
o.rarity = rarity or 1
o.cost = cost
o.unlocked = (unlocked == nil) and true or unlocked
Expand All @@ -39,6 +40,8 @@ function SMODS.Joker:new(name, slug, config, spritePos, loc_txt, rarity, cost, u
o.eternal_compat = (eternal_compat == nil) and true or eternal_compat
o.effect = effect or ''
o.atlas = atlas or nil
o.mod_name = SMODS._MOD_NAME
o.badge_colour = SMODS._BADGE_COLOUR
return o
end

Expand Down Expand Up @@ -74,12 +77,13 @@ function SMODS.injectJokers()
effect = joker.effect,
cost = joker.cost,
cost_mult = 1.0,
atlas = joker.atlas or nil
atlas = joker.atlas or nil,
mod_name = joker.mod_name,
badge_colour = joker.badge_colour,
soul_pos = joker.soul_pos
}

for _i, sprite in ipairs(SMODS.Sprites) do
sendDebugMessage(sprite.name)
sendDebugMessage(joker_obj.key)
if sprite.name == joker_obj.key then
joker_obj.atlas = sprite.name
end
Expand Down Expand Up @@ -117,12 +121,12 @@ function Card:calculate_joker(context)
local ret_val = calculate_jokerref(self, context);

if self.ability.set == "Joker" and not self.debuff then
for _k, obj in pairs(SMODS.Jokers) do
if obj.calculate and type(obj.calculate) == "function" and _k == self.config.center.key then
local o = obj.calculate(self, context)
local key = self.config.center.key
local joker_obj = SMODS.Jokers[key]
if joker_obj and joker_obj.calculate and type(joker_obj.calculate) == "function" then
local o = joker_obj.calculate(self, context)
if o then return o end
end
end
end

return ret_val;
Expand All @@ -146,14 +150,13 @@ function Card:generate_UIBox_ability_table()
elseif self.debuff then
elseif card_type == 'Default' or card_type == 'Enhanced' then
elseif self.ability.set == 'Joker' then
sendDebugMessage(inspect(self.config.center))
for k, v in pairs(SMODS.Jokers) do
if v.loc_def and type(v.loc_def) == 'function' and k == self.config.center.key then
local o, m = v.loc_def(self)
local key = self.config.center.key
local joker_obj = SMODS.Jokers[key]
if joker_obj and joker_obj.loc_def and type(joker_obj.loc_def) == 'function' then
local o, m = joker_obj.loc_def(self)
if o and next(o) then loc_vars = o end
if m and next(m) then main_end = m end
end
end
end
if loc_vars then
local badges = {}
Expand Down
8 changes: 5 additions & 3 deletions core/planet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ function SMODS.Planet:new(name, slug, config, pos, loc_txt, cost, cost_mult, eff
o.freq = freq or 1
o.cost_mult = cost_mult or 1.0
o.atlas = atlas
o.mod_name = SMODS._MOD_NAME
o.badge_colour = SMODS._BADGE_COLOUR
return o
end

Expand Down Expand Up @@ -76,12 +78,12 @@ function SMODS.injectPlanets()
effect = planet.effect,
cost_mult = planet.cost_mult,
freq = planet.freq,
atlas = planet.atlas
atlas = planet.atlas,
mod_name = planet.mod_name,
badge_colour = planet.badge_colour
}

for _i, sprite in ipairs(SMODS.Sprites) do
sendDebugMessage(sprite.name)
sendDebugMessage(planet_obj.key)
if sprite.name == planet_obj.key then
planet_obj.atlas = sprite.name
end
Expand Down
2 changes: 1 addition & 1 deletion core/sound.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function register_sound(name, path, filename)
s.original_volume = 0.75
s.sound_code = name

sendDebugMessage("Registered sound " .. name .. " from file " .. filename)
sendDebugMessage("Registered sound " .. name .. " from file " .. filename)
SMODS.SOUND_SOURCES[name] = s
end

Expand Down
8 changes: 5 additions & 3 deletions core/spectral.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function SMODS.Spectral:new(name, slug, config, pos, loc_txt, cost, consumeable,
o.unlocked = true
o.consumeable = consumeable or true
o.atlas = atlas
o.mod_name = SMODS._MOD_NAME
o.badge_colour = SMODS._BADGE_COLOUR
return o
end

Expand Down Expand Up @@ -58,12 +60,12 @@ function SMODS.injectSpectrals()
pos = spectral.pos,
config = spectral.config,
atlas = spectral.atlas,
cost = spectral.cost
cost = spectral.cost,
mod_name = spectral.mod_name,
badge_colour = spectral.badge_colour
}

for _i, sprite in ipairs(SMODS.Sprites) do
sendDebugMessage(sprite.name)
sendDebugMessage(tarot_obj.key)
if sprite.name == tarot_obj.key then
tarot_obj.atlas = sprite.name
end
Expand Down
4 changes: 2 additions & 2 deletions core/sprite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ function SMODS.injectSprites()
else
error("Bad Sprite type")
end

sendDebugMessage("The Sprite named " .. sprite.name .. " with path " .. sprite.path .. " have been registered.")
sendDebugMessage("The Sprite named " .. sprite.name .. " with path " .. sprite.path .. " have been registered.")
end

--Reload Textures
Expand Down
3 changes: 2 additions & 1 deletion core/suit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,8 @@ function SMODS.Card:_extend()
end

function Card:is_face(from_boss)
if self.debuff and not from_boss then return end
if self.debuff and not from_boss then return end
if self:get_id() < 0 then return end
local val = self.base.value
if next(find_joker('Pareidolia')) or (val and SMODS.Card.RANKS[val] and SMODS.Card.RANKS[val].face) then return true end
end
Expand Down
Loading

0 comments on commit a5bc9a3

Please sign in to comment.