diff --git a/assets/1x/Basic Series/AtlasStakesBasic.png b/assets/1x/Basic Series/AtlasStakesBasic.png new file mode 100644 index 000000000..fbc8eb935 Binary files /dev/null and b/assets/1x/Basic Series/AtlasStakesBasic.png differ diff --git a/assets/1x/Basic Series/AtlasStickersBasic.png b/assets/1x/Basic Series/AtlasStickersBasic.png index dc1227dc8..9d1fcc0ad 100644 Binary files a/assets/1x/Basic Series/AtlasStickersBasic.png and b/assets/1x/Basic Series/AtlasStickersBasic.png differ diff --git a/assets/2x/Basic Series/AtlasStakesBasic.png b/assets/2x/Basic Series/AtlasStakesBasic.png new file mode 100644 index 000000000..687bf27ff Binary files /dev/null and b/assets/2x/Basic Series/AtlasStakesBasic.png differ diff --git a/assets/2x/Basic Series/AtlasStickersBasic.png b/assets/2x/Basic Series/AtlasStickersBasic.png index 07d7d1ed9..fda4bef8d 100644 Binary files a/assets/2x/Basic Series/AtlasStickersBasic.png and b/assets/2x/Basic Series/AtlasStickersBasic.png differ diff --git a/functions/energyfunctions.lua b/functions/energyfunctions.lua index 926c3e3c4..6a746ac66 100644 --- a/functions/energyfunctions.lua +++ b/functions/energyfunctions.lua @@ -16,7 +16,7 @@ energy_max = 3 -- we're gonna need this for the vanilla jokers later -- Load list of energizable vanilla jokers -local energizable_vanilla = assert(SMODS.load_file("functions/energizable_vanilla.lua"))() +energizable_vanilla = assert(SMODS.load_file("functions/energizable_vanilla.lua"))() -- this is a series of checks formerly strewn about the energy functions -- namely, is ability.extra a table or a number or nil, is there an energizable value, etc. diff --git a/functions/pokefunctions.lua b/functions/pokefunctions.lua index 68ed268cd..d631bc65b 100644 --- a/functions/pokefunctions.lua +++ b/functions/pokefunctions.lua @@ -692,6 +692,12 @@ evo_item_in_pool = function(self) end type_tooltip = function(self, info_queue, center) + if (center.ability and center.ability.extra and type(center.ability.extra) == "table" and + center.ability.poke_weakened and (get_total_energy(center) == 0)) + then + info_queue[#info_queue+1] = {set = 'Other', key = "energy", + vars = {get_total_energy(center), energy_max + (G.GAME.energy_plus or 0) + (center.ability.extra.e_limit_up or 0)}} + end local percent if (center.ability and center.ability.extra and type(center.ability.extra) == "table" and (get_total_energy(center) ~= 0)) then info_queue[#info_queue+1] = {set = 'Other', key = "energy", vars = {get_total_energy(center), energy_max + (G.GAME.energy_plus or 0) + (center.ability.extra.e_limit_up or 0)}} diff --git a/localization/en-us.lua b/localization/en-us.lua index aeb8b93b7..9714f1053 100644 --- a/localization/en-us.lua +++ b/localization/en-us.lua @@ -6157,6 +6157,15 @@ return { } }, }, + Stake={ + stake_poke_lilac_stake = { + name = "Lilac Stake", + text = {"Shop can have {C:attention}Weakened{} Jokers", + "{C:inactive,s:0.8}(Base values are {C:attention,s:0.8}de-energized{}{C:inactive,s:0.8}){}", + "{s:0.8}Applies all previous Stakes" + }, + }, + }, Tag = { tag_poke_pocket_tag = { name = "Pocket Tag", @@ -6329,6 +6338,14 @@ return { "{X:bird,C:white}Bird{}", } }, + poke_lilac_stake_sticker = { + name = "Lilac Sticker", + text = { + "Used this Joker", + "to win on {C:attention}Lilac", + "{C:attention}Stake{} difficulty" + }, + }, --infoqueue used for things like kabuto and omanyte ancient = { name = "Ancient", @@ -6942,6 +6959,13 @@ return { "{C:dark_edition}#1#{}" } }, + poke_weakened = { + name = "Weakened", + text = { + "Base values", + "are {C:attention}de-energized{}" + }, + }, endless = { name = "Reusable", text = { @@ -7480,6 +7504,7 @@ return { k_poke_safari = "Safari", k_poke_mega = "Mega", + poke_weakened = "Weakened", }, quips = { poke_lose_quip1 = {"Maybe Pokémon contests", "are more your speed...",}, diff --git a/pokermon.lua b/pokermon.lua index c654217a2..0a77a7f08 100644 --- a/pokermon.lua +++ b/pokermon.lua @@ -172,9 +172,12 @@ load_directory("boosters", SMODS.Booster, true) --Load seals load_directory("seals", SMODS.Seal, true) +--Load stakes +load_directory("stakes", SMODS.Stake, true) + --Load stickers load_directory("stickers", function (item) - item.hide_badge = true + if not item.name == "weakened" then item.hide_badge = true end SMODS.Sticker(item) end, true) @@ -248,12 +251,68 @@ function Card:set_ability(center, initial, delay_sprites) return ret end +-- copy of `is_energizable` but for centers instead +local is_center_energizable = function(center) + if energizable_vanilla[center.name] then + return true + end + -- Regular case + if type(center.config.extra) == "table" then + for name, _ in pairs(energy_values) do + if type(center.config.extra[name]) == "number" then + return true + end + end + elseif type(center.config.extra) == "number" then + return true + -- More generic check for energizable values that aren't in ability.extra + else + for k, _ in pairs(energy_values) do + if center.config[energy_values[k]] and center.config[energy_values[k]] > 0 then return true end + end + end + return false +end + +-- workaround for `get_family_keys` taking a card instead of a center +local get_family_key_set = function(center) + local family = poke_get_family_list(center.name) + local keys = {} + if #family > 1 then + local prefix = center.poke_custom_prefix or 'poke' -- if it's in a family, we know it's one of these + for _, v in ipairs(family) do + local name = type(v) == 'table' and v.key or v + local key = 'j_' .. prefix .. '_' .. name + if G.P_CENTERS[key] then + keys[key] = true + end + end + else + keys[center.key] = true + end + return keys +end + function SMODS.current_mod.reset_game_globals(run_start) if run_start then if G.GAME.modifiers.no_energy then G.GAME.energy_rate = 0 end + for _, center in pairs(G.P_CENTERS) do + -- distribute `poke_weakened_compat` to jokers + if G.GAME.modifiers.enable_poke_weakened and center.set == 'Joker' + and center.poke_weakened_compat == nil then -- allow manual overrides + local family_key_set = get_family_key_set(center) + for k, _ in pairs(family_key_set) do + local rel_center = G.P_CENTERS[k] + if rel_center and is_center_energizable(rel_center) then + center.poke_weakened_compat = true + break + end + end + end + end end local rank_resets = {'bulb1card', 'sneaselcard', 'bramblincard', 'wingullcard'} diff --git a/pokesprites.lua b/pokesprites.lua index a3f104ac1..fbd6c778b 100644 --- a/pokesprites.lua +++ b/pokesprites.lua @@ -149,6 +149,13 @@ SMODS.Atlas({ py = 95, }) +SMODS.Atlas({ + key = "AtlasStakesBasic", + path = "Basic Series/AtlasStakesBasic.png", + px = 29, + py = 29 +}) + SMODS.Atlas({ key = "AtlasStickersBasic", path = "Basic Series/AtlasStickersBasic.png", diff --git a/stakes/lilac_stake.lua b/stakes/lilac_stake.lua new file mode 100644 index 000000000..a82f18c96 --- /dev/null +++ b/stakes/lilac_stake.lua @@ -0,0 +1,23 @@ +local lilac = { + key = 'lilac_stake', + applied_stakes = {'gold'}, + above_stake = 'gold', + prefix_config = {above_stake = {mod = false}, applied_stakes = {mod = false}}, + + modifiers = function() + G.GAME.modifiers.enable_poke_weakened = true + end, + + colour = HEX('E8CCE8'), + + pos = {x = 0, y = 0}, + sticker_pos = {x = 8, y = 1}, + atlas = 'AtlasStakesBasic', + sticker_atlas = 'AtlasStickersBasic' +} + + + +return {name = "Stakes", + list = {lilac} +} \ No newline at end of file diff --git a/stickers/stickers.lua b/stickers/stickers.lua index 799ed437d..2e14f3d01 100644 --- a/stickers/stickers.lua +++ b/stickers/stickers.lua @@ -3,7 +3,7 @@ local type_sticker_template = prefix_config = {key = false}, rate = 0.0, atlas = "AtlasStickersBasic", - no_collection = true + no_collection = true, } local type_stickers = {} diff --git a/stickers/weakened_sticker.lua b/stickers/weakened_sticker.lua new file mode 100644 index 000000000..61e5534f4 --- /dev/null +++ b/stickers/weakened_sticker.lua @@ -0,0 +1,28 @@ + +local weakened = { + key = 'weakened', + badge_colour = HEX('c497c4'), + order = 5, + pos = {x = 7, y = 1}, + atlas = 'AtlasStickersBasic', + rate = 0.3, + needs_enable_flag = true, + default_compat = false, + apply = function(self, card, val) + card.ability[self.key] = val + if card.ability.extra then + if type(card.ability.extra) == "table" then + increment_energy(card, get_type(card), -1, true) + card.ability.extra.e_limit_up = card.ability.extra.e_limit_up and (card.ability.extra.e_limit_up - 1) or -1 + end + end + end, + should_apply = function(self, card, center, area, bypass_roll) + return (area == G.shop_jokers or area == G.pack_cards) + and SMODS.Sticker.should_apply(self, card, center, area, bypass_roll) + end, +} + +return {name = "Stickers", + list = {weakened} +} \ No newline at end of file