-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbacks.lua
More file actions
200 lines (190 loc) · 6.92 KB
/
Copy pathbacks.lua
File metadata and controls
200 lines (190 loc) · 6.92 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
----------------------------------------------
------------MOD CODE -------------------------
SMODS.Atlas {
key = "wafflemod_deckAtlas",
path = "decks.png",
px = 71,
py = 95,
}
-- Waffle Deck
SMODS.Back {
key = "waffle",
atlas = "wafflemod_deckAtlas",
pos = { x = 0, y = 0 },
unlocked = true,
discovered = true,
config = {
extra = {
odds = 5
}
},
loc_vars = function(self, info_queue)
return { vars = { (G.GAME.probabilities.normal or 1), self.config.extra.odds } }
end,
calculate = function(self, back, context)
if context.create_shop_card then
local isJoker = context.set == "Joker"
if isJoker then
local rollToReplace = SMODS.pseudorandom_probability(back, "waffleDeckJokerRng", 1,
self.config.extra.odds)
if rollToReplace then
--print("replaced a joker")
return {
shop_create_flags = {
set = "wafflemod_jokers"
}
}
else
-- print("chance failed")
end
else
--print("not joker")
end
end
end
}
-- Blighted Deck
SMODS.Back {
key = "blighted",
atlas = "wafflemod_deckAtlas",
pos = { x = 2, y = 0 },
discovered = true,
config = {
vouchers = { "v_clearance_sale" },
extra = {
debuffed_sales_needed = 4,
joker_slot_gain = 1
}
},
loc_vars = function(self, info_queue)
local remaining = self.config.extra.debuffed_sales_needed
if G.GAME then
remaining = remaining - (G.GAME.debuffed_joker_sales or 0) % remaining
end
return {
vars = {
self.config.extra.joker_slot_gain, self.config.extra.debuffed_sales_needed, remaining
}
}
end,
calculate = function(self, back, context)
-- if context.modify_shop_card and context.card.ability.set == "Joker" then
-- makePerishable(context.card)
-- end
-- if context.open_booster and G.pack_cards and G.pack_cards.cards then
-- for _, card in pairs(G.pack_cards.cards) do
-- if card.ability.set == "Joker" then
-- makePerishable(card)
-- end
-- end
-- end
if context.selling_card then
if context.card.debuff and context.card.ability.set == "Joker" then
G.GAME.debuffed_joker_sales = (G.GAME.debuffed_joker_sales or 0) + 1
if G.GAME.debuffed_joker_sales % self.config.extra.debuffed_sales_needed == 0 then
if G.jokers then
G.jokers.config.card_limit = G.jokers.config.card_limit + self.config.extra.joker_slot_gain
if G.deck and G.deck.cards and G.deck.cards[1] then
return {
message_card = G.deck.cards[1],
message = localize('k_upgrade_ex'),
func = function()
G.E_MANAGER:add_event(Event({
func = function()
play_sound('highlight2', 0.685, 0.2)
play_sound('generic1')
return true
end
}))
end
}
end
end
end
end
end
end
}
local emplaceRef = CardArea.emplace
function CardArea.emplace(self, card, ...)
if G.GAME and (WaffleMod.getCurrentBack() == "b_wafflemod_blighted" or G.GAME.selected_sleeve == "sleeve_wafflemod_blighted") and (self == G.pack_cards or self == G.shop_jokers or (self == G.jokers and not card:is_rarity(4))) then
WaffleMod.blightedMakePerishable(card)
end
emplaceRef(self, card, ...)
end
-- Hunting Deck
SMODS.Back {
key = "hunting",
config = {
extra = {
voucher = "v_wafflemod_hunting_license",
joker = "j_wafflemod_trophy_hunters_tricorn"
},
},
discovered = true,
loc_vars = function(self, info_queue)
local key
if WaffleMod.config.boss_jokers.enabled then
key = "b_wafflemod_hunting"
else
key = "b_wafflemod_hunting_disabled"
end
return { key = key }
end,
atlas = "wafflemod_deckAtlas",
pos = { x = 3, y = 0 },
unlocked = true,
apply = function(self, back) -- IK config alone can be used for the voucher & joker but this is for the configuration check functionality
if WaffleMod.config.boss_jokers.enabled then
G.GAME.used_vouchers[self.config.extra.voucher] = true
G.GAME.starting_voucher_count = (G.GAME.starting_voucher_count or 0) + 1
G.E_MANAGER:add_event(Event({ -- Adding back objects of any type from a deck MUST be done within an event
func = function()
Card.apply_to_run(nil, G.P_CENTERS[self.config.extra.voucher])
return true
end
}))
delay(0.4)
G.E_MANAGER:add_event(Event({
func = function()
if G.GAME.selected_sleeve ~= "sleeve_wafflemod_hunting" then -- THT creation if matching sleeve is used is handled in sleeves.lua
local joker = SMODS.add_card({ key = self.config.extra.joker, no_edition = true })
joker:start_materialize()
end
return true
end
}))
end
end
}
-- Patchwork Deck
local juryRiggedDebuffedJokerCount = 1 -- Defined here for access in later hook
SMODS.Back {
key = "patchwork",
atlas = "wafflemod_deckAtlas",
pos = { x = 1, y = 0 },
config = {
joker_slot = 1,
debuffed_slots = juryRiggedDebuffedJokerCount
},
unlocked = true,
discovered = true,
loc_vars = function(self, info_queue)
return { vars = { self.config.joker_slot, self.config.debuffed_slots } }
end
}
-- Patchwork update hook (this disables the rightmost joker when using the deck)
local updateRef = Game.update
function Game:update(dt)
if WaffleMod.usingBack("b_wafflemod_patchwork") and G.jokers and G.jokers.cards then
local jokerCards = G.jokers.cards
for i = 1, #jokerCards do
if i > #jokerCards - juryRiggedDebuffedJokerCount then
SMODS.debuff_card(jokerCards[i], true, "juryRiggedDebuff")
else
SMODS.debuff_card(jokerCards[i], false, "juryRiggedDebuff")
end
end
end
return updateRef(self, dt)
end