diff --git a/functions/pokefamily.lua b/functions/pokefamily.lua index befe931d..2ae59da0 100644 --- a/functions/pokefamily.lua +++ b/functions/pokefamily.lua @@ -170,6 +170,7 @@ local default_family_list = { { "zorua", "zoroark" }, { "deino", "zweilous", "hydreigon" }, { "litleo", "pyroar" }, + {"inkay", "malamar", "mega_malamar"}, { { key = "pumpkaboo", form = 0 }, { key = "pumpkaboo", form = 1 }, { key = "pumpkaboo", form = 2 }, { key = "pumpkaboo", form = 3 }, { key = "gourgeist", form = 0 }, { key = "gourgeist", form = 1 }, { key = "gourgeist", form = 2 }, { key = "gourgeist", form = 3 }, }, diff --git a/functions/pokefunctions.lua b/functions/pokefunctions.lua index 68ed268c..c72b6917 100644 --- a/functions/pokefunctions.lua +++ b/functions/pokefunctions.lua @@ -1432,3 +1432,14 @@ poke_drain_chips = function(card, amount) return base_drain + bonus_drain end + +-- Multiple Mega Malamar hooks +local cscui = create_shop_card_ui +create_shop_card_ui = function(card, type, area) + local ret = cscui(card, type, area) + if #find_joker("mega_malamar") > 0 and not (card.facing == 'back') then + card.facing = 'back' + card.sprite_facing = 'back' + end + return ret +end \ No newline at end of file diff --git a/localization/en-us.lua b/localization/en-us.lua index aeb8b93b..6072503c 100644 --- a/localization/en-us.lua +++ b/localization/en-us.lua @@ -5106,6 +5106,38 @@ return { "also contains a {C:attention}King{} or {C:attention}Queen{}" } }, + j_poke_inkay = { + name = "Inkay", + text = { + "Cards have a {C:green}#1# in #2#{} chance to", + "be drawn {C:attention}face down{}", + "{br:3}ERROR - CONTACT STEAK", + "Played face down cards give", + "{C:red}+#3#{} Mult when scored", + "{C:inactive,s:0.8}(Evolves after triggering face down cards {C:attention,s:0.8}#4#{C:inactive,s:0.8} times)" + } + }, + j_poke_malamar = { + name = "Malamar", + text = { + "All cards are drawn {C:attention}face down{}", + "{br:3}ERROR - CONTACT STEAK", + "Played face down cards give", + "{X:red,C:white}X#1#{} Mult when scored", + } + }, + j_poke_mega_malamar = { + name = "Mega Malamar", + text = { + "Most cards besides this Joker,", + "its {C:attention}Mega Stone{} and", + "{C:attention}playing cards{} held in hand", + "are {C:attention}face down{}", + "{br:2}ERROR - CONTACT STEAK", + "Played cards give", + "{X:red,C:white}X#1#{} Mult when scored", + } + }, j_poke_sylveon = { name = 'Sylveon', text = { diff --git a/lovely/poke_utils.toml b/lovely/poke_utils.toml index 07bfeb06..7e0e617f 100644 --- a/lovely/poke_utils.toml +++ b/lovely/poke_utils.toml @@ -310,3 +310,39 @@ pattern = "if area == G.consumeables then" position = "at" payload = "if area == G.consumeables or area == G.jokers then" match_indent = true + +## Mega Malamar +# flip cards or keep them flipped +[[patches]] +[patches.pattern] +target = "blind.lua" +pattern = '''for k, v in ipairs(G.jokers.cards) do + if v.facing == 'back' then v:flip() end + end''' +position = "at" +payload = '''if #SMODS.find_card("j_poke_mega_malamar") == 0 then + for k, v in ipairs(G.jokers.cards) do + if v.facing == 'back' then v:flip() end + end + end''' +match_indent = true + +[[patches]] +[patches.pattern] +target = "functions/common_events.lua" +pattern = '''return card''' +position = "before" +match_indent = true +payload = '''if #SMODS.find_card("j_poke_mega_malamar") > 0 and not (card.facing == 'back') then + card.facing = 'back' + card.sprite_facing = 'back' +end +''' + +[[patches]] +[patches.pattern] +target = "cardarea.lua" +pattern = '''function CardArea:emplace(card, location, stay_flipped)''' +position = "after" +match_indent = true +payload = '''stay_flipped = stay_flipped or (self ~= G.hand and #SMODS.find_card("j_poke_mega_malamar") > 0)''' \ No newline at end of file diff --git a/pokemon/pokejokers_23.lua b/pokemon/pokejokers_23.lua index b6ca6d63..e6ec9fd1 100644 --- a/pokemon/pokejokers_23.lua +++ b/pokemon/pokejokers_23.lua @@ -114,10 +114,304 @@ local pyroar={ -- Swirlix 684 -- Slurpuff 685 -- Inkay 686 +local inkay={ + name = "inkay", + gen = 6, + pos = {x = 20, y = 45}, + config = {extra = {mult = 8, num = 1, dem = 2, flipped_triggered = 0}, evo_rqmt = 20}, + loc_vars = function(self, info_queue, card) + type_tooltip(self, info_queue, card) + local abbr = card.ability.extra + local num, dem = SMODS.get_probability_vars(card, card.ability.extra.num, card.ability.extra.dem, 'inkay') + return {vars = {num, dem, abbr.mult, math.max(0, self.config.evo_rqmt - abbr.flipped_triggered)}} + end, + rarity = 2, + cost = 6, + stage = "Basic", + ptype = "Dark", + atlas = "AtlasJokersBasicNatdex", + blueprint_compat = true, + calculate = function(self, card, context) + + -- 1 in 2 is flipped + if context.stay_flipped and context.to_area == G.hand and SMODS.pseudorandom_probability(card, 'inkay', card.ability.extra.num, card.ability.extra.dem, 'inkay') then + return { + stay_flipped = true + } + end + + -- flag all face down cards + if G.hand then + for i = 1, #G.hand.cards do + if G.hand.cards[i].facing == 'back' then + G.hand.cards[i].poke_flipped = true + end + end + end + + -- give mult per scored face down card + if context.individual and context.cardarea == G.play and context.other_card.poke_flipped then + if not context.end_of_round and not context.before and not context.after and not context.other_card.debuff then + if not context.blueprint then + G.E_MANAGER:add_event(Event({ + func = function() + card.ability.extra.flipped_triggered = card.ability.extra.flipped_triggered + 1 + return true end })) + end + return { + mult = card.ability.extra.mult , + card = card + } + end + end + + -- remove flag and flip back cards + if context.end_of_round and context.cardarea == G.jokers and not context.blueprint then + for i = 1, #G.hand.cards do + if G.hand.cards[i].facing == 'back' then + G.hand.cards[i]:flip() + end + end + for _, v in pairs(G.playing_cards) do + if v.poke_flipped then + v.poke_flipped = nil + end + end + end + return scaling_evo(self, card, context, "j_poke_malamar", card.ability.extra.flipped_triggered, self.config.evo_rqmt) + end, + remove_from_deck = function(self, card, from_debuff) + if #SMODS.find_card("j_poke_inkay") + #SMODS.find_card("j_poke_malamar") == 0 then + if G.hand and G.hand.cards then + for i = 1, #G.hand.cards do + if G.hand.cards[i].facing == 'back' then + G.hand.cards[i]:flip() + end + end + end + for _, v in pairs(G.playing_cards) do + if v.poke_flipped then + v.poke_flipped = nil + end + end + end + end, +} + +-- Credits to emmadenslemma for the idea and the code +SMODS.DrawStep({ + key = 'inkay_rotate', + order = -1001, + layers = { shadow = true, both = true }, + func = function(self) + if not G.SETTINGS.paused and self.config.center.key == 'j_poke_inkay' then + -- Handle reloading Inkay + if self.flipped_registered == nil then self.flipped_registered = self.ability.extra.flipped_triggered end + -- Only rotate once when the card jiggles + -- -- Known issue: this also rotates once if you mouse over it while it's scoring + -- -- this should be done in Inkay's scoring code instead of here + if self.juice and not self.flip_juice_spent then + self.flipped_registered = math.min(self.flipped_registered + 1, self.ability.extra.flipped_triggered) + self.flip_juice_spent = true + end + if not self.juice and self.flip_juice_spent then + self.flip_juice_spent = false + end + -- Actual rotation part + local add_rot_amt = math.pi * math.min(self.flipped_registered / self.config.center.config.evo_rqmt, 1) + self.VT.r = self.VT.r + add_rot_amt + for _, v in pairs(self.children) do + v.VT.r = self.VT.r + end + end + end +}) + -- Malamar 687 +local malamar={ + name = "malamar", + gen = 6, + pos = {x = 22, y = 45}, + config = {extra = {Xmult_multi = 1.5}}, + loc_vars = function(self, info_queue, card) + type_tooltip(self, info_queue, card) + local abbr = card.ability.extra + return {vars = {abbr.Xmult_multi}} + end, + rarity = "poke_safari", + cost = 8, + stage = "One", + ptype = "Dark", + atlas = "AtlasJokersBasicNatdex", + blueprint_compat = true, + calculate = function(self, card, context) + + -- all are flipped + if context.stay_flipped and context.to_area == G.hand then + return { + stay_flipped = true + } + end + + -- flag all face down cards + if G.hand then + for i = 1, #G.hand.cards do + if G.hand.cards[i].facing == 'back' then + G.hand.cards[i].poke_flipped = true + end + end + end + + -- give mult per scored face down card + if context.individual and context.cardarea == G.play and context.other_card.poke_flipped then + if not context.end_of_round and not context.before and not context.after and not context.other_card.debuff then + return { + Xmult = card.ability.extra.Xmult_multi , + card = card + } + end + end + + -- remove flag and flip back cards + if context.end_of_round and context.cardarea == G.jokers and not context.blueprint then + for i = 1, #G.hand.cards do + if G.hand.cards[i].facing == 'back' then + G.hand.cards[i]:flip() + end + end + for _, v in pairs(G.playing_cards) do + if v.poke_flipped then + v.poke_flipped = nil + end + end + end + end, + remove_from_deck = function(self, card, from_debuff) + if #SMODS.find_card("j_poke_inkay") + #SMODS.find_card("j_poke_malamar") == 0 then + if G.hand and G.hand.cards then + for i = 1, #G.hand.cards do + if G.hand.cards[i].facing == 'back' then + G.hand.cards[i]:flip() + end + end + end + for _, v in pairs(G.playing_cards) do + if v.poke_flipped then + v.poke_flipped = nil + end + end + end + end, + megas = {"mega_malamar"} +} + +-- Mega Malamar 687-1 +local mega_malamar={ + name = "mega_malamar", + gen = 6, + pos = {x = 6, y = 1}, -- I'll let you deal with the mega sprite atlas and stuff, I can provide the one I'm using + soul_pos = {x = 7, y = 1}, + artist = "KingOfThe-X-Roads", + config = {extra = {Xmult_multi = 2}}, + loc_vars = function(self, info_queue, card) + type_tooltip(self, info_queue, card) + local abbr = card.ability.extra + return {vars = {abbr.Xmult_multi}} + end, + rarity = "poke_mega", + cost = 12, + stage = "Mega", + ptype = "Dark", + atlas = "poke_jokers", + blueprint_compat = true, + calculate = function(self, card, context) + + -- scoring + if context.individual and context.cardarea == G.play then + if not context.end_of_round and not context.before and not context.after and not context.other_card.debuff then + return { + Xmult = card.ability.extra.Xmult_multi, + card = card + } + end + end + + end, + add_to_deck = function(self, card, from_debuff) + if #SMODS.find_card("j_poke_inkay") + #SMODS.find_card("j_poke_malamar") == 0 then + if G.hand and G.hand.cards then + for i = 1, #G.hand.cards do + if G.hand.cards[i].facing == 'back' then + G.hand.cards[i]:flip() + end + end + end + for _, v in pairs(G.playing_cards) do + if v.poke_flipped then + v.poke_flipped = nil + end + end + end + + G.jokers:unhighlight_all() + for _, v in ipairs(G.jokers.cards) do + if v ~= card then v:flip() end + end + + for _, v in ipairs(G.consumeables.cards) do + if not (v.config.center.key == "c_poke_megastone" and v.ability.extra.used_on == card.unique_val) then + v:flip() + end + end + + if G.shop then + for _, v in ipairs(G.shop_vouchers.cards) do + v:flip() + end + + for _, v in ipairs(G.shop_booster.cards) do + v:flip() + end + + for _, v in ipairs(G.shop_jokers.cards) do + v:flip() + end + end + + end, + remove_from_deck = function(self, card, from_debuff) + if not (G.GAME.blind and G.GAME.blind:get_type() == 'Boss' and G.GAME.blind.name == "Amber Acorn" and G.GAME.blind.disabled) then + for _, v in ipairs(G.jokers.cards) do + if v.facing == 'back' then v:flip() end + end + end + + for _, v in ipairs(G.consumeables.cards) do + if v.facing == 'back' then v:flip() end + end + + if G.shop then + for _, v in ipairs(G.shop_vouchers.cards) do + if v.facing == 'back' then v:flip() end + end + + for _, v in ipairs(G.shop_booster.cards) do + if v.facing == 'back' then v:flip() end + end + + for _, v in ipairs(G.shop_jokers.cards) do + if v.facing == 'back' then v:flip() end + end + end + end, +} + -- Binacle 688 -- Barbaracle 689 -- Skrelp 690 return {name = "Pokemon Jokers 661-690", - list = {litleo, pyroar}, + list = { + litleo, pyroar, + inkay, malamar, mega_malamar, + }, }