-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathror2spectral.lua
123 lines (112 loc) · 4.81 KB
/
ror2spectral.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
--- STEAMODDED HEADER
--- MOD_NAME: ror2spectral
--- MOD_ID: ror2spectral
--- MOD_AUTHOR: [aou]
--- MOD_DESCRIPTION: spectrals from Risk of Rain 2
----------------------------------------------
------------MOD CODE -------------------------
function SMODS.INIT.ror2spectral()
local c_localization = {
c_mountainshrine = {
name = "Shrine of the Mountain",
text = {
"During a {C:attention}Boss Blind{}, increase",
"chip requirement by {X:black,C:white}X2{}, but recieve",
"an {C:attention}Economy Tag{}"
}
},
c_ordershrine = {
name = "Shrine of Order",
text = {
"All jokers of the same {C:attention}rarity{} will be",
"converted to a random owned joker",
"in that rarity"
}
}
}
local spectrals = {
{
name = "Shrine of the Mountain", slug = "mountainshrine",
config = {},
},
{
name = "Shrine of Order", slug = "ordershrine",
config = {},
}
}
for k, v in pairs(spectrals) do
SMODS.Spectral:new(v.name, v.slug, v.config, {x = 0, y = 0}, c_localization["c_"..v.slug], 4, true, true):register()
SMODS.Sprite:new("c_"..v.slug, SMODS.findModByID("ror2spectral").path, "c_"..v.slug..".png", 71, 95, "asset_atli"):register()
end
function SMODS.Spectrals.c_mountainshrine.use(card, area, copier)
if G.STATE == 6 then
G.GAME.blind.chips = G.GAME.blind.chips * 2
G.GAME.blind.chip_text = number_format(G.GAME.blind.chips)
G.E_MANAGER:add_event(Event({trigger = 'after', delay = 0.4, func = function()
add_tag(Tag('tag_economy'))
play_sound('generic1', 0.6 + math.random()*0.1, 0.8)
play_sound('holo1', 1.1 + math.random()*0.1, 0.4)
card:juice_up(0.3, 0.5)
return true end }))
delay(0.6)
else
--sendDebugMessage(tostring(G.STATE).." this is the STATE! "..string.char(10))
local card = create_card('Spectral', G.consumeables, nil, nil, nil, nil, 'c_mountainshrine', 'deck')
card:add_to_deck()
G.consumeables:emplace(card)
end
end
function SMODS.Spectrals.c_mountainshrine.can_use(card)
if (G.STATE == G.STATES.SELECTING_HAND and G.GAME.blind.boss) or (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK) then return true end
end
function SMODS.Spectrals.c_ordershrine.use(card, area, copier)
local rarities = {}
for i = 1, #G.jokers.cards do
if not table.contains(rarities, G.jokers.cards[i].config.center.rarity) then
rarities[#rarities+1] = G.jokers.cards[i].config.center.rarity
end
end
for i = 1, #rarities do
local jokersofthatrarity = {}
for j = 1, #G.jokers.cards do
if G.jokers.cards[j].config.center.rarity == rarities[i] then
jokersofthatrarity[#jokersofthatrarity + 1] = G.jokers.cards[j]
end
end
local chosen_joker = jokersofthatrarity[math.random(#jokersofthatrarity)]
rarities[i] = chosen_joker
end
for j = 1, #G.jokers.cards do
for i = 1, #rarities do
if G.jokers.cards[j].config.center.rarity == rarities[i].config.center.rarity then
local eternaljoker = nil
if G.jokers.cards[j].ability.eternal then eternaljoker = G.jokers.cards[j] end
local sliced_card = G.jokers.cards[j]
sliced_card.getting_sliced = true
G.GAME.joker_buffer = G.GAME.joker_buffer - 1
G.E_MANAGER:add_event(Event({func = function()
G.GAME.joker_buffer = 0
sliced_card:start_dissolve({HEX("ff00ff")}, nil, 1.6)
return true end }))
G.E_MANAGER:add_event(Event({trigger = 'after', delay = 0.0, func = function()
local card = copy_card(eternaljoker or rarities[i], nil, nil, nil, nil)
card:add_to_deck()
G.jokers:emplace(card)
return true end }))
end
end
end
play_sound('timpani')
end
function SMODS.Spectrals.c_ordershrine.can_use(card)
if #G.jokers.cards > 0 then return true end
end
function table.contains(table, element)
for _, value in pairs(table) do
if value == element then return true end
end
return false
end
end
----------------------------------------------
------------MOD CODE END----------------------