Repository navigation
Expand file tree
/
Copy pathlovely.toml
More file actions
3358 lines (2784 loc) · 94 KB
/
Copy pathlovely.toml
File metadata and controls
3358 lines (2784 loc) · 94 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[manifest]
version = "1.0.0"
dump_lua = true
priority = 10
# Exotics toggle
[[patches]]
[patches.pattern]
target = 'functions/state_events.lua'
pattern = 'G.GAME.hands[text].played = G.GAME.hands[text].played + 1'
position = 'after'
match_indent = true
payload = '''
if string.find(text, "Spectrum") then
enable_exotics()
unlock_card(G.P_CENTERS.b_bunc_fairy)
end
'''
# Exotic color, part 1/2
[[patches]]
[patches.pattern]
target = 'globals.lua'
pattern = "RENTAL = HEX('b18f43'),"
position = 'after'
match_indent = true
payload = '''BUNCO_EXOTIC = HEX('ef9ae7'),'''
# Exotic color, part 2/2
[[patches]]
[patches.pattern]
target = 'functions/misc_functions.lua'
pattern = "legendary = G.C.RARITY[4],"
position = 'after'
match_indent = true
payload = '''bunco_exotic = G.C.BUNCO_EXOTIC,'''
# Colorful Finishers, part 1/4
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "function ease_background_colour_blind(state, blind_override)"
position = 'before'
match_indent = true
payload = '''
local function invert_color(color, invert_red, invert_green, invert_blue)
local inverted_color = {
1 - (color[1] or 0),
1 - (color[2] or 0),
1 - (color[3] or 0),
color[4] or 1
}
if invert_red then
inverted_color[1] = color[1] or 0
end
if invert_green then
inverted_color[2] = color[2] or 0
end
if invert_blue then
inverted_color[3] = color[3] or 0
end
return inverted_color
end
local function increase_saturation(color, value)
-- Extract RGB components
local r = color[1] or 0
local g = color[2] or 0
local b = color[3] or 0
-- Convert RGB to HSL
local max_val = math.max(r, g, b)
local min_val = math.min(r, g, b)
local delta = max_val - min_val
local h, s, l = 0, 0, (max_val + min_val) / 2
if delta ~= 0 then
if l < 0.5 then
s = delta / (max_val + min_val)
else
s = delta / (2 - max_val - min_val)
end
if r == max_val then
h = (g - b) / delta
elseif g == max_val then
h = 2 + (b - r) / delta
else
h = 4 + (r - g) / delta
end
h = h * 60
if h < 0 then
h = h + 360
end
end
-- Increase saturation
s = math.min(s + value, 1)
-- Convert back to RGB
local c = (1 - math.abs(2 * l - 1)) * s
local x = c * (1 - math.abs((h / 60) % 2 - 1))
local m = l - c / 2
local r_new, g_new, b_new = 0, 0, 0
if h < 60 then
r_new, g_new, b_new = c, x, 0
elseif h < 120 then
r_new, g_new, b_new = x, c, 0
elseif h < 180 then
r_new, g_new, b_new = 0, c, x
elseif h < 240 then
r_new, g_new, b_new = 0, x, c
elseif h < 300 then
r_new, g_new, b_new = x, 0, c
else
r_new, g_new, b_new = c, 0, x
end
-- Adjust RGB values
r_new, g_new, b_new = (r_new + m), (g_new + m), (b_new + m)
return {r_new, g_new, b_new, color[4] or 1}
end
'''
# Colorful Finishers, part 2/4
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "if v.name == blindname then"
position = 'after'
match_indent = true
payload = '''
boss_col = v.boss_colour
'''
# Colorful Finishers, part 3/4
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "ease_background_colour{new_colour = G.C.BLUE, special_colour = G.C.RED, tertiary_colour = darken(G.C.BLACK, 0.4), contrast = 3}"
position = 'at'
match_indent = true
payload = '''
if BUNCOMOD.content.config.colorful_finishers then
ease_background_colour{new_colour = increase_saturation(mix_colours(boss_col, invert_color(boss_col), 0.3), 1),
special_colour = boss_col,
tertiary_colour = darken(increase_saturation(mix_colours(boss_col, invert_color(boss_col, true, false, false), 0.3), 0.6), 0.4), contrast = 1.7}
else
ease_background_colour{new_colour = G.C.BLUE, special_colour = G.C.RED, tertiary_colour = darken(G.C.BLACK, 0.4), contrast = 3}
end
'''
# Colorful Finishers, part 4/4
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = 'elseif G.GAME.won then'
position = 'at'
match_indent = true
payload = '''elseif G.GAME.won and not BUNCOMOD.content.config.colorful_finishers then'''
# Black Hole 1/2
[[patches]]
[patches.pattern]
target = 'game.lua'
pattern = 'for k, v in pairs(self.I.POPUP) do'
position = 'before'
match_indent = true
payload = '''
G.FORCEFIELD_CARDS = G.FORCEFIELD_CARDS or {}
for index, card in ipairs(G.FORCEFIELD_CARDS) do
if BUNCOMOD.content.config.high_quality_shaders
and card
and not card.removed
and card.states.visible
and index <= 5 then
love.graphics.setColor(G.C.WHITE)
local w, h = love.graphics.getWidth(), love.graphics.getHeight() -- Get the size
card.pinch_canvas = love.graphics.newCanvas(realw, realh) -- Create the black hole canvas (size is important or else it will cut off on fullscreen)
love.graphics.setCanvas(card.pinch_canvas) -- Enable the black hole canvas
love.graphics.draw(self.CANVAS) -- Draw the old canvas onto the black hole one
local pinch = G.SHADERS['bunc_pinch']
local card_position = {
(card.VT.x + (card.VT.w / 2) + G.ROOM.T.x) * G.TILESCALE * G.TILESIZE * G.CANV_SCALE,
(card.VT.y + (card.VT.h / 2) + G.ROOM.T.y + 0.1) * G.TILESCALE * G.TILESIZE * G.CANV_SCALE}
local dissolve_mult = 1 - (card.dissolve or 0)
pinch:send("position", card_position)
pinch:send("screen_size", {w, h})
pinch:send("radius", (card.config and card.config.forcefield and card.config.forcefield.radius or 160) * (1.2 + math.sin((index * 3.0) + G.TIMERS.REAL / 2.0) / 3.0) * dissolve_mult)
pinch:send("strength", (card.config and card.config.forcefield and card.config.forcefield.strength or -0.5) * (0.8 - math.cos((index * 3.0) + G.TIMERS.REAL / 2.0) / 3.0) * dissolve_mult)
love.graphics.setShader(pinch) -- Set the shader to the black hole canvas
love.graphics.setCanvas(self.CANVAS) -- Forget about the black hole canvas and switch back to the og canvas
love.graphics.draw(card.pinch_canvas) -- And draw the result of black hole canvas onto the og one
-- Reset shader:
love.graphics.setShader()
elseif (not card) or (card.removed) then
table.remove(G.FORCEFIELD_CARDS, index)
end
end
'''
# Black Hole 2/2
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = 'Moveable.init(self,X, Y, W, H)'
position = 'after'
match_indent = true
payload = '''
if center and center.name == 'Black Hole' then
G.FORCEFIELD_CARDS = G.FORCEFIELD_CARDS or {}
self.config.forcefield = {}
self.config.forcefield.radius = 160
self.config.forcefield.strength = -0.5
table.insert(G.FORCEFIELD_CARDS, self)
end
'''
# Text icons
[[patches]]
[patches.pattern]
target = 'functions/misc_functions.lua'
pattern = "local desc_scale = *"
position = 'before'
match_indent = true
payload = '''
local function add_symbol(text, symbol)
local leading_spaces = string.match(text, "^%s*")
_, word_amount = text:gsub("%S+","")
if word_amount == 1 then
if #leading_spaces > 0 then
return leading_spaces..symbol..string.sub(text, #leading_spaces + 1)
else
return symbol..text
end
else
return text
end
end
local suit_symbols = {
Diamonds = '♦',
Hearts = '♥',
Spades = '♠',
Clubs = '♣',
bunc_Fleurons = '✤',
bunc_Halberds = '✠',
paperback_Crowns = '♛',
paperback_Stars = '★',
}
local found_strings = {}
-- Ordering the symbol insertion so that symbols appear in the order the words appear in the text
for key, symbol in pairs(suit_symbols) do
local result = string.find(assembled_string, localize(key, 'suits_singular')) or string.find(assembled_string, localize(key, 'suits_plural'))
if result then
table.insert(found_strings, {result, symbol})
end
end
table.sort(found_strings, function(a, b)
return a[1] > b[1]
end)
for _, v in ipairs(found_strings) do
assembled_string = add_symbol(assembled_string, v[2])
end
'''
# Luchador Rework 1/2
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = "if self.ability.name == 'Luchador' then"
position = 'at'
match_indent = true
payload = '''if self.ability.name == 'Luchador' and not BUNCOMOD.content.config.gameplay_reworks then'''
# Luchador Rework 2/2
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = "elseif self.ability.name == 'Luchador' then"
position = 'at'
match_indent = true
payload = '''elseif self.ability.name == 'Luchador' and not BUNCOMOD.content.config.gameplay_reworks then'''
# Red Card Rework
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = "if self.ability.name == 'Red Card' and not context.blueprint then"
position = 'at'
match_indent = true
payload = '''if self.ability.name == 'Red Card' and not context.blueprint and not BUNCOMOD.content.config.gameplay_reworks then'''
# Boss Tag Rework
[[patches]]
[patches.pattern]
target = 'tag.lua'
pattern = "if self.name == 'Boss Tag' then"
position = 'at'
match_indent = true
payload = '''if self.name == 'Boss Tag' and not BUNCOMOD.content.config.gameplay_reworks then'''
# # Shiny Blinds
# [[patches]]
# [patches.pattern]
# target = 'blind.lua'
# pattern = "self.children.animatedSprite:draw_shader('dissolve', 0.1)"
# position = 'at'
# match_indent = true
# payload = '''
# self.ARGS.send_to_shader = self.ARGS.send_to_shader or {}
# self.ARGS.send_to_shader[1] = self.children.animatedSprite.VT.r*10 + G.TIMERS.REAL/(28) + (self.children.animatedSprite.juice and self.children.animatedSprite.juice.r*10 or 0) + self.tilt_var.amt
# self.ARGS.send_to_shader[2] = G.TIMERS.REAL
# self.children.animatedSprite:draw_shader('polychrome', 0.1, self.ARGS.send_to_shader)
# '''
# # Shiny Blinds
# [[patches]]
# [patches.pattern]
# target = 'blind.lua'
# pattern = "self.children.animatedSprite:draw_shader('dissolve')"
# position = 'at'
# match_indent = true
# payload = '''
# self.children.animatedSprite:draw_shader('polychrome', nil, self.ARGS.send_to_shader)
# '''
# # Shiny Blinds
# [[patches]]
# [patches.pattern]
# target = 'functions\UI_definitions.lua'
# pattern = "{shader = 'dissolve', shadow_height = 0.05}"
# position = 'at'
# match_indent = true
# payload = '''
# {shader = 'polychrome', shadow_height = 0.05}
# '''
# function generate_card_ui() (Temporary extra chips)
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "if main_end then"
position = "before"
match_indent = true
payload = '''
if (_c.set == 'Default' or _c.set == 'Enhanced') and card and card.ability and type(card.ability) == 'table' and card.ability.temporary_extra_chips and not card.debuff then
localize{type = 'other', key = 'bunc_temporary_extra_chips', nodes = desc_nodes, vars = {card.ability.temporary_extra_chips}}
end'''
## These don't seem to be needed as of SMOD 1413a. Wouldn't be surprised if it changes again.
# # Linked cards drawing 1/4
# [[patches]]
# [patches.pattern]
# target = 'game.lua'
# pattern = "if G.GAME.current_round.hands_played == 0 and"
# position = "before"
# match_indent = true
# payload = '''
# G.E_MANAGER:add_event(Event({func = function()
# '''
# # Linked cards drawing 2/4
# [[patches]]
# [patches.regex]
# target = 'game.lua'
# pattern = '(?<indent>[\t ]*).*drawn_to_hand\(\)\n(.*)return true\n(.*)end\n(.*)\n'
# position = "after"
# line_prepend = "$indent"
# payload = '''
# return true end}))
# '''
# Linked cards drawing 3/4
[[patches]]
[patches.pattern]
target = 'game.lua'
pattern = "G.FUNCS.draw_from_deck_to_hand()"
position = "after"
match_indent = true
payload = '''
-- TODO Add support for modded packs (this hinders the card clicking)
G.DRAWING_CARDS = G.STATE
'''
# Linked cards drawing 4/4
[[patches]]
[patches.pattern]
target = 'game.lua'
pattern = "G.CONTROLLER:recall_cardarea_focus('pack_cards')"
position = "after"
match_indent = true
payload = '''
G.E_MANAGER:add_event(Event({func = function() G.DRAWING_CARDS = nil return true end}))
'''
# Linked cards drawing fix
# A fix for ghost cards
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "if from then card = from:remove_card(card) end"
position = "before"
match_indent = true
payload = '''
local in_area = false
for n = 0, #from.cards do
if from.cards[n] == card then
in_area = true
break
end
end
if not in_area and from == G.deck then
return true
end
'''
# # Linked cards can discard
# [[patches]]
# [patches.regex]
# target = 'functions/button_callbacks.lua'
# pattern = "(?<indent>[\t ]*)if G.GAME.current_round.discards_left <= 0 or #G.hand.highlighted <= 0 or (?<condition>.*?) then"
# position = "at"
# line_prepend = "$indent"
# payload = '''if G.GAME.current_round.discards_left <= 0 or #G.hand.highlighted <= 0 or $condition or (G.GAME.THE_8_BYPASS and (#G.hand.highlighted > G.GAME.starting_params.discard_limit)) then'''
# Linked cards selection 1/2
[[patches]]
[patches.pattern]
target = 'cardarea.lua'
pattern = 'function CardArea:can_highlight(card)'
position = 'after'
match_indent = true
payload = '''
-- Anything is selectable with The 8 active
if card and self == G.hand and G.GAME and G.GAME.THE_8_BYPASS then
return true
end
-- Making so the player can't choose a group of linked cards if it'd bypass highlighted limit
if card and card.ability.group then
local group_amount = 0 -- Amount of cards in the same group
local highlighted_amount = 0 -- Amount of cards already highlighted
local highlighted_group_amount = 0 -- Amount of cards already highlighted in the same group
for i = 1, #self.cards do
if self.cards[i].ability.group and self.cards[i].ability.group.id == card.ability.group.id then
if not self.cards[i].highlighted then
group_amount = group_amount + 1
else
highlighted_group_amount = highlighted_group_amount + 1
end
end
if self.cards[i].highlighted then
highlighted_amount = highlighted_amount + 1
end
end
-- If you select a group that has more cards than the game allows
if (not card.highlighted) and (group_amount > self.config.highlighted_limit) then
-- Check if there's already cards selected
if highlighted_amount ~= 0 then
return false
end
return true
end
-- If you select a normal amount of cards but the amount of cards in the group and already highlighted will bypass the limit
if (not card.highlighted) and (self.config.highlighted_limit < (group_amount + highlighted_amount)) then
return false
end
-- If you want to unselect cards that already bypassed the limit
if card.highlighted then
return true
end
end
'''
# # Linked cards selection 2/2
# [[patches]]
# [patches.pattern]
# target = 'cardarea.lua'
# pattern = 'if #self.highlighted >= self.config.highlighted_limit then'
# position = 'at'
# match_indent = true
# payload = '''if (#self.highlighted >= self.config.highlighted_limit) and (not card.ability.group) and (G.GAME and not G.GAME.THE_8_BYPASS) then'''
# Linked cards destruction 1/2
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = 'self.removed = true'
position = 'before'
match_indent = true
payload = '''
local grouped
if self.ability.group and (not self.fake_card) and not (self.area and self.area.config and self.area.config.view_deck) then
grouped = self
end
'''
# Linked cards destruction 2/2
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = 'Moveable.remove(self)'
position = 'after'
match_indent = true
payload = '''
if grouped and G.playing_cards and #G.playing_cards > 0 then
local next_card
local destroyed_cards = {}
for i=1, #G.playing_cards do
if G.playing_cards[i].ability.group then
if (G.playing_cards[i].ability.group.id == grouped.ability.group.id) and (not G.playing_cards[i].destroyed) and (not G.playing_cards[i].shattered) then
table.insert(destroyed_cards, G.playing_cards[i])
end
end
end
for _, next_card in ipairs(destroyed_cards) do
if SMODS.has_enhancement(next_card, 'm_glass') then
next_card:shatter()
next_card.shattered = true
else
next_card:start_dissolve()
next_card.destroyed = true
end
for i = 1, #G.jokers.cards do
eval_card(G.jokers.cards[i], {
cardarea = G.jokers,
remove_playing_cards = true,
removed = {next_card}
})
end
G.E_MANAGER:add_event(Event({
func = function()
next_card:remove()
return true end
}))
end
end
'''
# Linked cards description
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "if main_end then"
position = "before"
match_indent = true
payload = '''
if (_c.set == 'Default' or _c.set == 'Enhanced') and card and card.ability and type(card.ability) == 'table' and card.ability.group then
localize{type = 'other', key = card.greyed and 'bunc_drawn_linked_cards' or 'bunc_linked_cards', nodes = desc_nodes, vars = {}}
if not (card.area.config.type == 'title' and card.greyed) then
main_end = main_end or {}
local all_cards_from_group = {}
if card and card.area then
if card.area.config.type == 'title' then
for i = 1, #G.playing_cards do
local check_card = G.playing_cards[i]
if check_card.ability and type(check_card.ability) == 'table' and check_card.ability.group then
if check_card.ability.group.id == card.ability.group.id then
table.insert(all_cards_from_group, check_card)
end
end
end
else
for i = 1, #card.area.cards do
local check_card = card.area.cards[i]
if check_card.ability and type(check_card.ability) == 'table' and check_card.ability.group then
if check_card.ability.group.id == card.ability.group.id then
table.insert(all_cards_from_group, check_card)
end
end
end
end
end
local cardarea = CardArea(
0,
0,
2.85 * G.CARD_W,
0.75 * G.CARD_H,
{card_limit = #all_cards_from_group, type = 'title', highlight_limit = 0}
)
for k, v in ipairs(all_cards_from_group) do
local group_card = copy_card(v, nil, 0.5)
group_card.fake_card = true
group_card.states.hover.can = false
group_card:juice_up(0.3, 0.2)
if k == 1 then play_sound('paper1', 0.95 + math.random() * 0.1, 0.3) end
ease_value(group_card.T, 'scale', 0.25, nil, 'REAL', true, 0.2)
cardarea:emplace(group_card)
if (v.facing == 'back') and v.area ~= G.deck then
group_card.sprite_facing = 'back'
end
end
table.insert(main_end, {n=G.UIT.R, config = {align = "cm", colour = G.C.CLEAR, r = 0.0}, nodes={
{n=G.UIT.C, config = {align = "cm"}, nodes={
{n=G.UIT.O, config = {object = cardarea}}
}}
}})
info_queue[#info_queue+1] = {set = 'Other', key = 'bunc_linked_group'}
end
end'''
# Linked cards undiscovered sprite
[[patches]]
[patches.pattern]
target = '=[SMODS _ "src/card_draw.lua"]'
pattern = '''local shared_sprite = (self.ability.set == 'Edition' or self.ability.set == 'Joker') and G.shared_undiscovered_joker or G.shared_undiscovered_tarot'''
position = 'after'
match_indent = true
payload = '''
if not G.shared_undiscovered_polymino then G.shared_undiscovered_polymino = Sprite(0, 0, G.CARD_W, G.CARD_H, G.ASSET_ATLAS['bunc_bunco_polyminoes_undiscovered'], {x = 1, y = 0}) end
if self.ability.set == 'Polymino' then
shared_sprite = G.shared_undiscovered_polymino
end
'''
# # Can play more than 5 cards with linked cards
# [[patches]]
# [patches.pattern]
# target = 'functions/button_callbacks.lua'
# pattern = 'if #G.hand.highlighted <= 0 or G.GAME.blind.block_play or #G.hand.highlighted > math.max(G.GAME.starting_params.play_limit, 1) then'
# position = 'before'
# match_indent = true
# payload = '''
# local group_size = 0
# if G.hand and G.hand.highlighted then
# for i = 1, #G.hand.highlighted do
# if G.hand.highlighted[i].ability.group then
# group_size = group_size + 1
# end
# end
# end
# '''
# [[patches]]
# [patches.pattern]
# target = 'functions/button_callbacks.lua'
# pattern = 'if #G.hand.highlighted <= 0 or G.GAME.blind.block_play or #G.hand.highlighted > math.max(G.GAME.starting_params.play_limit, 1) then'
# position = 'at'
# match_indent = true
# payload = 'if #G.hand.highlighted <= 0 or G.GAME.blind.block_play or #G.hand.highlighted > math.max(G.GAME.starting_params.play_limit, 1, group_size) and not group_exceeds_hand_limit then'
# Virtual pack deck alignment
[[patches]]
[patches.pattern]
target = 'cardarea.lua'
pattern = '''if self.children.view_deck then'''
position = 'before'
match_indent = true
payload = '''
if self.config.type == 'hand' and G.hand and G.STATE == G.STATES.SMODS_BOOSTER_OPENED and SMODS.OPENED_BOOSTER.config.center.type == 'bunc_virtual' then
G.hand:sort()
for i = 1, #G.hand.cards do
local card = G.hand.cards[i]
card.states.drag.can = false
local offset_mult = 0.4
card.T.y = card.T.y - (
card.base.suit == 'Spades' and offset_mult * 2
or card.base.suit == 'Hearts' and offset_mult * 1
or card.base.suit == 'Clubs' and offset_mult * 0
or card.base.suit == 'Diamonds' and offset_mult * -1
or card.base.suit == 'bunc_Fleurons' and offset_mult * -2
or card.base.suit == 'bunc_Halberds' and offset_mult * -3
or offset_mult * -4)
local align_mult = 0.2
card.T.x = card.T.x - (
card.base.suit == 'Spades' and 0.0
or card.base.suit == 'Hearts' and align_mult
or card.base.suit == 'Clubs' and align_mult * 2
or card.base.suit == 'Diamonds' and align_mult * 3
or card.base.suit == 'bunc_Fleurons' and align_mult * 4
or card.base.suit == 'bunc_Halberds' and align_mult * 5
or align_mult * 6)
card.T.r = card.T.r / 3.0
if card.highlighted then
card.T.y = card.T.y + 0.5
card.greyed = false
else
card.greyed = true
end
end
end
'''
# Linked cards saving (experimental)
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = '''play_sound('card1', 0.85 + percent*0.2/100, 0.6*(vol or 1))'''
position = 'after'
match_indent = true
payload = '''
G.E_MANAGER:add_event(Event({blocking = false, trigger = 'after', func = function()
if card and card.ability and card.ability.group then
save_run()
end
return true
end}))
'''
# function Card:flip() (Cassette)
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = "self.facing='back'"
position = 'after'
match_indent = true
payload = '''
if self.config.center.key == 'j_bunc_cassette' then
self:flip()
SMODS.calculate_context({flip = true, card_flipped = self})
end
'''
# function CardArea:emplace() (X-Ray)
[[patches]]
[patches.pattern]
target = 'cardarea.lua'
pattern = 'if #self.cards > self.config.card_limit then'
position = 'before'
match_indent = true
payload = '''
if G.jokers ~= nil and self == G.hand and next(SMODS.find_card('j_bunc_xray')) then
SMODS.calculate_context({emplaced_card = card})
end
'''
# function copy_card (Dread)
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = 'if not strip_edition then'
position = 'before'
match_indent = true
payload = '''
if new_card.config.center.key == 'j_bunc_dread' then
new_card.ability.extra.level_up_list = {}
end
'''
# function Card:set_cost() (Loan Shark)
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = 'if self.area and self.ability.couponed and (self.area == G.shop_jokers or self.area == G.shop_booster) then self.cost = 0 end'
position = 'after'
match_indent = true
payload = '''
if self.config.center.key == 'j_bunc_loan_shark' and self.added_to_deck then
self.sell_cost = self.ability.extra.cost + (self.ability.extra_value or 0)
end
'''
# Joker Knight variables
[[patches]]
[patches.pattern]
target = 'engine/node.lua'
pattern = 'function Node:drag()'
position = 'before'
match_indent = true
payload = '''
local break_table = {before = nil, after = nil, node = nil}
'''
# function Node:drag() (Joker Knight 1/2)
[[patches]]
[patches.pattern]
target = 'engine/node.lua'
pattern = 'function Node:drag()'
position = 'after'
match_indent = true
payload = '''
if G.jokers ~= nil and self:is(Card) and self.area == G.jokers then
if next(SMODS.find_card('j_bunc_knight')) then
if break_table.before == nil then
break_table.before = {}
for _, v in ipairs(G.jokers.cards) do
table.insert(break_table.before, v.ability.name)
end
break_table.after = break_table.before
break_table.node = self
end
end
end
'''
# function Node:stop_drag() (Joker Knight 2/2)
[[patches]]
[patches.pattern]
target = 'engine/node.lua'
pattern = 'function Node:stop_drag()'
position = 'after'
match_indent = true
payload = '''
if G.jokers ~= nil and self == break_table.node and next(SMODS.find_card('j_bunc_knight')) then
function do_tables_match(a, b)
return table.concat(a) == table.concat(b)
end
if break_table.before ~= nil then
break_table.before = {}
for _, v in ipairs(G.jokers.cards) do
table.insert(break_table.before, v.ability.name)
end
if not do_tables_match(break_table.before, break_table.after) then
SMODS.calculate_context({ break_positions = true })
end
break_table.before = nil
break_table.after = nil
end
end
'''
# function create_card() (JMJB)
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = 'card:set_edition(edition)'
position = 'before'
match_indent = true
payload = '''
if card.config.center.key == 'j_bunc_jmjb' then
edition = poll_edition(nil, nil, true, true)
end
'''
# function create_card() (Doorhanger)
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = 'local _pool, _pool_key = get_current_pool(_type, _rarity, legendary, key_append)'
position = 'before'
match_indent = true
payload = '''
if G.jokers ~= nil then
if next(SMODS.find_card('j_bunc_doorhanger')) then
if _rarity == nil
or ((type(_rarity) == 'number') and (_rarity < 0.9))
or ((type(_rarity) == 'string') and (_rarity == 'Common')) then
_rarity = 0.9
if pseudorandom('doorhanger'..G.SEED) > 0.98 then
_rarity = 1
end
end
end
end
'''
# function Card:set_ability() (Neon Joker)
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = 'self.config.center = center'
position = 'after'
match_indent = true
payload = '''
if G.hand and center and (not initial) and (old_center ~= center) and center.set == 'Enhanced' then
SMODS.calculate_context({enhance_card = true, enhanced_card = self})
end
'''
# function CardArea:parse_highlighted (Registration Plate 1/3)
[[patches]]
[patches.pattern]
target = 'cardarea.lua'
pattern = "update_hand_text({immediate = true, nopulse = nil, delay = 0}, {handname=disp_text, level=G.GAME.hands[text].level, mult = G.GAME.hands[text].mult, chips = G.GAME.hands[text].chips})"
position = 'at'
match_indent = true
payload = '''
if text == 'bunc_Deal' then
update_hand_text({immediate = true, nopulse = nil, delay = 0}, {handname=disp_text, level='0', mult = G.GAME.hands[text].mult, chips = G.GAME.hands[text].chips})
else
update_hand_text({immediate = true, nopulse = nil, delay = 0}, {handname=disp_text, level=G.GAME.hands[text].level, mult = G.GAME.hands[text].mult, chips = G.GAME.hands[text].chips})
end
'''
# function Game:set_globals (Registration Plate 2/3)
[[patches]]
[patches.pattern]
target = 'globals.lua'
pattern = "G.C.HAND_LEVELS[0] = G.C.RED"
position = 'at'
match_indent = true
payload = '''
G.C.HAND_LEVELS[0] = G.C.JOKER_GREY
'''
# function level_up_hand (Registration Plate 3/3)
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "function level_up_hand(card, hand, instant, amount)"