Jane/src/booster.lua

433 lines
16 KiB
Lua

SMODS.Atlas {
px = 71,
py = 95,
key = "janebooster",
path = Jane.config.texture_pack .. "/p_jane_boosters.png",
}
for i = 1, 2 do
SMODS.Booster {
key = "ministandard" .. i,
loc_txt = {
name = "Mini Standard Pack",
text = {
"Choose {C:attention}#1#{} of up to",
"{C:attention}#2# playing cards{} to",
"add to your deck",
},
},
atlas = "janebooster",
pos = {x = 6, y = i - 1},
weight = 0.4,
cost = 2,
config = {extra = 2, choose = 1},
loc_vars = function(_, _, card)
return {vars = {card.ability.choose, card.ability.extra}}
end,
create_card = function(_, _, _)
local edition = poll_edition("standard_edition" .. G.GAME.round_resets.ante, 2, true)
local seal = SMODS.poll_seal({mod = 10})
return {
set = (pseudorandom(pseudoseed("stdset" .. G.GAME.round_resets.ante)) > 0.6) and "Enhanced" or "Base",
edition = edition,
seal = seal,
area = G.pack_cards,
skip_materialize = true,
soulable = true,
key_append = "sta",
}
end,
create_UIBox = function(_)
return create_UIBox_standard_pack()
end,
ease_background_colour = function(_)
ease_background_colour_blind(G.STATES.STANDARD_PACK)
end,
particles = function(_)
G.booster_pack_sparkles = Particles(1, 1, 0, 0, {
timer = 0.015,
scale = 0.3,
initialize = true,
lifespan = 3,
speed = 0.2,
padding = -1,
attach = G.ROOM_ATTACH,
colours = {G.C.BLACK, G.C.RED},
fill = true,
})
G.booster_pack_sparkles.fade_alpha = 1
G.booster_pack_sparkles:fade(1, 0)
end,
}
end
for i = 1, 2 do
SMODS.Booster {
key = "miniarcana" .. i,
loc_txt = {
name = "Mini Arcana Pack",
text = {
"Choose {C:attention}#1#{} of up to",
"{C:attention}#2# {C:tarot}Tarot{} cards to",
"be used immediately",
},
},
atlas = "janebooster",
pos = {x = 3 + i, y = 1},
weight = 0.4,
cost = 2,
config = {extra = 2, choose = 1},
draw_hand = true,
loc_vars = function(_, _, card)
return {vars = {card.ability.choose, card.ability.extra}}
end,
create_card = function(_, _, _)
if G.GAME.used_vouchers.v_omen_globe and pseudorandom("omen_globe") > 0.8 then
return {
set = "Spectral",
soulable = true,
key_append = "ar2",
area = G.pack_cards,
skip_materialize = true,
}
end
return {
set = "Tarot",
soulable = true,
key_append = "ar1",
area = G.pack_cards,
skip_materialize = true,
}
end,
create_UIBox = function(_)
return create_UIBox_arcana_pack()
end,
ease_background_colour = function(_)
ease_background_colour_blind(G.STATES.TAROT_PACK)
end,
particles = function(_)
G.booster_pack_sparkles = Particles(1, 1, 0, 0, {
timer = 0.015,
scale = 0.2,
initialize = true,
lifespan = 1,
speed = 1.1,
padding = -1,
attach = G.ROOM_ATTACH,
colours = {G.C.WHITE, lighten(G.C.PURPLE, 0.4), lighten(G.C.PURPLE, 0.2), lighten(G.C.GOLD, 0.2)},
fill = true,
})
G.booster_pack_sparkles.fade_alpha = 1
G.booster_pack_sparkles:fade(1, 0)
end,
}
end
for i = 1, 2 do
SMODS.Booster {
key = "minicelestial" .. i,
atlas = "janebooster",
loc_txt = {
name = "Mini Celestial Pack",
text = {
"Choose {C:attention}#1#{} of up to",
"{C:attention}#2# {C:planet}Planet{} cards to",
"be used immediately",
},
},
config = {extra = 2, choose = 1},
pos = {x = 3 + i, y = 0},
cost = 2,
weight = 0.4,
loc_vars = function(_, _, card)
return {vars = {card.ability.choose, card.ability.extra}}
end,
create_card = function(_, _, index)
if not G.GAME.used_vouchers.v_telescope or index ~= 1 then
return {
set = "Planet",
area = G.pack_cards,
skip_materialize = true,
soulable = true,
key_append = "pl1",
}
end
local planet, hand, tally = nil, nil, 0
for _, v in ipairs(G.handlist) do
if G.GAME.hands[v].visible and G.GAME.hands[v].played > tally then
hand = v
tally = G.GAME.hands[v].played
end
end
if hand then
for _, v in pairs(G.P_CENTER_POOLS.Planet) do
if v.config.hand_type == hand then
planet = v.key
end
end
end
return {
key = planet,
set = "Planet",
soulable = true,
key_append = "pl1",
area = G.pack_cards,
skip_materialize = true,
}
end,
create_UIBox = function(_)
return create_UIBox_celestial_pack()
end,
ease_background_colour = function(_)
ease_background_colour_blind(G.STATES.PLANET_PACK)
end,
particles = function(_)
G.booster_pack_stars = Particles(1, 1, 0, 0, {
fill = true,
scale = 0.1,
speed = 0.1,
timer = 0.07,
padding = -4,
lifespan = 15,
initialize = true,
attach = G.ROOM_ATTACH,
colours = {G.C.WHITE, HEX("a7d6e0"), HEX("fddca0")},
})
G.booster_pack_meteors = Particles(1, 1, 0, 0, {
speed = 4,
timer = 2,
fill = true,
scale = 0.05,
lifespan = 1.5,
attach = G.ROOM_ATTACH,
colours = {G.C.WHITE},
})
end,
set_ability = function(_, card, _, _)
card.ability = card.ability or {}
card.ability.set = "Booster"
card.ability.name = "Mini Celestial Pack"
end,
}
end
for i = 1, 2 do
SMODS.Booster {
key = "minispectral" .. i,
atlas = "janebooster",
loc_txt = {
name = "Mini Spectral Pack",
text = {
"Choose {C:attention}#1#{} of up to",
"{C:attention}#2# {C:spectral}Spectral{} cards to",
"be used immediately",
},
},
config = {extra = 1, choose = 1},
pos = {x = 3 + i, y = 2},
cost = 2,
weight = 0.225,
draw_hand = true,
loc_vars = function(_, _, card)
return {vars = {card.ability.choose, card.ability.extra}}
end,
create_card = function(_, _, _)
return {
soulable = true,
set = "Spectral",
key_append = "spe",
area = G.pack_cards,
skip_materialize = true,
}
end,
create_UIBox = function(_)
return create_UIBox_spectral_pack()
end,
ease_background_colour = function(_)
ease_background_colour_blind(G.STATES.SPECTRAL_PACK)
end,
particles = function(_)
G.booster_pack_sparkles = Particles(1, 1, 0, 0, {
scale = 0.1,
fill = true,
speed = 0.2,
lifespan = 3,
padding = -1,
timer = 0.015,
initialize = true,
attach = G.ROOM_ATTACH,
colours = {G.C.WHITE, lighten(G.C.GOLD, 0.2)},
})
G.booster_pack_sparkles.fade_alpha = 1
G.booster_pack_sparkles:fade(1, 0)
end,
}
end
if Cryptid then
SMODS.Booster {
atlas = "janebooster",
key = "minicode",
loc_txt = {
name = "Mini Code Pack",
text = {
"Choose {C:attention}#1#{} of up to",
"{C:attention}#2# {C:green}Code{} cards to",
"be used immediately",
},
},
pos = {x = 6, y = 2},
config = {extra = 2, choose = 1},
cost = 2,
weight = 0.24,
create_card = function(_, _)
return create_card("Code", G.pack_cards, nil, nil, true, true, nil, "cry_program_3")
end,
ease_background_colour = function(_)
ease_colour(G.C.DYN_UI.MAIN, G.C.SET.Code)
ease_background_colour({new_colour = G.C.SET.Code, special_colour = G.C.BLACK, contrast = 2})
end,
loc_vars = function(self, _, card)
return {
vars = {
card and card.ability.choose or self.config.choose,
card and card.ability.extra or self.config.extra,
},
}
end,
cry_digital_hallucinations = {
colour = HEX("14b341"),
loc_key = "cry_plus_code",
create = function()
local ccard = create_card("Code", G.consumeables, nil, nil, nil, nil, nil, "diha")
ccard:set_edition({negative = true}, true)
ccard:add_to_deck()
G.consumeables:emplace(ccard)
end,
},
}
end
for i = 1, 2 do
SMODS.Booster {
key = "minitoken" .. i,
atlas = "janebooster",
loc_txt = {
name = "Mini Token Pack",
text = {
"Choose {C:attention}#1#{} of up to",
"{C:attention}#2# Token {}cards to",
"be used immediately",
},
},
pos = {x = i - 1, y = 5},
config = {extra = 2, choose = 1},
cost = 2,
weight = 0.2,
loc_vars = function(_, _, card)
return {vars = {card.ability.choose, card.ability.extra}}
end,
create_card = function(_, _, _)
return create_card("jane_tokens", G.pack_cards, nil, nil, true, true, nil, "jane_tokens" .. i)
end,
create_UIBox = function(_)
local size = SMODS.OPENED_BOOSTER.ability.extra
G.pack_cards = CardArea(
G.ROOM.T.x + 9 + G.hand.T.x, G.hand.T.y,
math.max(1, math.min(size, 5)) * G.CARD_W * 1.1,
1.05 * G.CARD_H,
{card_limit = size, highlight_limit = 1, type = "consumeable"}
)
local t = {
n = G.UIT.ROOT,
config = {align = "tm", r = 0.15, colour = G.C.CLEAR, padding = 0.15},
nodes = {
{
n = G.UIT.R,
config = {align = "cl", colour = G.C.CLEAR, r = 0.15, padding = 0.1, minh = 2, shadow = true},
nodes = {
{
n = G.UIT.R,
config = {align = "cm"},
nodes = {
{
n = G.UIT.C,
config = {align = "cm", padding = 0.1},
nodes = {
{
n = G.UIT.C,
config = {align = "cm", r = 0.2, colour = G.C.CLEAR, shadow = true},
nodes = {
{n = G.UIT.O, config = {object = G.pack_cards}}},
}},
}},
},
{n = G.UIT.R, config = {align = "cm"}, nodes = {}},
{
n = G.UIT.R,
config = {align = "tm"},
nodes = {
{n = G.UIT.C, config = {align = "tm", padding = 0.05, minw = 2.4}, nodes = {}},
{
n = G.UIT.C,
config = {align = "tm", padding = 0.05},
nodes = {
UIBox_dyn_container({
{
n = G.UIT.C,
config = {align = "cm", padding = 0.05, minw = 4},
nodes = {
{
n = G.UIT.R,
config = {align = "bm", padding = 0.05},
nodes = {
{n = G.UIT.O, config = {object = DynaText({string = {"Token Pack"}, colours = {G.C.WHITE}, shadow = true, rotate = true, bump = true, spacing = 2, scale = 0.7, maxw = 4, pop_in = 0.5})}}},
},
{
n = G.UIT.R,
config = {align = "bm", padding = 0.05},
nodes = {
{n = G.UIT.O, config = {object = DynaText({string = {localize("k_choose") .. " "}, colours = {G.C.WHITE}, shadow = true, rotate = true, bump = true, spacing = 2, scale = 0.5, pop_in = 0.7})}},
{n = G.UIT.O, config = {object = DynaText({string = {{ref_table = G.GAME, ref_value = "pack_choices"}}, colours = {G.C.WHITE}, shadow = true, rotate = true, bump = true, spacing = 2, scale = 0.5, pop_in = 0.7})}}},
}},
},
})},
},
{
n = G.UIT.C,
config = {align = "tm", padding = 0.05, minw = 2.4},
nodes = {
{n = G.UIT.R, config = {minh = 0.2}, nodes = {}},
{
n = G.UIT.R,
config = {align = "tm", padding = 0.2, minh = 1.2, minw = 1.8, r = 0.15, colour = G.C.GREY, one_press = true, button = "skip_booster", hover = true, shadow = true, func = "can_skip_booster"},
nodes = {
{n = G.UIT.T, config = {text = localize("b_skip"), scale = 0.5, colour = G.C.WHITE, shadow = true, focus_args = {button = "y", orientation = "bm"}, func = "set_button_pip"}}},
}},
}},
}},
}},
}
return t
end,
ease_background_colour = function(_)
ease_background_colour {new_colour = HEX(i == 1 and "F0C197" or "FD5F55"), special_colour = HEX("000000"), contrast = 5}
end,
in_pool = function(_, _)
return G.GAME.used_vouchers.v_jane_token_voucher
end,
}
end