Add new challenge
This commit is contained in:
parent
9a981e989c
commit
e072fbd409
4 changed files with 105 additions and 30 deletions
|
|
@ -179,7 +179,7 @@ return {
|
||||||
text = {
|
text = {
|
||||||
"Give the {C:attention}Blind",
|
"Give the {C:attention}Blind",
|
||||||
"{C:attention}Base {}as {X:red,C:white}XMult",
|
"{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 = {
|
j_Roland_cold = {
|
||||||
|
|
@ -564,6 +564,7 @@ return {
|
||||||
c_Roland_Jokerful = "Jokerful",
|
c_Roland_Jokerful = "Jokerful",
|
||||||
c_Roland_Pastries = "Sweet Pastries",
|
c_Roland_Pastries = "Sweet Pastries",
|
||||||
c_Roland_Spin_To_Win = "Spin to Win",
|
c_Roland_Spin_To_Win = "Spin to Win",
|
||||||
|
c_Roland_Yard_Sale = "Yard Sale",
|
||||||
},
|
},
|
||||||
v_dictionary = {
|
v_dictionary = {
|
||||||
b_Roland_add = "ADD",
|
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_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_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_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_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_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"},
|
ch_c_Roland_Pastries = {"All blinds, cards, and tags are of {C:gold}Bakery{} or {C:blue}Roland"},
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"id": "Roland",
|
"id": "Roland",
|
||||||
"name": "Roland",
|
"name": "Roland",
|
||||||
"prefix": "Roland",
|
"prefix": "Roland",
|
||||||
"version": "2.9.44",
|
"version": "2.9.45",
|
||||||
"badge_colour": "8BE9FD",
|
"badge_colour": "8BE9FD",
|
||||||
"display_name": "Roland",
|
"display_name": "Roland",
|
||||||
"main_file": "src/main.lua",
|
"main_file": "src/main.lua",
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,26 @@
|
||||||
local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2]
|
local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2]
|
||||||
|
|
||||||
|
---@return {banned_cards: {}, banned_tags: {}, banned_other: {}}
|
||||||
local function bans()
|
local function bans()
|
||||||
return {banned_cards = {}, banned_tags = {}, banned_other = {}}
|
return {banned_cards = {}, banned_tags = {}, banned_other = {}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param tbl table
|
||||||
|
---@return fun(v: SMODS.GameObject)
|
||||||
local function adder(tbl)
|
local function adder(tbl)
|
||||||
return function(v)
|
return function(v)
|
||||||
table.insert(tbl, {id = v.key, type = "blind"})
|
table.insert(tbl, {id = v.key, type = "blind"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param v SMODS.GameObject
|
||||||
|
---@return boolean
|
||||||
local function is_banned_from_pastry(v)
|
local function is_banned_from_pastry(v)
|
||||||
return not ({Bakery = true, Roland = true})[(v.mod or {}).id]
|
return not ({Bakery = true, Roland = true})[(v.mod or {}).id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param v SMODS.Center
|
||||||
|
---@return boolean
|
||||||
local function is_center_banned_from_pastry(v)
|
local function is_center_banned_from_pastry(v)
|
||||||
local arcana_boosters = {
|
local arcana_boosters = {
|
||||||
p_arcana_normal_1 = true,
|
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)
|
return arcana_boosters[v.key] or pastries_targets[v.set] and is_banned_from_pastry(v)
|
||||||
end
|
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)
|
local function is_showdown_except(key)
|
||||||
---@param v SMODS.Blind
|
|
||||||
---@param k string
|
|
||||||
---@return boolean?
|
|
||||||
return function(v, k)
|
return function(v, k)
|
||||||
return v.boss and v.boss.showdown and key ~= k
|
return v.boss and v.boss.showdown and key ~= k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local pastries, amber, cerulean, crimson, verdant, violet =
|
---@param name string
|
||||||
bans(), bans(), bans(), bans(), bans(), bans()
|
---@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 {
|
SMODS.Challenge {
|
||||||
key = "Glass",
|
key = "Glass",
|
||||||
rules = {custom = {{id = "Roland_Glass1"}, {id = "Roland_Glass2"}}},
|
rules = {custom = multirule("Glass", 2)},
|
||||||
pronouns = "they_them",
|
pronouns = "they_them",
|
||||||
config = {extra = {odds = 2}},
|
config = {extra = {odds = 2}},
|
||||||
calculate = function(self, context)
|
calculate = function(self, context)
|
||||||
|
|
@ -61,6 +82,28 @@ SMODS.Challenge {
|
||||||
end,
|
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 {
|
SMODS.Challenge {
|
||||||
key = "Go",
|
key = "Go",
|
||||||
rules = {custom = {{id = "Roland_Go"}}},
|
rules = {custom = {{id = "Roland_Go"}}},
|
||||||
|
|
@ -291,8 +334,34 @@ SMODS.Challenge {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
q(function()
|
q {
|
||||||
|
|
||||||
|
blocking = false,
|
||||||
|
no_delete = true,
|
||||||
|
func = function()
|
||||||
|
if not Bakery_API or not Bakery_API.no_money_decks then
|
||||||
|
return false
|
||||||
|
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 {
|
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_TAGS, is_banned_from_pastry, pastries.banned_tags},
|
||||||
{G.P_BLINDS, is_banned_from_pastry, pastries.banned_other},
|
{G.P_BLINDS, is_banned_from_pastry, pastries.banned_other},
|
||||||
{G.P_CENTERS, is_center_banned_from_pastry, pastries.banned_cards},
|
{G.P_CENTERS, is_center_banned_from_pastry, pastries.banned_cards},
|
||||||
|
|
@ -304,14 +373,5 @@ q(function()
|
||||||
}:each(function(v)
|
}:each(function(v)
|
||||||
f(v[1]):where(v[2]):each(adder(v[3]))
|
f(v[1]):where(v[2]):each(adder(v[3]))
|
||||||
end)
|
end)
|
||||||
end)
|
end,
|
||||||
|
}
|
||||||
q(function()
|
|
||||||
if not G.P_CENTERS.j_Bakery_Spinner then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
f(spin_to_win.jokers):each(function(v)
|
|
||||||
v.id = "j_Bakery_Spinner"
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
|
||||||
|
|
@ -1320,3 +1320,15 @@ joker {
|
||||||
end
|
end
|
||||||
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,
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue