Jane/src/edition.lua
2025-04-13 03:33:26 +02:00

198 lines
5.7 KiB
Lua

SMODS.Shader({key = "moire", path = "moire.fs"})
SMODS.Shader({key = "polygloss", path = "polygloss.fs"})
SMODS.Sound({key = "e_jumbo", path = "e_jumbo.ogg"})
SMODS.Sound({key = "e_moire", path = "e_moire.ogg"})
SMODS.Sound({key = "e_polygloss", path = "e_polygloss.ogg"})
local function allow_moire()
if Cryptid then
return true
end
for _, v in pairs(SMODS.find_card("j_jane_saint")) do
if v.is_attuned then
return true
end
end
return false
end
local function get_weight(self)
return G.GAME.edition_rate * self.weight * (allow_moire() and 1 or 0)
end
SMODS.Edition({
key = "polygloss",
loc_txt = {
name = "Polygloss",
label = "Polygloss",
text = Cryptid and {
"{C:chips}+#1#{}, {X:chips,C:white}x#2#{} & {X:chips,C:dark_edition}^#3#{} Chips",
"{C:mult}+#4#{}, {X:mult,C:white}x#5#{} & {X:mult,C:dark_edition}^#6#{} Mult",
"{C:money}$#7# {}when scored",
} or {
"{C:chips}+#1#{} & {X:chips,C:white}x#2#{}",
"{C:mult}+#3#{} & {X:mult,C:white}x#4#{}",
"{C:money}$#5# {}when scored",
},
},
config = {
mult = 1,
chips = 1,
x_mult = 1.1,
x_chips = 1.1,
p_dollars = 1,
e_chips = Cryptid and 1.01 or nil,
e_mult = Cryptid and 1.01 or nil,
},
sound = {sound = "jane_e_polygloss", per = 1.2, vol = 0.4},
weight = 8,
extra_cost = 4,
in_shop = true,
shader = "polygloss",
apply_to_float = false,
loc_vars = function(self, _, _)
local vars = {self.config.chips, self.config.x_chips}
vars[#vars + 1] = self.config.e_chips
vars[#vars + 1] = self.config.mult
vars[#vars + 1] = self.config.x_mult
vars[#vars + 1] = self.config.e_mult
vars[#vars + 1] = self.config.p_dollars
return {vars = vars}
end,
calculate = function(_, card, context)
if context.pre_joker then
return {
mult = card.edition.mult,
chips = card.edition.chips,
}
elseif context.post_joker then
return {
e_mult = card.edition.e_mult,
x_mult = card.edition.x_mult,
e_chips = card.edition.e_chips,
x_chips = card.edition.x_chips,
p_dollars = card.edition.p_dollars,
}
elseif context.main_scoring and context.cardarea == G.play then
return {
mult = card.edition.mult,
chips = card.edition.chips,
e_mult = card.edition.e_mult,
x_mult = card.edition.x_mult,
e_chips = card.edition.e_chips,
x_chips = card.edition.x_chips,
p_dollars = card.edition.p_dollars,
}
end
end,
get_weight = get_weight,
})
local orig_draw_shader = Sprite.draw_shader
function Sprite:draw_shader(_shader, ...)
if _shader ~= "jane_jumbo" then
return orig_draw_shader(self, _shader, ...)
end
end
local jumbo_modifier = Cryptid and 100 or 2
SMODS.Edition({
key = "jumbo",
loc_txt = {
name = "Jumbo",
label = "Jumbo",
text = {
"All card values are",
"{C:attention}multiplied{} by {C:attention}up to " .. jumbo_modifier,
"{C:inactive}(If possible)",
"{C:inactive,E:1,s:0.7}Whoa, it's huge!!{}",
},
},
on_apply = function(card)
G.E_MANAGER:add_event(Event({
blocking = false,
blockable = false,
func = function()
Jane.resize(card, Jane.config.wee_sizemod)
return true
end,
}))
local obj = card:gc()
if obj.set == "Booster" or obj.jumbo_mod then
jumbo_modifier = obj.jumbo_mod or 10
end
if card.added_to_deck then
card:remove_from_deck()
end
Jane.misprintize(card, {min = jumbo_modifier, max = jumbo_modifier}, nil, true)
if card.added_to_deck then
card:add_to_deck()
end
end,
on_remove = function(card)
G.E_MANAGER:add_event(Event({
blocking = false,
blockable = false,
func = function()
Jane.resize(card, 1 / Jane.config.wee_sizemod)
return true
end,
}))
local was_added = card.added_to_deck
if was_added then
card:remove_from_deck()
end
Jane.misprintize(card, {min = 1 / jumbo_modifier, max = 1 / jumbo_modifier}, nil, true)
if was_added then
card:add_to_deck()
end
end,
sound = {sound = "jane_e_jumbo", per = 1, vol = 0.5},
weight = 3,
extra_cost = 5,
in_shop = true,
shader = false,
apply_to_float = false,
get_weight = get_weight,
})
SMODS.Edition({
key = "moire",
loc_txt = {
name = "Moire",
label = "Moire",
text = {"{X:chips,C:dark_edition}^#1#{C:chips} Chips{}, {X:mult,C:dark_edition}^#2#{C:mult} Mult"},
},
config = {e_chips = Cryptid and 0.8 or 0.9, e_mult = Cryptid and 1.2 or 1.1},
sound = {sound = "jane_e_moire", per = 1, vol = 0.7},
weight = 1,
extra_cost = 6,
in_shop = true,
shader = "moire",
in_pool = allow_moire,
apply_to_float = false,
get_weight = function(self)
return G.GAME.edition_rate * self.weight
end,
loc_vars = function(self, _, _)
return {vars = {self.config.e_chips, self.config.e_mult}}
end,
calculate = function(self, _, context)
if context.post_joker or context.main_scoring and context.cardarea == G.play then
return {e_chips = self.config.e_chips, e_mult = self.config.e_mult}
end
end,
})