diff --git a/lib/hooks.lua b/lib/hooks.lua index 4f395aec..bc4ba7dc 100644 --- a/lib/hooks.lua +++ b/lib/hooks.lua @@ -1163,8 +1163,11 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable end end if card and card.ability and card.ability.consumeable then - for i, a in pairs(SMODS.get_card_areas('jokers')) do - for _, c in pairs(a.cards) do + local _joker_areas = SMODS.get_card_areas('jokers') + if _joker_areas then + for i, a in pairs(_joker_areas) do + if a.cards then + for _, c in pairs(a.cards) do if c.config.center.calculate then local ret = c.config.center:calculate(c, { get_consumable_type = true, @@ -1183,8 +1186,10 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable break end end + end end end + end end if card and card.ability and card.ability.consumeable then SMODS.calculate_context{entr_consumable_created = true, other_card = card} @@ -2157,14 +2162,19 @@ local add_tagref = add_tag function add_tag(_tag, ...) if type(_tag) == "table" then if not _tag.ability.added_to_deck then - for i, v in pairs(SMODS.get_card_areas('jokers')) do - for a, card in pairs(v.cards) do + local _joker_areas = SMODS.get_card_areas('jokers') + if _joker_areas then + for i, v in pairs(_joker_areas) do + if v.cards then + for a, card in pairs(v.cards) do local res = card:calculate_joker({tag_create = true, tag = _tag}) if res and res.tag then _tag = res.tag end + end end end + end end add_tagref(_tag, ...) _tag.ability.added_to_deck = true @@ -3119,13 +3129,18 @@ function Cryptid.get_interest(add_rows) local rate = Cryptid.interest_rate() local interest = math.min(math.floor(G.GAME.dollars / rate), G.GAME.interest_cap / 5) interest = interest * G.GAME.interest_amount - for _, a in pairs(SMODS.get_card_areas("jokers")) do - for i, c in pairs(a.cards) do + local _joker_areas = SMODS.get_card_areas("jokers") + if _joker_areas then + for _, a in pairs(_joker_areas) do + if a.cards then + for i, c in pairs(a.cards) do if c.config.center.cry_calc_interest then interest = c.config.center:cry_calc_interest(c, interest) end + end end end + end G.GAME.interest_cap = cap return interest end @@ -3901,4 +3916,4 @@ function Spectrallib.card_eval_status_text_eq(card, eval_type, amt, percent, dir return end orig_ref(card, eval_type, amt, percent, dir, extra, pref, col, sound, vol, ta) -end \ No newline at end of file +end