Jane/src/spectral.lua

307 lines
9.2 KiB
Lua

SMODS.Atlas {
key = "janertarots",
px = 71,
py = 95,
path = Jane.config.texture_pack .. "/c_jane_reversetarots.png",
}
SMODS.Sound({key = "draw", path = "draw.ogg"})
local function conjure(card, number)
for _ = 1, math.min(
math.ceil(card.ability.extra.spectrals) * number,
G.consumeables.config.card_limit - #G.consumeables.cards
) do
Jane.q(function()
if G.consumeables.config.card_limit <= #G.consumeables.cards then
return
end
play_sound("jane_draw")
local spectral = create_card("Spectral", G.consumeables, nil, nil, nil, nil, nil, "pri")
spectral:add_to_deck()
G.consumeables:emplace(spectral)
card:juice_up(0.3, 0.5)
end, 0.4)
end
end
local function create_full_deck(enhancement, edition, amount, emplacement)
local cards = {}
for _, v in pairs(G.P_CARDS) do
for i = 1, amount or 1 do
Jane.q(function()
cards[i] = true
G.playing_card = (G.playing_card and G.playing_card + 1) or 1
local card = Card(
G.play.T.x + G.play.T.w / 2,
G.play.T.y, G.CARD_W, G.CARD_H,
v,
enhancement or G.P_CENTERS.c_base,
{playing_card = G.playing_card}
)
if edition then
card:set_edition(type(edition) == "table" and edition or {[edition] = true}, true, true)
end
play_sound("card1")
table.insert(G.playing_cards, card)
card:add_to_deck()
if emplacement then
emplacement:emplace(card)
else
G.deck:emplace(card)
end
end, 0.1)
end
end
Jane.q(function()
if next(cards) then
playing_card_joker_effects(cards)
end
end)
end
local function randomize(targets, noanim)
if #targets <= 0 then
return
end
if noanim then
for i = 1, #targets do
local card = targets[i]
card:set_base(pseudorandom_element(G.P_CARDS))
card:set_ability(
pseudorandom(pseudoseed("chancetime")) > 1 / (#G.P_CENTER_POOLS["Enhanced"] + 1) and
pseudorandom_element(G.P_CENTER_POOLS["Enhanced"], pseudoseed("spectral_chance")) or
G.P_CENTERS["c_base"]
)
local edition_rate = 2
card:set_edition(poll_edition("standard_edition" .. G.GAME.round_resets.ante, edition_rate, true), true, true)
local seal_rate = 10
local seal_poll = pseudorandom(pseudoseed("stdseal" .. G.GAME.round_resets.ante))
if seal_poll > 1 - 0.02 * seal_rate then
local seal_type = pseudorandom(pseudoseed("stdsealtype" .. G.GAME.round_resets.ante))
local seal_list = {}
for k, _ in pairs(G.P_SEALS) do
table.insert(seal_list, k)
end
seal_type = math.floor(seal_type * #seal_list)
card:set_seal(seal_list[seal_type], true, true)
else
card:set_seal(nil, true, true)
end
card:juice_up(0.3, 0.3)
end
else
for i = 1, #targets do
local percent = 1.15 - (i - 0.999) / (#G.hand.cards - 0.998) * 0.3
Jane.q(function()
targets[i]:flip()
play_sound("card1", percent)
targets[i]:juice_up(0.3, 0.3)
end, 0.15)
end
delay(0.2)
for i = 1, #targets do
local percent = 0.85 + (i - 0.999) / (#G.hand.cards - 0.998) * 0.3
Jane.q(function()
local card = targets[i]
card:set_base(pseudorandom_element(G.P_CARDS))
card:set_ability(pseudorandom_element(G.P_CENTER_POOLS["Enhanced"]))
local edition_rate = 2
card:set_edition(poll_edition("standard_edition" .. G.GAME.round_resets.ante, edition_rate, true))
local seal_rate = 10
local seal_poll = pseudorandom(pseudoseed("stdseal" .. G.GAME.round_resets.ante))
if seal_poll > 1 - 0.02 * seal_rate then
local seal_type = pseudorandom(pseudoseed("stdsealtype" .. G.GAME.round_resets.ante))
local seal_list = {}
for k, _ in pairs(G.P_SEALS) do
table.insert(seal_list, k)
end
seal_type = math.floor(seal_type * #seal_list)
card:set_seal(seal_list[seal_type])
else
card:set_seal()
end
card:flip()
play_sound("card3", percent, 0.6)
card:juice_up(0.3, 0.3)
end, 0.1)
end
end
end
SMODS.Consumable {
key = "obfuscation",
atlas = "janeacc",
set = "Spectral",
loc_txt = {
name = "Obfuscation",
text = {
"{C:green,E:1}Randomises{} all cards in hand",
"{C:inactive}(Rank, seal, edition,",
"{C:inactive}enhancement, and suit)",
},
},
pos = {x = 0, y = 4},
cost = 4,
can_use = function(_, _)
return Jane.can_use() and #((G.hand or {}).cards or {}) > 0
end,
use = function(_, card, _, _)
Jane.q(function()
play_sound("tarot1")
card:juice_up(0.3, 0.5)
end, 0.4)
randomize(G.hand.cards)
delay(0.5)
end,
}
SMODS.Consumable {
key = "conjure",
set = "Spectral",
atlas = "janeacc",
loc_txt = {
name = "Conjure",
text = {
"Creates {C:attention}#1#",
"{C:spectral}Spectral {}cards",
"{C:inactive}(Must have room)",
},
},
config = {extra = {spectrals = 2}},
pos = {x = 2, y = 4},
cost = 4,
loc_vars = function(_, _, center)
return {vars = {math.ceil(center.ability.extra.spectrals)}}
end,
can_use = Jane.can_use,
use = function(_, card, _, _)
conjure(card, 1)
delay(0.6)
end,
bulk_use = function(_, card, _, _, number)
conjure(card, number)
delay(0.6)
end,
}
local shadows_limit = 25
SMODS.Consumable {
key = "shadows",
set = "Spectral",
atlas = "janeacc",
loc_txt = {
name = "Shadows",
text = {
"Create {C:attention}#1#{} {C:green}random {C:dark_edition}Negative",
"{C:attention}Perishable {C:attention}Jokers{}, set {C:money}sell",
"{C:money}value {}of {C:attention}all Jokers {}to {C:money}$0",
},
},
config = {extra = {shadows = 2}},
pos = {x = 3, y = 4},
cost = 4,
loc_vars = function(_, _, card)
return {vars = {math.min(((card.ability or {}).extra or {}).shadows or 2, shadows_limit)}}
end,
can_use = Jane.can_use,
use = function(_, card, _, _)
for _ = 1, math.min(card.ability.extra.shadows, shadows_limit) do
local joker = create_card("Joker", G.jokers, nil, nil, nil, nil, nil, "phantom")
joker:set_edition({negative = true})
joker.ability.eternal = false
joker.ability.perishable = true
joker.ability.perish_tally = 5
joker:add_to_deck()
G.jokers:emplace(joker)
end
delay(0.6)
for i = 1, #G.jokers.cards do
G.jokers.cards[i].base_cost = 0
G.jokers.cards[i].extra_cost = 0
G.jokers.cards[i].cost = 0
G.jokers.cards[i].sell_cost = 0
G.jokers.cards[i].sell_cost_label = G.jokers.cards[i].facing == "back" and "?" or
G.jokers.cards[i].sell_cost
end
end,
bulk_use = function(_, card, _, _, number)
for _ = 1, math.min(card.ability.extra.shadows, 25) * number do
local joker = create_card("Joker", G.jokers, nil, nil, nil, nil, nil, "phantom")
joker.no_forced_edition = true
joker:set_edition({negative = true})
joker.no_forced_edition = nil
joker.ability.eternal = false
joker.ability.perishable = true
joker.ability.perish_tally = 5
joker:add_to_deck()
G.jokers:emplace(joker)
end
delay(0.6)
for i = 1, #G.jokers.cards do
G.jokers.cards[i].base_cost = 0
G.jokers.cards[i].extra_cost = 0
G.jokers.cards[i].cost = 0
G.jokers.cards[i].sell_cost = 0
G.jokers.cards[i].sell_cost_label = G.jokers.cards[i].facing == "back" and "?" or
G.jokers.cards[i].sell_cost
end
end,
}
SMODS.Consumable {
key = "rift",
atlas = "janeacc",
set = "Spectral",
loc_txt = {
name = "Rift",
text = {
"{C:attention}Reset {}your deck to a",
"{C:attention}standard 52-card deck",
},
},
pos = {x = 4, y = 4},
cost = 4,
can_use = Jane.can_use,
use = function(_, _, _, _)
Jane.q(function()
for _, v in pairs(G.playing_cards) do
v:start_dissolve()
end
end)
delay(2)
create_full_deck()
end,
}