Jane/src/challenge.lua
2026-06-21 12:26:26 +02:00

95 lines
2.9 KiB
Lua

local rain_world_jokers = {
"j_jane_monk",
"j_jane_survivor",
"j_jane_hunter",
"j_jane_gourmand",
"j_jane_artificer",
"j_jane_spearmaster",
"j_jane_rivulet",
"j_jane_saint",
"j_jane_rot",
}
local is_rain_world_joker, survival = {}, {}
for _, v in pairs(rain_world_jokers) do
is_rain_world_joker[v] = true
end
Jane.q(function()
for gk, g in pairs(G.localization.descriptions) do
for ck, c in pairs((type(g) == "table" and not ({Back = true, Sleeve = true})[gk]) and g or {}) do
for _, text in pairs((type(c) == "table" and type(c.text) == "table" and G.P_CENTERS[ck]) and c.text or {}) do
if type(text) == "string" and (text:find("discard") or text:find("Discard")) then
survival[#survival + 1] = {id = ck}
break
end
end
end
end
end, nil, nil, nil, nil, false, true)
SMODS.Challenge {
key = "survival",
loc_txt = {name = "Survival"},
jokers = {{id = "j_jane_survivor"}},
rules = {modifiers = {{id = "discards", value = 0}}},
restrictions = {banned_cards = survival},
}
SMODS.Challenge {
key = "downpour",
loc_txt = {name = "Downpour"},
rules = {custom = {{id = "jane_downpour1"}, {id = "jane_downpour2"}, {id = "jane_downpour3"}}},
apply = function(_)
for _, v in ipairs(rain_world_jokers) do
Jane.q(function()
local card = create_card("Joker", G.jokers, nil, nil, nil, nil, v, "karma_deck_next")
card:add_to_deck()
card:start_materialize()
G.jokers:emplace(card)
play_sound("timpani")
end, 0.2)
end
end,
calculate = function(_, context)
local function l()
if G.STAGE == G.STAGES.RUN then
G.STATE = G.STATES.GAME_OVER
G.STATE_COMPLETE = false
end
end
if not Jane.is_end_of_ante(context) then
return
end
local destructible_jokers = {}
for _, v in pairs(G.jokers.cards) do
if is_rain_world_joker[v.config.center.key] and not ((v.ability or {}).eternal or (v.ability or {}).cry_absolute) then
destructible_jokers[#destructible_jokers + 1] = v
end
end
if not next(destructible_jokers) then
return l()
end
local chosen = pseudorandom_element(destructible_jokers, pseudoseed("karma_deck"))
if chosen then
chosen.getting_sliced = true
chosen:start_dissolve()
end
end,
}
G.localization.misc.v_text.ch_c_jane_downpour1 =
{"Start with all {C:legendary}Rain World Jokers"}
G.localization.misc.v_text.ch_c_jane_downpour2 =
{"Destroy a random {C:legendary}Rain World Joker {}when"}
G.localization.misc.v_text.ch_c_jane_downpour3 =
{"{C:attention}Boss Blind {}is defeated, or {C:red}lose"}