Allow joker merging

This commit is contained in:
Emik 2025-03-17 13:46:29 +01:00
parent 8fe1ac19b4
commit 3ed1929825
Signed by untrusted user who does not match committer: emik
GPG key ID: 09CDFF9E5703688D
3 changed files with 55 additions and 18 deletions

View file

@ -10,15 +10,16 @@ return {
"for each destroyed object", "for each destroyed object",
"{C:inactive}(Currently #2#)", "{C:inactive}(Currently #2#)",
" ", " ",
"{C:inactive,s:0.75,E:1}#3#{C:red,s:1.5,E:1}#4#", "#3#{C:inactive,s:0.75,E:1}#4#{C:red,s:1.5,E:1}#5#",
"{C:inactive,s:0.75,E:1}#5#{C:red,s:1.5,E:1}#6#", "#6#{C:blue,E:1}#7#{}#8#{C:inactive,s:0.75,E:1}#9#{C:red,s:1.5,E:1}#10#",
}, },
merge = {"Since no objects apply, merge", "with other ", " jokers"},
quotes = { quotes = {
marble = {{"there is no escape..."}}, marble = {{"there is no escape..."}},
normal = { normal = {
{"I can't wait to work with you!"}, {"I can't wait to", "work with you!"},
{"Did you need something from me?"}, {"Did you need something", "from me?"},
{"Oh! I'm just so happy to see you!"}, {"Oh! I'm just so", "happy to see you!"},
{"Can I talk about something irrelevant?", "I promise it won't be long."}, {"Can I talk about something irrelevant?", "I promise it won't be long."},
{"Can you introduce me to your friends?", "Assuming you have friends of course!"}, {"Can you introduce me to your friends?", "Assuming you have friends of course!"},
}, },

View file

@ -4,7 +4,7 @@
"name": "Roland", "name": "Roland",
"prefix": "Roland", "prefix": "Roland",
"author": ["Emik"], "author": ["Emik"],
"version": "0.0.1", "version": "0.1.0",
"badge_colour": "8BE9FD", "badge_colour": "8BE9FD",
"main_file": "src/main.lua", "main_file": "src/main.lua",
"badge_text_colour": "44475A", "badge_text_colour": "44475A",

View file

@ -1,3 +1,4 @@
---@diagnostic disable: missing-parameter
local function common_hand() local function common_hand()
return (G.GAME or {}).current_round and F.reduce( return (G.GAME or {}).current_round and F.reduce(
G.GAME.hands, G.GAME.hands,
@ -14,6 +15,14 @@ local function destructible(card)
return not card.highlighted and not (card.ability or {}).eternal return not card.highlighted and not (card.ability or {}).eternal
end end
local function is_mergeable_with(it)
return function (card)
return it.rank ~= card.rank and
card.label == 'j_Roland_Escapey' and not
(card.ability or {}).eternal
end
end
SMODS.Atlas { SMODS.Atlas {
key = "Escapey", key = "Escapey",
path = "Escapey.png", path = "Escapey.png",
@ -35,25 +44,55 @@ SMODS.Joker {
eternal_compat = true, eternal_compat = true,
perishable_compat = true, perishable_compat = true,
blueprint_compat = false, blueprint_compat = false,
loc_vars = function(_, _, center) loc_vars = function(_, _, card)
local quotes = G.localization.descriptions.Joker.j_Roland_Escapey.quotes local loc_self = G.localization.descriptions.Joker.j_Roland_Escapey
local normal = (Jen or {}).sinister and {} or quotes.normal[math.random(#quotes.normal)] local quotes = loc_self.quotes
local scared = (Jen or {}).sinister and quotes.scared[math.random(#quotes.scared)] or {} local merge = G.jokers and F.count(F.filter(G.jokers.cards, is_mergeable_with(card))) > 1 and loc_self.merge or {}
local normal = (merge[1] or (Jen or Jane or {}).sinister) and {} or quotes.normal[math.random(#quotes.normal)]
local scared = (merge[1] or not (Jen or Jane or {}).sinister) and {} or quotes.normal[math.random(#quotes.normal)]
return {vars = { return {vars = {
center.ability.extra.level_up_by, card.ability.extra.level_up_by,
localize(common_hand(), "poker_hands"), localize(common_hand(), "poker_hands"),
merge[1] or "",
normal[1] or "", normal[1] or "",
scared[1] or "", scared[1] or "",
merge[2] or "",
merge[3] and loc_self.name or "",
merge[3] or "",
normal[2] or "", normal[2] or "",
scared[2] or "" scared[2] or "",
}} }}
end, end,
Bakery_can_use = function(_, card) Bakery_can_use = function(_, card)
return not card.debuff and (#G.GAME.tags ~= 0 or F.any(G.consumeables.cards, destructible)) return not card.debuff and (
#G.GAME.tags ~= 0 or
F.any(G.consumeables.cards, destructible) or
F.any(F.filter(G.jokers.cards, is_mergeable_with(card)))
)
end,
Bakery_use_button_text = function(_, card)
return card.debuff and "DEBUFFED" or
((#G.GAME.tags == 0 and not
F.any(G.consumeables.cards, destructible) and
F.any(F.filter(G.jokers.cards, is_mergeable_with(card)))) and "MERGE" or "ESCAPE")
end, end,
Bakery_use_joker = function(_, card) Bakery_use_joker = function(_, card)
local hand, destroyed = common_hand(), 0 local hand, object_count = common_hand(), F.count(F.filter(G.consumeables.cards, destructible)) + #G.GAME.tags
if object_count == 0 then
local sum = 0
F.foreach(
F.filter(G.jokers.cards, is_mergeable_with(card)),
function (v)
sum = sum + v.ability.extra.level_up_by
v:start_dissolve({HEX("57ecab")}, nil, 1.6)
end
)
card.ability.extra.level_up_by = card.ability.extra.level_up_by + sum
end
local function update(name, chip, mul, lv, notif, snd, vol, pit, de) local function update(name, chip, mul, lv, notif, snd, vol, pit, de)
update_hand_text({ update_hand_text({
@ -105,7 +144,6 @@ SMODS.Joker {
F.filter(G.consumeables.cards, destructible), F.filter(G.consumeables.cards, destructible),
function (v) function (v)
v:start_dissolve({HEX("57ecab")}, nil, 1.6) v:start_dissolve({HEX("57ecab")}, nil, 1.6)
destroyed = destroyed + 1
end end
) )
@ -113,18 +151,16 @@ SMODS.Joker {
G.GAME.tags, G.GAME.tags,
function (v) function (v)
G.E_MANAGER:add_event(Event({trigger = "immediate", func = fast_nope(v)})) G.E_MANAGER:add_event(Event({trigger = "immediate", func = fast_nope(v)}))
destroyed = destroyed + 1
end end
) )
level_up_hand(card, hand, nil, destroyed * card.ability.extra.level_up_by) level_up_hand(card, hand, nil, object_count * card.ability.extra.level_up_by)
update_hand_text( update_hand_text(
{sound = "button", volume = 0.7, pitch = 1.1, delay = 0}, {sound = "button", volume = 0.7, pitch = 1.1, delay = 0},
{mult = 0, chips = 0, handname = "", level = ""} {mult = 0, chips = 0, handname = "", level = ""}
) )
end, end,
Bakery_use_button_text = function(_, _) return "ESCAPE" end
} }
Bakery_API.usable_jokers.j_Roland_Escapey = true Bakery_API.usable_jokers.j_Roland_Escapey = true