Add new challenge

This commit is contained in:
Emik 2026-07-09 17:28:51 +02:00
parent 9a981e989c
commit e072fbd409
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF
4 changed files with 105 additions and 30 deletions

View file

@ -179,7 +179,7 @@ return {
text = {
"Give the {C:attention}Blind",
"{C:attention}Base {}as {X:red,C:white}XMult",
"{C:inactive}(Currently {X:red,C:white}X#1#{C:inactive})",
"{C:inactive}(Currently {X:red,C:white}X#1#{C:inactive} Mult)",
},
},
j_Roland_cold = {
@ -564,6 +564,7 @@ return {
c_Roland_Jokerful = "Jokerful",
c_Roland_Pastries = "Sweet Pastries",
c_Roland_Spin_To_Win = "Spin to Win",
c_Roland_Yard_Sale = "Yard Sale",
},
v_dictionary = {
b_Roland_add = "ADD",
@ -603,6 +604,8 @@ return {
ch_c_Roland_Eternally_Violet = {"{C:attention}Violet Vessel{}'s effect is active every blind"},
ch_c_Roland_Glass1 = {"Played cards with no seal have a"},
ch_c_Roland_Glass2 = {"{C:green}1 in 2{} chance to gain {C:dark_edition}Glass Seal"},
ch_c_Roland_Yard_Sale1 = {"Gain {C:money}$5 {}when playing cards are {C:attention}added {}or {C:attention}removed"},
ch_c_Roland_Yard_Sale2 = {"Earn {C:red}no money {}from any other source"},
ch_c_Roland_Go = {"Set money to {C:money}$0 {}when entering the shop"},
ch_c_Roland_Jokerful = {"The only jokers are {C:mult}Joker{} and {C:chips}Ms. Joker"},
ch_c_Roland_Pastries = {"All blinds, cards, and tags are of {C:gold}Bakery{} or {C:blue}Roland"},

View file

@ -3,7 +3,7 @@
"id": "Roland",
"name": "Roland",
"prefix": "Roland",
"version": "2.9.44",
"version": "2.9.45",
"badge_colour": "8BE9FD",
"display_name": "Roland",
"main_file": "src/main.lua",

View file

@ -1,19 +1,26 @@
local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2]
---@return {banned_cards: {}, banned_tags: {}, banned_other: {}}
local function bans()
return {banned_cards = {}, banned_tags = {}, banned_other = {}}
end
---@param tbl table
---@return fun(v: SMODS.GameObject)
local function adder(tbl)
return function(v)
table.insert(tbl, {id = v.key, type = "blind"})
end
end
---@param v SMODS.GameObject
---@return boolean
local function is_banned_from_pastry(v)
return not ({Bakery = true, Roland = true})[(v.mod or {}).id]
end
---@param v SMODS.Center
---@return boolean
local function is_center_banned_from_pastry(v)
local arcana_boosters = {
p_arcana_normal_1 = true,
@ -30,21 +37,35 @@ local function is_center_banned_from_pastry(v)
return arcana_boosters[v.key] or pastries_targets[v.set] and is_banned_from_pastry(v)
end
---@param v SMODS.GameObject
---@return boolean|string
local function is_economy(v)
return f(Bakery_API.econ_only_items):where(f.id, v.key):any()
end
---@param key string
---@return fun(v: SMODS.Blind, k: string): boolean?
local function is_showdown_except(key)
---@param v SMODS.Blind
---@param k string
---@return boolean?
return function(v, k)
return v.boss and v.boss.showdown and key ~= k
end
end
local pastries, amber, cerulean, crimson, verdant, violet =
bans(), bans(), bans(), bans(), bans(), bans()
---@param name string
---@param amount number
---@return {id: string}[]
local function multirule(name, amount)
return f(amount):map(function(v)
return {id = "Roland_" .. name .. v}
end):table()
end
local pastries, amber, cerulean, crimson, verdant, violet, yard =
bans(), bans(), bans(), bans(), bans(), bans(), bans()
SMODS.Challenge {
key = "Glass",
rules = {custom = {{id = "Roland_Glass1"}, {id = "Roland_Glass2"}}},
rules = {custom = multirule("Glass", 2)},
pronouns = "they_them",
config = {extra = {odds = 2}},
calculate = function(self, context)
@ -61,6 +82,28 @@ SMODS.Challenge {
end,
}
local yard_sale
SMODS.Challenge {
key = "Yard_Sale",
config = {extra = {dollars = 5}, no_interest = true},
vouchers = {{id = "v_magic_trick"}, {id = "v_overstock_norm"}},
rules = {custom = multirule("Yard_Sale", 2), modifiers = {{id = "dollars", value = 14}}},
restrictions = yard,
apply = function()
G.GAME.modifiers.no_blind_reward = {Small = true, Big = true, Boss = true}
G.GAME.modifiers.no_extra_hand_money = true
f(Bakery_API.econ_only_items):keys():each(function(v)
G.GAME.banned_keys[v] = true
end)
end,
calculate = function(self, context)
yard_sale = (context.playing_card_added or context.remove_playing_cards) and not context.blueprint
return yard_sale and {dollars = self.config.extra.dollars * #(context.cards or context.removed or {})} or nil
end,
}
SMODS.Challenge {
key = "Go",
rules = {custom = {{id = "Roland_Go"}}},
@ -291,27 +334,44 @@ SMODS.Challenge {
end,
}
q(function()
f {
{G.P_TAGS, is_banned_from_pastry, pastries.banned_tags},
{G.P_BLINDS, is_banned_from_pastry, pastries.banned_other},
{G.P_CENTERS, is_center_banned_from_pastry, pastries.banned_cards},
{G.P_BLINDS, is_showdown_except "bl_final_acorn", amber.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_bell", cerulean.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_heart", crimson.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_leaf", verdant.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_vessel", violet.banned_other},
}:each(function(v)
f(v[1]):where(v[2]):each(adder(v[3]))
end)
end)
q {
q(function()
if not G.P_CENTERS.j_Bakery_Spinner then
return true
end
blocking = false,
no_delete = true,
func = function()
if not Bakery_API or not Bakery_API.no_money_decks then
return false
end
f(spin_to_win.jokers):each(function(v)
v.id = "j_Bakery_Spinner"
end)
end)
local orig = Bakery_API.no_money_decks
Bakery_API.no_money_decks = setmetatable(orig, {
orig = orig,
__index = function(_, k)
return (G.GAME or {}).challenge == "c_Roland_Yard_Sale" and
not yard_sale or
(getmetatable(orig) or orig)[k]
end,
})
f(spin_to_win.jokers):each(function(v)
v.id = G.P_CENTERS.j_Bakery_Spinner and "j_Bakery_Spinner" or v.id
end)
f {
{G.P_TAGS, is_economy, yard.banned_tags},
{G.P_BLINDS, is_economy, yard.banned_other},
{G.P_CENTERS, is_economy, yard.banned_cards},
{G.P_TAGS, is_banned_from_pastry, pastries.banned_tags},
{G.P_BLINDS, is_banned_from_pastry, pastries.banned_other},
{G.P_CENTERS, is_center_banned_from_pastry, pastries.banned_cards},
{G.P_BLINDS, is_showdown_except "bl_final_acorn", amber.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_bell", cerulean.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_heart", crimson.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_leaf", verdant.banned_other},
{G.P_BLINDS, is_showdown_except "bl_final_vessel", violet.banned_other},
}:each(function(v)
f(v[1]):where(v[2]):each(adder(v[3]))
end)
end,
}

View file

@ -1320,3 +1320,15 @@ joker {
end
end,
}
q {
blocking = false,
no_delete = true,
func = function()
if not Bakery_API then
return false
end
table.insert(Bakery_API.econ_only_items, "j_Roland_artemis")
end,
}