diff --git a/Pokermon.json b/Pokermon.json index e55bb919..edd60d6d 100644 --- a/Pokermon.json +++ b/Pokermon.json @@ -11,8 +11,8 @@ "display_name": "Pokermon", "version": "2.9.1-412a", "dependencies": [ - "Steamodded (>=1.0.0~BETA-0323a)", - "Lovely (>=0.6)" + "Steamodded (>=1.0.0~BETA-0406a)", + "Lovely (>=0.6)" ], "conflicts": [], "provides": [], diff --git a/consumables/mart1.lua b/consumables/mart1.lua index 4a339e34..9d24330e 100644 --- a/consumables/mart1.lua +++ b/consumables/mart1.lua @@ -725,7 +725,7 @@ local nightmare = { end end, can_use = function(self, card) - return G.jokers.highlighted and #G.jokers.highlighted == 1 and has_type(G.jokers.highlighted[1]) and not G.jokers.highlighted[1].ability.eternal + return G.jokers.highlighted and #G.jokers.highlighted == 1 and get_type(G.jokers.highlighted[1]) and not G.jokers.highlighted[1].ability.eternal end, } diff --git a/functions/energyfunctions.lua b/functions/energyfunctions.lua index 03b5bba9..603aa078 100644 --- a/functions/energyfunctions.lua +++ b/functions/energyfunctions.lua @@ -6,12 +6,25 @@ energy_values = { energy_max = 3 +energy_use_backend = function(self, card, area, copier, opts) + opts = opts or {} + local choice = nil + if G.jokers.highlighted and #G.jokers.highlighted == 1 then + choice = G.jokers.highlighted[1] + end + if not opts.check_only then + G.GAME.energies_used = (G.GAME.energies_used or 0) + 1 + set_spoon_item(card) + end + -- todo +end + highlighted_energy_can_use = function(self, card) if not G.jokers.highlighted or #G.jokers.highlighted ~= 1 then return false end local choice = G.jokers.highlighted[1] if energy_matches(choice, self.etype, true) then if type(choice.ability.extra) == "table" then - if (pokermon_config.unlimited_energy or ((choice.ability.extra.energy_count or 0) + (choice.ability.extra.c_energy_count or 0)) < energy_max + (G.GAME.energy_plus or 0)) then + if (pokermon_config.unlimited_energy or ((choice.ability.energy_count or 0) + (choice.ability.c_energy_count or 0)) < energy_max + (G.GAME.energy_plus or 0)) then for name, _ in pairs(energy_values) do if type(choice.ability.extra[name]) == "number" then return true @@ -44,7 +57,7 @@ highlighted_energy_use = function(self, card, area, copier) set_spoon_item(card) if (energy_matches(choice, self.etype, true) or self.etype == "Trans") then if type(choice.ability.extra) == "table" then - if (pokermon_config.unlimited_energy) or (((choice.ability.extra.energy_count or 0) + (choice.ability.extra.c_energy_count or 0)) < energy_max + (G.GAME.energy_plus or 0)) then + if (pokermon_config.unlimited_energy) or (((choice.ability.energy_count or 0) + (choice.ability.c_energy_count or 0)) < energy_max + (G.GAME.energy_plus or 0)) then for name, _ in pairs(energy_values) do if type(choice.ability.extra[name]) == "number" then viable = true @@ -60,17 +73,17 @@ highlighted_energy_use = function(self, card, area, copier) if viable then if type(choice.ability.extra) == "table" then if (energy_matches(choice, self.etype, false) or self.etype == "Trans") then - if choice.ability.extra.energy_count then - choice.ability.extra.energy_count = choice.ability.extra.energy_count + 1 + if choice.ability.energy_count then + choice.ability.energy_count = choice.ability.energy_count + 1 else - choice.ability.extra.energy_count = 1 + choice.ability.energy_count = 1 end energize(choice, false) elseif self.etype == "Colorless" then - if choice.ability.extra.c_energy_count then - choice.ability.extra.c_energy_count = choice.ability.extra.c_energy_count + 1 + if choice.ability.c_energy_count then + choice.ability.c_energy_count = choice.ability.c_energy_count + 1 else - choice.ability.extra.c_energy_count = 1 + choice.ability.c_energy_count = 1 end energize(choice, self.etype, false) end @@ -114,20 +127,8 @@ round_energy_value = function(value, field) end energy_matches = function(card, etype, include_colorless) - if card.ability and card.ability.extra and type(card.ability.extra) == "table" then - if (card.ability.extra.ptype and etype and card.ability.extra.ptype == etype and not type_sticker_applied(card)) or (card.ability[string.lower(etype).."_sticker"]) then - return true - elseif etype == "Colorless" and (card.ability.extra.ptype or type_sticker_applied(card)) and include_colorless then - return true - end - elseif card.ability and (card.ability.extra and type(card.ability.extra) == "number") or (card.ability.mult and card.ability.mult > 0) or (card.ability.t_mult and card.ability.t_mult > 0) or - (card.ability.t_chips and card.ability.t_chips > 0) or (card.ability.x_mult and card.ability.x_mult > 1) then - if card.ability[string.lower(etype).."_sticker"] then - return true - elseif etype == "Colorless" and type_sticker_applied(card) and include_colorless then - return true - end - end + if get_type(card) == etype then return true end + if include_colorless and etype == "Colorless" and get_type(card) then return true end return false end @@ -158,10 +159,35 @@ set_frac = function(card, frac, field, increased, ratio) end end +-- todo +-- Try to increment a card's energy_count/c_energy_count. +-- Automatically updates card values accordingly. +try_increment_energy_count = function(card, inc_energy_table, opts) +end + +-- todo +-- Update all of card's values according to how much energy it has. +update_card_with_energy = function(card) + opts = opts or {} + local rounded = nil + local frac = nil + if type(card.ability.extra) == "table" then + end +end + +-- todo +-- Helper function for update_card_with_energy. +-- +-- Update `card.ability[k1][k2]...` according to the amount of energy `card` has. +-- k is a list of keys to go down. +-- Calculated by multiplying the value from `card.config.center.config` +-- by a factor, see implementation. +update_value_with_energy = function(card, k) +end + energize = function(card, etype, evolving, silent) local rounded = nil local frac = nil - local frac_added = nil if type(card.ability.extra) == "table" then for name, _ in pairs(energy_values) do local data = card.ability.extra[name] @@ -172,9 +198,9 @@ energize = function(card, etype, evolving, silent) if name == "mult_mod" or name == "chip_mod" then previous_mod = card.ability.extra[name] end if evolving then if card.ability.extra.ptype ~= "Colorless" and not card.ability.colorless_sticker then - addition = (addition * (card.ability.extra.energy_count or 0)) + (addition/2 * (card.ability.extra.c_energy_count or 0)) + addition = (addition * (card.ability.energy_count or 0)) + (addition/2 * (card.ability.c_energy_count or 0)) else - addition = (addition * ((card.ability.extra.energy_count or 0) + (card.ability.extra.c_energy_count or 0))) + addition = (addition * ((card.ability.energy_count or 0) + (card.ability.c_energy_count or 0))) end card.ability.extra[name] = data + (card.config.center.config.extra[name] * addition) * (card.ability.extra.escale or 1) updated_mod = card.ability.extra[name] @@ -267,15 +293,8 @@ energize = function(card, etype, evolving, silent) end get_total_energy = function(card) - local curr_energy_count = nil - local curr_c_energy_count = nil - if card.ability.extra and type(card.ability.extra) == "table" then - curr_energy_count = card.ability.extra.energy_count or 0 - curr_c_energy_count = card.ability.extra.c_energy_count or 0 - else - curr_energy_count = card.ability.energy_count or 0 - curr_c_energy_count = card.ability.c_energy_count or 0 - end + local curr_energy_count = card.ability.energy_count or 0 + local curr_c_energy_count = card.ability.c_energy_count or 0 return curr_energy_count + curr_c_energy_count end @@ -287,17 +306,17 @@ end increment_energy = function(card, etype) if card.ability.extra and type(card.ability.extra) == "table" then if (energy_matches(card, etype, false) or etype == "Trans") then - if card.ability.extra.energy_count then - card.ability.extra.energy_count = card.ability.extra.energy_count + 1 + if card.ability.energy_count then + card.ability.energy_count = card.ability.energy_count + 1 else - card.ability.extra.energy_count = 1 + card.ability.energy_count = 1 end energize(card, false) elseif etype == "Colorless" then - if card.ability.extra.c_energy_count then - card.ability.extra.c_energy_count = card.ability.extra.c_energy_count + 1 + if card.ability.c_energy_count then + card.ability.c_energy_count = card.ability.c_energy_count + 1 else - card.ability.extra.c_energy_count = 1 + card.ability.c_energy_count = 1 end energize(card, etype, false) end @@ -364,7 +383,7 @@ energy_can_use = function(self, card) for k, v in pairs(G.jokers.cards) do if energy_matches(v, self.etype, true) then if type(v.ability.extra) == "table" then - if (pokermon_config.unlimited_energy or ((v.ability.extra.energy_count or 0) + (v.ability.extra.c_energy_count or 0)) < energy_max + (G.GAME.energy_plus or 0)) then + if (pokermon_config.unlimited_energy or ((v.ability.energy_count or 0) + (v.ability.c_energy_count or 0)) < energy_max + (G.GAME.energy_plus or 0)) then for name, _ in pairs(energy_values) do local data = v.ability.extra[name] if type(data) == "number" then @@ -387,26 +406,18 @@ energy_can_use = function(self, card) return false end -matching_energy = function(card) - local poketype_list = {"grass", "fire", "water", "lightning", "psychic", "fighting", "colorless", "dark", "metal", "fairy", "dragon", "earth"} - if card.ability.extra and type(card.ability.extra) == "table" and card.ability.extra.ptype and card.ability.extra.ptype ~= "Bird" and not type_sticker_applied(card) then - if card.ability.extra.ptype == "Dark" or card.ability.extra.ptype == "dark" then - return "c_poke_"..string.lower(card.ability.extra.ptype).."ness_energy" - else - return "c_poke_"..string.lower(card.ability.extra.ptype).."_energy" - end - end - for l, v in pairs(poketype_list) do - if card.ability[v.."_sticker"] then - if v == "dark" then - return "c_poke_"..v.."ness_energy" - else - return "c_poke_"..v.."_energy" - end - end +energy_from_type = function(type) + if type == "Dark" then + return "c_poke_darkness_energy" + elseif is_poketype(type) then + return "c_poke_"..string.lower(type).."_energy" end end +matching_energy = function(card) + return energy_from_type(get_type(card)) +end + ease_poke_dollars = function(card, seed, amt, calc_only) local earned = amt if card.ability.extra and type(card.ability.extra) == "table" then diff --git a/functions/pokefunctions.lua b/functions/pokefunctions.lua index abf8a9fa..01a60197 100644 --- a/functions/pokefunctions.lua +++ b/functions/pokefunctions.lua @@ -132,43 +132,47 @@ extended_family = { tauros = {"miltank"} } +poketype_list = { + "Grass", + "Fire", + "Water", + "Lightning", + "Psychic", + "Fighting", + "Colorless", + "Dark", + "Metal", + "Fairy", + "Dragon", + "Earth" +} + +is_poketype_table = {} +for _, v in ipairs(poketype_list) do + is_poketype_table[v] = true +end + +is_poketype = function(s) + return is_poketype_table[s] +end + type_sticker_applied = function(card) - if not card then return false end - if card.ability.grass_sticker then - return "Grass" - elseif card.ability.fire_sticker then - return "Fire" - elseif card.ability.water_sticker then - return "Water" - elseif card.ability.lightning_sticker then - return "Lightning" - elseif card.ability.psychic_sticker then - return "Psychic" - elseif card.ability.fighting_sticker then - return "Fighting" - elseif card.ability.colorless_sticker then - return "Colorless" - elseif card.ability.dark_sticker then - return "Dark" - elseif card.ability.metal_sticker then - return "Metal" - elseif card.ability.fairy_sticker then - return "Fairy" - elseif card.ability.dragon_sticker then - return "Dragon" - elseif card.ability.earth_sticker then - return "Earth" - else - return false + if not card then return nil end + local ret = nil + for _, v in ipairs(poketype_list) do + if card.ability[string.lower(v)..'_sticker'] then + assert(not ret, "Pokermon error: card has two type stickers") + ret = v + end end - + return ret end find_pokemon_type = function(target_type) local found = {} if G.jokers and G.jokers.cards then for k, v in pairs(G.jokers.cards) do - if v.ability and ((v.ability.extra and type(v.ability.extra) == "table" and target_type == v.ability.extra.ptype) or v.ability[string.lower(target_type).."_sticker"]) then + if get_type(v) == target_type then table.insert(found, v) end end @@ -176,14 +180,6 @@ find_pokemon_type = function(target_type) return found end -is_type = function(card, target_type) - if card.ability and ((card.ability.extra and type(card.ability.extra) == "table" and target_type == card.ability.extra.ptype) or card.ability[string.lower(target_type).."_sticker"]) then - return true - else - return false - end -end - get_type = function(card) if card.ability then local sticker = type_sticker_applied(card) @@ -196,10 +192,6 @@ get_type = function(card) return nil end -has_type = function(card) - return (card.ability and card.ability.extra and type(card.ability.extra) == "table" and card.ability.extra.ptype) or type_sticker_applied(card) -end - copy_scaled_values = function(card) local values = {mult = 0, chips = 0, Xmult = 0, money = 0} if card.ability and card.ability.extra and type(card.ability.extra) == "table" then @@ -284,8 +276,6 @@ poke_backend_evolve = function(card, to_key) local new_card = G.P_CENTERS[to_key] if card.config.center == new_card then return end - local old_key = card.config.center.key - -- if it's not a mega and not a devolution and still has rounds left, reset perish tally if card.ability.perishable and card.config.center.rarity ~= "poke_mega" and not card.ability.extra.devolved and card.ability.perish_tally > 0 then card.ability.perish_tally = G.GAME.perishable_rounds @@ -326,7 +316,7 @@ poke_backend_evolve = function(card, to_key) end end end - if card.ability.extra.energy_count or card.ability.extra.c_energy_count then + if card.ability.energy_count or card.ability.c_energy_count then energize(card, nil, true, true) end end @@ -355,18 +345,6 @@ poke_backend_evolve = function(card, to_key) G.P_CENTERS.e_poke_shiny.on_load(card) end end - - -- can be removed once this PR has been merged: - -- https://github.com/Steamodded/smods/pull/611 - local to_fix = {} - for k,_ in pairs(G.GAME.used_jokers) do - if not next(SMODS.find_card(k, true)) then - table.insert(to_fix, k) - end - end - for _,k in pairs(to_fix) do - G.GAME.used_jokers[k] = nil - end end can_evolve = function(self, card, context, forced_key, ignore_step, allow_level) @@ -808,8 +786,8 @@ type_tooltip = function(self, info_queue, center) if center.ability.extra and type(center.ability.extra) == "table" and center.ability.extra.ptype and not type_sticker_applied(center) then info_queue[#info_queue+1] = {set = 'Other', key = center.ability.extra.ptype} end - if (center.ability and center.ability.extra and type(center.ability.extra) == "table" and ((center.ability.extra.energy_count or 0) + (center.ability.extra.c_energy_count or 0) > 0)) then - info_queue[#info_queue+1] = {set = 'Other', key = "energy", vars = {(center.ability.extra.energy_count or 0) + (center.ability.extra.c_energy_count or 0), energy_max + (G.GAME.energy_plus or 0)}} + if (center.ability and center.ability.extra and type(center.ability.extra) == "table" and ((center.ability.energy_count or 0) + (center.ability.c_energy_count or 0) > 0)) then + info_queue[#info_queue+1] = {set = 'Other', key = "energy", vars = {(center.ability.energy_count or 0) + (center.ability.c_energy_count or 0), energy_max + (G.GAME.energy_plus or 0)}} if center.ability.money_frac and center.ability.money_frac > 0 then percent = tonumber(string.format('%.3f', center.ability.money_frac)) * 100 if percent ~= 100 and percent ~= 0 then @@ -852,49 +830,41 @@ type_tooltip = function(self, info_queue, center) end apply_type_sticker = function(card, sticker_type) - local poketype_list = {"Grass", "Fire", "Water", "Lightning", "Psychic", "Fighting", "Colorless", "Dark", "Metal", "Fairy", "Dragon", "Earth"} - local apply_type = nil - - if sticker_type then - apply_type = sticker_type - card.ability[string.lower(apply_type).."_sticker"] = true - else - apply_type = pseudorandom_element(poketype_list, pseudoseed("tera")) - card.ability[string.lower(apply_type).."_sticker"] = true + if not sticker_type then + sticker_type = pseudorandom_element(poketype_list, pseudoseed("tera")) end - for l, v in pairs(poketype_list) do - if string.lower(v) ~= string.lower(apply_type) then + if not sticker_type then return end + card.ability[string.lower(sticker_type).."_sticker"] = true + for _, v in ipairs(poketype_list) do + if v ~= sticker_type then card.ability[string.lower(v).."_sticker"] = false end end - if card.ability and card.ability.extra and type(card.ability.extra) == "table" and card.ability.extra.ptype then - card.ability.extra.ptype = apply_type - end - - if card.config and type(card.config) == "table" and card.config.center and type(card.config.center) == "table" and not card.config.center.stage - and not G.P_CENTERS[card.config.center_key].taken_ownership then - if G.P_CENTERS[card.config.center_key].loc_vars and type(G.P_CENTERS[card.config.center_key].loc_vars) == "function" then - local lv = G.P_CENTERS[card.config.center_key].loc_vars - SMODS.Joker:take_ownership(card.config.center_key, { - unlocked = true, - discovered = true, - loc_vars = function(self, info_queue, center) - type_tooltip(self, info_queue, center) - return lv(self, info_queue, center) - end, - }, true) - else - SMODS.Joker:take_ownership(card.config.center_key, { - unlocked = true, - discovered = true, - loc_vars = function(self, info_queue, center) - type_tooltip(self, info_queue, center) - end, - }, true) - end - end + -- TODO make these take_ownership calls unnecessary by patching + -- if card.config and type(card.config) == "table" and card.config.center and type(card.config.center) == "table" and not card.config.center.stage + -- and not G.P_CENTERS[card.config.center_key].taken_ownership then + -- if G.P_CENTERS[card.config.center_key].loc_vars and type(G.P_CENTERS[card.config.center_key].loc_vars) == "function" then + -- local lv = G.P_CENTERS[card.config.center_key].loc_vars + -- SMODS.Joker:take_ownership(card.config.center_key, { + -- unlocked = true, + -- discovered = true, + -- loc_vars = function(self, info_queue, center) + -- type_tooltip(self, info_queue, center) + -- return lv(self, info_queue, center) + -- end, + -- }, true) + -- else + -- SMODS.Joker:take_ownership(card.config.center_key, { + -- unlocked = true, + -- discovered = true, + -- loc_vars = function(self, info_queue, center) + -- type_tooltip(self, info_queue, center) + -- end, + -- }, true) + -- end + -- end end get_random_poke_key = function(pseed, stage, pokerarity, area, poketype, exclude_keys) @@ -1005,23 +975,12 @@ add_target_cards_to_vars = function(vars, targets) end find_other_poke_or_energy_type = function(card, poke_type, count_self) - local energy = nil - local type_count = 0 - if string.lower(poke_type) == "dark" then - energy = "darkness_energy" - else - energy = string.lower(poke_type).."_energy" - end - type_count = #find_pokemon_type(poke_type) - if is_type(card, poke_type) and not count_self then + local energy = energy_from_type(poke_type) + local type_count = #find_pokemon_type(poke_type) + if get_type(card) == poke_type and not count_self then type_count = type_count - 1 end - - if type_count > 0 or #find_joker(energy) > 0 then - return type_count + #find_joker(energy) - else - return 0 - end + return type_count + #SMODS.find_card(energy) end faint_baby_poke = function(self, card, context) @@ -1209,164 +1168,3 @@ poke_draw_one = function() end })) end - ---[[ Putting this here for later use -{C:inactive,s:0.8}(Copy effect ends if copied Joker removed){} --- Zorua 570 -local zorua = { - name = "zorua", - pos = { x = 6, y = 5 }, - soul_pos = { x = 8, y = 12 }, - config = {extra = {hidden_key = nil, rounds = 5, copy_joker = nil, copy_pos = 0}}, - rarity = 3, - cost = 8, - stage = "Basic", - ptype = "Dark", - atlas = "Pokedex5", - blueprint_compat = true, - rental_compat = false, - calculate = function(self, card, context) - if context.first_hand_drawn then - card.ability.extra.once = true - end - if context.setting_blind and G.jokers.cards[#G.jokers.cards] ~= card and not card.getting_sliced then - card.ability.extra.copy_joker = G.jokers.cards[#G.jokers.cards] - card.ability.extra.copy_pos = #G.jokers.cards - card_eval_status_text(card, 'extra', nil, nil, nil, {message = localize('k_copied_ex')}) - end - - local other_joker = G.jokers.cards[card.ability.extra.copy_pos] - if other_joker and other_joker ~= card and not context.no_blueprint then - context.blueprint = (context.blueprint or 0) + 1 - context.blueprint_card = context.blueprint_card or card - if context.blueprint > #G.jokers.cards + 1 then return end - local other_joker_ret = other_joker:calculate_joker(context) - context.blueprint = nil - local eff_card = context.blueprint_card or card - context.blueprint_card = nil - if other_joker_ret then - other_joker_ret.card = eff_card - other_joker_ret.colour = G.C.BLACK - return other_joker_ret - end - end - return level_evo(self, card, context, "j_poke_zoroark") - end, - set_card_type_badge = function(self, card, badges) - local card_type = SMODS.Rarity:get_rarity_badge(card.config.center.rarity) - local card_type_colour = get_type_colour(card.config.center or card.config, card) - if card.area and card.area ~= G.jokers and not poke_is_in_collection(card) then - local _o = G.P_CENTERS[card.ability.extra.hidden_key] - card_type = SMODS.Rarity:get_rarity_badge(_o.rarity) - card_type_colour = get_type_colour(_o, card) - end - badges[#badges + 1] = create_badge(card_type, card_type_colour, nil, 1.2) - end, - set_sprites = function(self, card, front) - if card.ability and card.ability.extra and card.ability.extra.hidden_key then - self:set_ability(card) - end - end, - set_ability = function(self, card, initial, delay_sprites) - if not type_sticker_applied(card) then - apply_type_sticker(card, "Dark") - end - if card.area ~= G.jokers and not poke_is_in_collection(card) and not G.SETTINGS.paused then - card.ability.extra.hidden_key = card.ability.extra.hidden_key or get_random_poke_key('zorua', nil, 1) - local _o = G.P_CENTERS[card.ability.extra.hidden_key] - card.children.center.atlas = G.ASSET_ATLAS[_o.atlas] - card.children.center:set_sprite_pos(_o.pos) - else - card.children.center.atlas = G.ASSET_ATLAS[self.atlas] - card.children.center:set_sprite_pos(self.pos) - end - end, - generate_ui = function(self, info_queue, card, desc_nodes, specific_vars, full_UI_table) - local _c = card and card.config.center or card - card.ability.extra.hidden_key = card.ability.extra.hidden_key or get_random_poke_key('zorua', nil, 1) - local _o = G.P_CENTERS[card.ability.extra.hidden_key] - if card.area ~= G.jokers and not poke_is_in_collection(card) then - local temp_ability = card.ability - card.ability = _o.config - _o:generate_ui(info_queue, card, desc_nodes, specific_vars, full_UI_table) - full_UI_table.name = localize({ type = "name", set = _o.set, key = _o.key, nodes = full_UI_table.name }) - card.ability = temp_ability - local textDyna = full_UI_table.name[1].nodes[1].config.object - textDyna.string = textDyna.string .. localize("poke_illusion") - textDyna.config.string = {textDyna.string} - textDyna.strings = {} - textDyna:update_text(true) - card.children.center.atlas = G.ASSET_ATLAS[_o.atlas] - card.children.center:set_sprite_pos(_o.pos) - local poketype_list = {Grass = true, Fire = true, Water = true, Lightning = true, Psychic = true, Fighting = true, Colorless = true, Dark = true, Metal = true, Fairy = true, Dragon = true, Earth = true} - for i = #info_queue, 1, -1 do - if info_queue[i].set == "Other" and info_queue[i].key and poketype_list[info_queue[i].key] then - table.remove(info_queue, i) - end - end - else - if not full_UI_table.name then - full_UI_table.name = localize({ type = "name", set = _c.set, key = _c.key, nodes = full_UI_table.name }) - end - card.ability.blueprint_compat_ui = card.ability.blueprint_compat_ui or '' - card.ability.blueprint_compat_check = nil - local main_end = (card.area and card.area == G.jokers) and { - {n=G.UIT.C, config={align = "bm", minh = 0.4}, nodes={ - {n=G.UIT.C, config={ref_table = card, align = "m", colour = G.C.JOKER_GREY, r = 0.05, padding = 0.06, func = 'blueprint_compat'}, nodes={ - {n=G.UIT.T, config={ref_table = card.ability, ref_value = 'blueprint_compat_ui',colour = G.C.UI.TEXT_LIGHT, scale = 0.32*0.8}}, - }} - }} - } or nil - localize{type = 'descriptions', key = _c.key, set = _c.set, nodes = desc_nodes, vars = {card.ability.extra.rounds}} - desc_nodes[#desc_nodes+1] = main_end - end - end, - load = function(self, card, card_table, other_card) - card.has_loaded = true - end, - update = function(self, card, dt) - if card.has_loaded then - card.ability.extra.copy_joker = G.jokers.cards[card.ability.extra.copy_pos] - card.has_loaded = false - end - if card.ability.extra.copy_joker and card.ability.extra.copy_joker ~= G.jokers.cards[card.ability.extra.copy_pos] then - local found = nil - for i=1, #G.jokers.cards do - if card.ability.extra.copy_joker == G.jokers.cards[i] then - card.ability.extra.copy_pos = i - found = true - break - end - end - if not found then - card.ability.extra.copy_joker = nil - card.ability.extra.copy_pos = 0 - end - end - if G.STAGE == G.STAGES.RUN and card.area == G.jokers then - local other_joker = G.jokers.cards[card.ability.extra.copy_pos] - local copy_compatible = other_joker and other_joker ~= card and not other_joker.debuff and other_joker.config.center.blueprint_compat - local right_joker = G.jokers.cards[#G.jokers.cards] - card.ability.blueprint_compat = ( right_joker and right_joker ~= card and not right_joker.debuff and right_joker.config.center.blueprint_compat and 'compatible') or 'incompatible' - if copy_compatible and not card.debuff then - card.children.center.atlas = other_joker.children.center.atlas - card.children.center:set_sprite_pos(other_joker.children.center.sprite_pos) - if other_joker.children.floating_sprite then - card.children.floating_sprite.atlas = other_joker.children.floating_sprite.atlas - card.children.floating_sprite:set_sprite_pos(other_joker.children.floating_sprite.sprite_pos) - else - card.children.floating_sprite.atlas = G.ASSET_ATLAS[self.atlas] - card.children.floating_sprite:set_sprite_pos(self.soul_pos) - end - else - card.children.center.atlas = G.ASSET_ATLAS[self.atlas] - card.children.center:set_sprite_pos(self.pos) - card.children.floating_sprite.atlas = G.ASSET_ATLAS[self.atlas] - card.children.floating_sprite:set_sprite_pos(self.soul_pos) - end - elseif poke_is_in_collection(card) and card.children.center.sprite_pos ~= self.pos and card.children.center.atlas.name ~= self.atlas then - self:set_ability(card) - end - end, -} -]]-- \ No newline at end of file diff --git a/jokerdisplay/definitions1.lua b/jokerdisplay/definitions1.lua index 2a6f4ca5..94ca3f96 100644 --- a/jokerdisplay/definitions1.lua +++ b/jokerdisplay/definitions1.lua @@ -1762,7 +1762,7 @@ calc_function = function(card) if G.STAGE == G.STAGES.RUN then local adjacent_jokers = poke_get_adjacent_jokers(card) for i = 1, #adjacent_jokers do - if is_type(adjacent_jokers[i], "Metal") then adjacent = adjacent + 1 end + if get_type(adjacent_jokers[i]) == "Metal" then adjacent = adjacent + 1 end end end local count = 0 diff --git a/jokerdisplay/definitions2.lua b/jokerdisplay/definitions2.lua index be21f7de..bd95cc2b 100644 --- a/jokerdisplay/definitions2.lua +++ b/jokerdisplay/definitions2.lua @@ -421,7 +421,7 @@ end, retrigger_function = function(playing_card, scoring_hand, held_in_hand, joker_card) local total = #find_pokemon_type("Water") if held_in_hand then return 0 end - if not is_type(joker_card, "Grass") or total > 0 then + if get_type(joker_card) ~= "Grass" or total > 0 then return playing_card:is_face() and joker_card.ability.extra.retriggers * JokerDisplay.calculate_joker_triggers(joker_card) or 0 end end diff --git a/jokerdisplay/definitions3.lua b/jokerdisplay/definitions3.lua index 6c3a98a6..1b54193c 100644 --- a/jokerdisplay/definitions3.lua +++ b/jokerdisplay/definitions3.lua @@ -650,7 +650,7 @@ jd_def["j_poke_jirachi_copy"] = { while get_total_energy(true_copy) - get_total_energy(copied_joker) < card.ability.extra.energy_buff do energize(true_copy, nil, nil, true) if true_copy.ability.extra and type(true_copy.ability.extra) == "table" then - true_copy.ability.extra.energy_count = (true_copy.ability.extra.energy_count or 0) + 1 + true_copy.ability.energy_count = (true_copy.ability.energy_count or 0) + 1 else true_copy.ability.energy_count = (true_copy.ability.energy_count or 0) + 1 end @@ -683,8 +683,8 @@ jd_def["j_poke_jirachi_copy"] = { end if true_copy.ability.extra and type(true_copy.ability.extra) == "table" then - true_copy.ability.extra.energy_count = (true_copy.ability.extra.energy_count or 0) + card.ability.extra.energy_buff - true_copy.ability.extra.c_energy_count = (true_copy.ability.extra.c_energy_count or 0) + true_copy.ability.energy_count = (true_copy.ability.energy_count or 0) + card.ability.extra.energy_buff + true_copy.ability.c_energy_count = (true_copy.ability.c_energy_count or 0) else true_copy.ability.energy_count = (true_copy.ability.energy_count or 0) + card.ability.extra.energy_buff true_copy.ability.c_energy_count = (true_copy.ability.c_energy_count or 0) diff --git a/jokerdisplay/definitions4.lua b/jokerdisplay/definitions4.lua index b0849dc5..983a92e2 100644 --- a/jokerdisplay/definitions4.lua +++ b/jokerdisplay/definitions4.lua @@ -110,7 +110,7 @@ jd_def["j_poke_honchkrow"] = { local count = 0 if G.jokers then for _, joker_card in ipairs(G.jokers.cards) do - if joker_card.config.center.rarity and is_type(joker_card, "Dark") then + if joker_card.config.center.rarity and get_type(joker_card) == "Dark" then count = count + 1 end end @@ -119,7 +119,7 @@ jd_def["j_poke_honchkrow"] = { card.joker_display_values.localized_text = "Dark" end, mod_function = function(card, mod_joker) - return { x_mult = (is_type(card, "Dark") and mod_joker.ability.extra.Xmult_multi ^ JokerDisplay.calculate_joker_triggers(mod_joker) or nil) } + return { x_mult = (get_type(card) == "Dark" and mod_joker.ability.extra.Xmult_multi ^ JokerDisplay.calculate_joker_triggers(mod_joker) or nil) } end } -- Glameow diff --git a/jokerdisplay/definitions7.lua b/jokerdisplay/definitions7.lua index bd0bbd6a..e03d9777 100644 --- a/jokerdisplay/definitions7.lua +++ b/jokerdisplay/definitions7.lua @@ -56,7 +56,7 @@ jd_def["j_poke_vikavolt"] = { text_config = { colour = G.C.WHITE }, calc_function = function(card) local count = #find_pokemon_type("Lightning") - if is_type(card, "Lightning") then + if get_type(card) == "Lightning" then count = count - 1 end card.joker_display_values.Xmult = 1 + (card.ability.extra.Xmult * count) diff --git a/pokemon/pokejokers_07.lua b/pokemon/pokejokers_07.lua index 7dd3b502..598a10ce 100644 --- a/pokemon/pokejokers_07.lua +++ b/pokemon/pokejokers_07.lua @@ -103,7 +103,7 @@ local sudowoodo={ } end if context.repetition and not context.end_of_round and context.cardarea == G.play and context.other_card:is_face() then - if (not is_type(card, "Grass")) or find_other_poke_or_energy_type(card, "Water", true) > 0 then + if (get_type(card) ~= "Grass") or find_other_poke_or_energy_type(card, "Water", true) > 0 then return { message = localize('k_again_ex'), repetitions = card.ability.extra.retriggers, diff --git a/pokemon/pokejokers_19.lua b/pokemon/pokejokers_19.lua index c0342fd3..0abc15bb 100644 --- a/pokemon/pokejokers_19.lua +++ b/pokemon/pokejokers_19.lua @@ -119,9 +119,8 @@ local zorua = { textDyna:update_text(true) card.children.center.atlas = G.ASSET_ATLAS[_o.atlas] card.children.center:set_sprite_pos(_o.pos) - local poketype_list = {Grass = true, Fire = true, Water = true, Lightning = true, Psychic = true, Fighting = true, Colorless = true, Dark = true, Metal = true, Fairy = true, Dragon = true, Earth = true} for i = #info_queue, 1, -1 do - if info_queue[i].set == "Other" and info_queue[i].key and poketype_list[info_queue[i].key] then + if info_queue[i].set == "Other" and info_queue[i].key and is_poketype(info_queue[i].key) then table.remove(info_queue, i) end end diff --git a/pokemon/pokejokers_20.lua b/pokemon/pokejokers_20.lua index 544a677f..dc3cac8a 100644 --- a/pokemon/pokejokers_20.lua +++ b/pokemon/pokejokers_20.lua @@ -76,9 +76,8 @@ local zoroark = { end card.children.center.atlas = G.ASSET_ATLAS[_o.atlas] card.children.center:set_sprite_pos(_o.pos) - local poketype_list = {Grass = true, Fire = true, Water = true, Lightning = true, Psychic = true, Fighting = true, Colorless = true, Dark = true, Metal = true, Fairy = true, Dragon = true, Earth = true} for i = #info_queue, 1, -1 do - if info_queue[i].set == "Other" and info_queue[i].key and poketype_list[info_queue[i].key] then + if info_queue[i].set == "Other" and info_queue[i].key and is_poketype(info_queue[i].key) then table.remove(info_queue, i) end end diff --git a/pokemon/pokejokers_25.lua b/pokemon/pokejokers_25.lua index e05de97b..3c8d3fed 100644 --- a/pokemon/pokejokers_25.lua +++ b/pokemon/pokejokers_25.lua @@ -101,7 +101,7 @@ local vikavolt={ if context.cardarea == G.jokers and context.scoring_hand then if context.joker_main then local count = #find_pokemon_type("Lightning") - if is_type(card, "Lightning") then + if get_type(card) == "Lightning" then count = count - 1 end return { diff --git a/pokemon/zotherjokers.lua b/pokemon/zotherjokers.lua index 4238da40..a316b114 100644 --- a/pokemon/zotherjokers.lua +++ b/pokemon/zotherjokers.lua @@ -184,8 +184,9 @@ local treasure_eatery={ if context.setting_blind then card.ability.extra.rounds = card.ability.extra.rounds - 1 if G.jokers and G.jokers.cards and #G.jokers.cards > 1 then - if has_type(G.jokers.cards[#G.jokers.cards]) then - apply_type_sticker(G.jokers.cards[1], get_type(G.jokers.cards[#G.jokers.cards])) + local type = get_type(G.jokers.cards[#G.jokers.cards]) + if type then + apply_type_sticker(G.jokers.cards[1], type) card:juice_up() card_eval_status_text(G.jokers.cards[1], 'extra', nil, nil, nil, {message = localize("poke_tera_ex"), colour = G.C.SECONDARY_SET.Spectral}) end @@ -493,7 +494,7 @@ local billion_lions = { if context.setting_blind and not card.getting_sliced then local destroyed = 0 for k, v in pairs(G.jokers.cards) do - if v ~= card and has_type(v) and not v.ability.eternal then + if v ~= card and get_type(v) and not v.ability.eternal then destroyed = destroyed + 1 v.getting_sliced = true G.E_MANAGER:add_event(Event({func = function()