Skip to content

Commit eebb48e

Browse files
Swap Necromancer lovely patch to hook
1 parent aa02c35 commit eebb48e

File tree

3 files changed

+115
-22
lines changed

3 files changed

+115
-22
lines changed

items/test.lua

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ local test3 = {
119119
},
120120
},
121121
loc_vars = function(self, info_queue, card)
122-
local a, b, c, d, e = Cryptid.enhanced_deck_info()
122+
local a, b, c, d, e = 1, 2, 3, 4, 5
123123
return { vars = { a, b, c, d, e } }
124124
end,
125125
cry_credits = {
@@ -190,4 +190,84 @@ local test4 = {
190190
end
191191
end,
192192
}
193-
return { items = { test, test2, test3, test4 }, disabled = true }
193+
local kidnap2 = {
194+
object_type = "Joker",
195+
name = "cry-kidnap2",
196+
key = "kidnap2",
197+
pos = { x = 1, y = 2 },
198+
config = {
199+
extra = 1,
200+
},
201+
rarity = 1,
202+
cost = 4,
203+
loc_txt = {
204+
name = "asd",
205+
text = {
206+
"Earn {C:money}$#1#{} at end of round",
207+
"per unique {C:attention}Type Mult{} or",
208+
"{C:attention}Type Chips{} Joker sold this run",
209+
"{C:inactive}(Currently {C:money}$#2#{C:inactive})",
210+
},
211+
},
212+
blueprint_compat = false,
213+
loc_vars = function(self, info_queue, center)
214+
local value = 0
215+
if G.GAME and G.GAME.jokers_sold then
216+
for _, v in ipairs(G.GAME.jokers_sold) do
217+
if
218+
G.P_CENTERS[v].effect == "Type Mult"
219+
or G.P_CENTERS[v].effect == "Cry Type Mult"
220+
or G.P_CENTERS[v].effect == "Cry Type Chips"
221+
or G.P_CENTERS[v].effect == "Boost Kidnapping"
222+
or (
223+
G.P_CENTERS[v].name == "Sly Joker"
224+
or G.P_CENTERS[v].name == "Wily Joker"
225+
or G.P_CENTERS[v].name == "Clever Joker"
226+
or G.P_CENTERS[v].name == "Devious Joker"
227+
or G.P_CENTERS[v].name == "Crafty Joker"
228+
)
229+
then
230+
value = value + 1
231+
end
232+
end
233+
end
234+
return { vars = { center.ability.extra, center.ability.extra * value } }
235+
end,
236+
atlas = "atlasone",
237+
calc_dollar_bonus = function(self, card)
238+
local value = 0
239+
for _, v in ipairs(G.GAME.jokers_sold) do
240+
if
241+
G.P_CENTERS[v].effect == "Type Mult"
242+
or G.P_CENTERS[v].effect == "Cry Type Mult"
243+
or G.P_CENTERS[v].effect == "Cry Type Chips"
244+
or G.P_CENTERS[v].effect == "Boost Kidnapping"
245+
or (
246+
G.P_CENTERS[v].name == "Sly Joker"
247+
or G.P_CENTERS[v].name == "Wily Joker"
248+
or G.P_CENTERS[v].name == "Clever Joker"
249+
or G.P_CENTERS[v].name == "Devious Joker"
250+
or G.P_CENTERS[v].name == "Crafty Joker"
251+
)
252+
then
253+
value = value + 1
254+
end
255+
end
256+
if value == 0 then
257+
return
258+
end
259+
return card.ability.extra * value
260+
end,
261+
cry_credits = {
262+
idea = {
263+
"Jevonn",
264+
},
265+
art = {
266+
"Jevonn",
267+
},
268+
code = {
269+
"Jevonn",
270+
},
271+
},
272+
}
273+
return { items = { test, test2, test3, test4, kidnap2 }, disabled = true }

lib/overrides.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ function Game:init_game_object()
176176
g.monstermult = 1
177177
-- Create G.GAME.events when starting a run, so there's no errors
178178
g.events = {}
179+
g.jokers_sold = {}
179180
return g
180181
end
181182

@@ -474,6 +475,38 @@ function Card:set_cost()
474475
self.sell_cost_label = 0
475476
end
476477
end
478+
local sell_card_stuff = Card.sell_card
479+
function Card:sell_card()
480+
if self.config.center.set == "Joker" then
481+
if self.config.center.key ~= "j_cry_necromancer" then
482+
local contained = false
483+
for _, v in ipairs(G.GAME.jokers_sold) do
484+
if v == self.config.center.key then
485+
contained = true
486+
break
487+
end
488+
end
489+
if not contained then
490+
table.insert(G.GAME.jokers_sold, self.config.center.key)
491+
end
492+
end
493+
-- Add Jolly Joker to the pool if card was treated as Jolly Joker
494+
if self:is_jolly() then
495+
local contained = false
496+
for _, v in ipairs(G.GAME.jokers_sold) do
497+
if v == "j_jolly" then
498+
contained = true
499+
break
500+
end
501+
end
502+
if not contained then
503+
table.insert(G.GAME.jokers_sold, "j_jolly")
504+
end
505+
end
506+
end
507+
--G.P_CENTERS.j_jolly
508+
sell_card_stuff(self)
509+
end
477510

478511
-- Modify to display badges for credits and some gameset badges
479512
-- todo: make this optional

lovely/misc_joker.toml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,3 @@ position = "at"
2020
payload = "ret.playing_card = ret.playing_card or {}"
2121
match_indent = true
2222

23-
# Necromancer - Joker Sell list
24-
[[patches]]
25-
[patches.pattern]
26-
target = "card.lua"
27-
pattern = 'local eval, post = eval_card(self, {selling_self = true})'
28-
position = "before"
29-
payload = '''
30-
if self.config.center.set == "Joker" and self.config.center.key ~= "j_cry_necromancer" then
31-
if G.GAME.jokers_sold then
32-
local contained = false
33-
for i = 1, #G.GAME.jokers_sold do
34-
if self.config.center.key == G.GAME.jokers_sold[i] then contained = true end
35-
end
36-
if not contained then table.insert(G.GAME.jokers_sold, self.config.center.key) end
37-
else
38-
G.GAME.jokers_sold = {self.config.center.key}
39-
end
40-
end
41-
'''
42-
match_indent = true

0 commit comments

Comments
 (0)