Skip to content

Commit 69fcd4f

Browse files
authored
compat for Showman, Chicot, Invis and Sixth Sense
1 parent 0051a80 commit 69fcd4f

File tree

2 files changed

+178
-15
lines changed

2 files changed

+178
-15
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ Requires [Lovely](https://github.com/ethangreen-dev/lovely-injector/releases/lat
55

66
Adds compatibility for the following jokers:
77
- Chaos the Clown
8+
- Chicot
89
- Cloud 9
910
- Credit Card
1011
- Delayed Gratification
1112
- Drunkard
1213
- Egg
1314
- Gift Card
1415
- Golden Joker
16+
- Invisible Joker
1517
- Juggler
1618
- Merry Andy
1719
- Midas Mask
1820
- Mr. Bones
1921
- Oops! All 6s
2022
- Rocket
2123
- Satellite
24+
- Showman
25+
- Sixth Sense
2226
- To the Moon
2327
- Trading Card
2428
- Troubadour

lovely.toml

Lines changed: 174 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ function Card:calculate_dollar_bonus(blueprintnum)
4343
'''
4444
match_indent = true
4545

46+
47+
48+
4649
# figure out the blueprint web
4750
[[patches]]
4851
[patches.pattern]
@@ -130,13 +133,16 @@ pattern = '''function Card:add_to_deck(from_debuff)'''
130133
position = "before"
131134
payload = '''
132135
function Card:soft_add_to_deck()
133-
if self.ability.h_size ~= 0 then
136+
if self.ability.h_size ~= 0 and true then
134137
G.hand:change_size(self.ability.h_size)
135138
end
136-
if self.ability.d_size > 0 then
139+
if self.ability.d_size > 0 and true then
137140
G.GAME.round_resets.discards = G.GAME.round_resets.discards + self.ability.d_size
138141
ease_discard(self.ability.d_size)
139142
end
143+
if self.ability.name == 'Showman' then
144+
G.GAME.showman_count = (G.GAME.showman_count and G.GAME.showman_count + 1) or 1
145+
end
140146
if self.ability.name == 'Credit Card' then
141147
G.GAME.bankrupt_at = G.GAME.bankrupt_at - self.ability.extra
142148
end
@@ -183,13 +189,16 @@ end
183189
184190
function Card:soft_remove_from_deck()
185191
local card_draw = 0
186-
if self.ability.h_size ~= 0 then
192+
if self.ability.h_size ~= 0 and true then
187193
G.hand:change_size(-self.ability.h_size)
188194
end
189-
if self.ability.d_size > 0 then
195+
if self.ability.d_size > 0 and true then
190196
G.GAME.round_resets.discards = G.GAME.round_resets.discards - self.ability.d_size
191197
ease_discard(-self.ability.d_size)
192198
end
199+
if self.ability.name == 'Showman' then
200+
G.GAME.showman_count = G.GAME.showman_count - 1
201+
end
193202
if self.ability.name == 'Credit Card' then
194203
G.GAME.bankrupt_at = G.GAME.bankrupt_at + self.ability.extra
195204
end
@@ -230,17 +239,6 @@ end
230239
'''
231240
match_indent = true
232241

233-
# again
234-
[[patches]]
235-
[patches.pattern]
236-
target = "card.lua"
237-
pattern = '''function Card:remove_from_deck(from_debuff)'''
238-
position = "at"
239-
payload = '''
240-
function Card:remove_from_deck(from_debuff, from_bloopy)
241-
'''
242-
match_indent = true
243-
244242
# if not from bloopy, properly remove all dependent cards
245243
[[patches]]
246244
[patches.pattern]
@@ -258,6 +256,9 @@ end
258256
'''
259257
match_indent = true
260258

259+
260+
261+
261262
# better logic here
262263
[[patches]]
263264
[patches.pattern]
@@ -269,6 +270,9 @@ local card_count = math.max(0, math.min(delta, self.config.card_limit - #G.hand.
269270
'''
270271
match_indent = true
271272

273+
274+
275+
272276
# bad
273277
# yes this causes a vanilla change where rebuying chaos in the same shop no longer gives a free reroll, but this needs to be consistent
274278
[[patches]]
@@ -314,6 +318,9 @@ G.GAME.total_freerolls = G.GAME.total_freerolls - 1
314318
'''
315319
match_indent = true
316320

321+
322+
323+
317324
# turtle bean hardcode cause it's in an annoying spot
318325
[[patches]]
319326
[patches.pattern]
@@ -331,6 +338,9 @@ end
331338
'''
332339
match_indent = true
333340

341+
342+
343+
334344
# ok sure
335345
[[patches]]
336346
[patches.pattern]
@@ -353,6 +363,9 @@ if mod == 0 then return end
353363
'''
354364
match_indent = true
355365

366+
367+
368+
356369
# gift card just makes sense, egg is odd but i'll allow it
357370
[[patches]]
358371
[patches.pattern]
@@ -377,6 +390,9 @@ ccard:set_cost()
377390
'''
378391
match_indent = true
379392

393+
394+
395+
380396
# it's not very good but why not
381397
[[patches]]
382398
[patches.pattern]
@@ -388,6 +404,9 @@ if self.ability.name == 'Midas Mask' then
388404
'''
389405
match_indent = true
390406

407+
408+
409+
391410
# this works with copies so now it works with bloopy
392411
[[patches]]
393412
[patches.pattern]
@@ -399,6 +418,9 @@ if self.ability.name == 'Trading Card' and
399418
'''
400419
match_indent = true
401420

421+
422+
423+
402424
# mr bones consumes bloopies before himself
403425
[[patches]]
404426
[patches.pattern]
@@ -421,6 +443,136 @@ ccard:start_dissolve()
421443
'''
422444
match_indent = true
423445

446+
447+
448+
449+
# chicot
450+
[[patches]]
451+
[patches.pattern]
452+
target = "card.lua"
453+
pattern = '''if self.ability.name == 'Chicot' and not context.blueprint'''
454+
position = "at"
455+
payload = '''
456+
if self.ability.name == 'Chicot'
457+
'''
458+
match_indent = true
459+
460+
# proper message location
461+
[[patches]]
462+
[patches.pattern]
463+
target = "card.lua"
464+
pattern = '''card_eval_status_text(self, 'extra', nil, nil, nil, {message = localize('ph_boss_disabled')})'''
465+
position = "at"
466+
payload = '''
467+
card_eval_status_text(context.blueprint_card or self, 'extra', nil, nil, nil, {message = localize('ph_boss_disabled')})
468+
'''
469+
match_indent = true
470+
471+
472+
473+
474+
# remove sixth sense breaking loop, gives one speccy per copy
475+
[[patches]]
476+
[patches.pattern]
477+
target = "functions/state_events.lua"
478+
pattern = '''if destroyed then break end'''
479+
position = "at"
480+
payload = '''
481+
482+
'''
483+
match_indent = true
484+
485+
# make sixth sense compatible with blueprint
486+
[[patches]]
487+
[patches.pattern]
488+
target = "card.lua"
489+
pattern = '''elseif context.destroying_card and not context.blueprint then'''
490+
position = "at"
491+
payload = '''
492+
elseif context.destroying_card then
493+
'''
494+
match_indent = true
495+
496+
497+
498+
499+
# invis compat
500+
[[patches]]
501+
[patches.pattern]
502+
target = "card.lua"
503+
pattern = '''if self.ability.name == 'Invisible Joker' and (self.ability.invis_rounds >= self.ability.extra) and not context.blueprint then'''
504+
position = "at"
505+
payload = '''
506+
if self.ability.name == 'Invisible Joker' and (self.ability.invis_rounds >= self.ability.extra) then
507+
'''
508+
match_indent = true
509+
510+
# copy the correct cards
511+
[[patches]]
512+
[patches.pattern]
513+
target = "card.lua"
514+
pattern = '''if G.jokers.cards[i] ~= self then'''
515+
position = "at"
516+
payload = '''
517+
if G.jokers.cards[i] ~= context.blueprint_card or self then
518+
'''
519+
match_indent = true
520+
521+
522+
523+
524+
# showman
525+
[[patches]]
526+
[patches.pattern]
527+
target = "functions/common_events.lua"
528+
pattern = '''for k, v in ipairs(_starting_pool) do'''
529+
position = "after"
530+
payload = '''
531+
for _i = 1, ((G.GAME.used_jokers[v.key] and G.GAME.showman_count) and G.GAME.showman_count > 1) and G.GAME.showman_count - 1 or 1 do
532+
'''
533+
match_indent = true
534+
535+
# end the wrap
536+
[[patches]]
537+
[patches.pattern]
538+
target = "functions/common_events.lua"
539+
pattern = '''_pool[#_pool + 1] = 'UNAVAILABLE''''
540+
position = "after"
541+
payload = '''
542+
end
543+
'''
544+
match_indent = true
545+
546+
# showman add to deck
547+
[[patches]]
548+
[patches.pattern]
549+
target = "card.lua"
550+
pattern = '''if not self.added_to_deck then'''
551+
position = "after"
552+
payload = '''
553+
if self.ability.name == 'Showman' then
554+
G.GAME.showman_count = (G.GAME.showman_count and G.GAME.showman_count + 1) or 1
555+
end
556+
'''
557+
match_indent = true
558+
559+
# showman remove from deck
560+
[[patches]]
561+
[patches.pattern]
562+
target = "card.lua"
563+
pattern = '''if self.added_to_deck then'''
564+
position = "after"
565+
payload = '''
566+
if self.ability.name == 'Showman' then
567+
G.GAME.showman_count = G.GAME.showman_count - 1
568+
end
569+
'''
570+
match_indent = true
571+
572+
573+
574+
575+
424576
# save
425577
[[patches]]
426578
[patches.pattern]
@@ -443,6 +595,9 @@ self.dependent = cardTable.dependent
443595
'''
444596
match_indent = true
445597

598+
599+
600+
446601
# compat update
447602
[[patches]]
448603
[patches.pattern]
@@ -454,6 +609,7 @@ self.P_CENTERS.j_credit_card.blueprint_compat = true
454609
self.P_CENTERS.j_chaos.blueprint_compat = true
455610
self.P_CENTERS.j_delayed_grat.blueprint_compat = true
456611
self.P_CENTERS.j_egg.blueprint_compat = true
612+
self.P_CENTERS.j_sixth_sense.blueprint_compat = true
457613
self.P_CENTERS.j_cloud_9.blueprint_compat = true
458614
self.P_CENTERS.j_rocket.blueprint_compat = true
459615
self.P_CENTERS.j_midas_mask.blueprint_compat = true
@@ -466,8 +622,11 @@ self.P_CENTERS.j_golden.blueprint_compat = true
466622
self.P_CENTERS.j_trading.blueprint_compat = true
467623
self.P_CENTERS.j_mr_bones.blueprint_compat = true
468624
self.P_CENTERS.j_troubadour.blueprint_compat = true
625+
self.P_CENTERS.j_ring_master.blueprint_compat = true
469626
self.P_CENTERS.j_merry_andy.blueprint_compat = true
470627
self.P_CENTERS.j_oops.blueprint_compat = true
628+
self.P_CENTERS.j_invisible.blueprint_compat = true
471629
self.P_CENTERS.j_satellite.blueprint_compat = true
630+
self.P_CENTERS.j_chicot.blueprint_compat = true
472631
'''
473632
match_indent = true

0 commit comments

Comments
 (0)