forked from Firch/Bunco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBunco.lua
7089 lines (6105 loc) · 236 KB
/
Bunco.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
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
--- STEAMODDED HEADER
--- MOD_NAME: Bunco
--- MOD_ID: Bunco
--- MOD_AUTHOR: [Firch, RENREN, Peas, minichibis, J.D., Guwahavel, Ciirulean, ejwu]
--- MOD_DESCRIPTION: Mod aiming for vanilla style, a lot of new Jokers, Blinds, other stuff and Exotic Suits system!
--- VERSION: 5.0
-- ToDo:
-- Make configs apply immediately
-- Shell Game should modify tables instead of replacing - see Blind Packs
BUNCOMOD = {vars = {}, funcs = {}, content = SMODS.current_mod}
local filesystem = NFS or love.filesystem
local config = BUNCOMOD.content.config
-- Debug message
local function say(message)
sendDebugMessage('[BUNCO] - '..(message or '???'))
end
-- Index-based coordinates generation
local function get_coordinates(position, width)
if width == nil then width = 10 end -- 10 is default for Jokers
return {x = (position) % width, y = math.floor((position) / width)}
end
local function coordinate(position)
return get_coordinates(position - 1)
end
-- math.huge replacement
local huge_number = 9999
-- Forced messages for evaluation
local function event(config)
local e = Event(config)
G.E_MANAGER:add_event(e)
return e
end
local function big_juice(card)
card:juice_up(0.7)
end
local function extra_juice(card)
card:juice_up(0.6, 0.1)
end
local function forced_message(message, card, color, delay, juice)
if delay == true then
delay = 0.7 * 1.25
elseif delay == nil then
delay = 0
end
event({trigger = 'before', delay = delay, func = function()
if juice then big_juice(juice) end
card_eval_status_text(
card,
'extra',
nil, nil, nil,
{message = message, colour = color, instant = true}
)
return true
end})
end
-- Exotic in_pool function
BUNCOMOD.funcs.exotic_in_pool = function()
return G.GAME and G.GAME.Exotic
end
-- Dictionary wrapper
function BUNCOMOD.content.process_loc_text()
G.P_CENTERS['bunc_exotic_cards'] = {key = 'bunc_exotic_cards', set = 'Other'}
G.P_CENTERS['bunc_consumable_edition_foil'] = {key = 'bunc_consumable_edition_foil', set = 'Other'}
G.P_CENTERS['bunc_consumable_edition_holo'] = {key = 'bunc_consumable_edition_holo', set = 'Other'}
G.P_CENTERS['bunc_consumable_edition_polychrome'] = {key = 'bunc_consumable_edition_polychrome', set = 'Other'}
G.P_CENTERS['bunc_consumable_edition_bunc_glitter'] = {key = 'bunc_consumable_edition_bunc_glitter', set = 'Other'}
end
-- Config globals
BUNCOMOD.vars.jokerlike_consumable_editions = config.jokerlike_consumable_editions
-- Config options
function BUNCOMOD.content.save_config(self)
SMODS.save_mod_config(self)
end
function BUNCOMOD.content.config_tab()
return {n = G.UIT.ROOT, config = {r = 0.1, minw = 4, align = "tm", padding = 0.2, colour = G.C.BLACK}, nodes = {
{n = G.UIT.C, config = {r = 0.1, minw = 4, align = "tl", padding = 0.2, colour = G.C.BLACK}, nodes =
{
{
n = G.UIT.R,
config = {
align = "cm",
r = 0.1,
emboss = 0.1,
outline = 1,
padding = 0.14
},
nodes = {
create_toggle({
label = G.localization.misc.dictionary.bunc_colorful_finishers,
info = {
G.localization.misc.dictionary.bunc_default_true,
'',
G.localization.misc.dictionary.bunc_colorful_finishers_desc,
G.localization.misc.dictionary.bunc_colorful_finishers_desc_2
},
ref_table = BUNCOMOD.content.config,
ref_value = 'colorful_finishers',
callback = function() BUNCOMOD.content:save_config()
end})
}
},
{
n = G.UIT.R,
config = {
align = "cm",
r = 0.1,
emboss = 0.1,
outline = 1,
padding = 0.14
},
nodes = {
create_toggle({
label = G.localization.misc.dictionary.bunc_high_quality_shaders,
info = {
G.localization.misc.dictionary.bunc_default_true..', '..G.localization.misc.dictionary.bunc_requires_restart,
'',
G.localization.misc.dictionary.bunc_high_quality_shaders_desc,
G.localization.misc.dictionary.bunc_high_quality_shaders_desc_2
},
ref_table = BUNCOMOD.content.config,
ref_value = 'high_quality_shaders',
callback = function() BUNCOMOD.content:save_config()
end})
}
},
{
n = G.UIT.R,
config = {
align = "cm",
r = 0.1,
emboss = 0.1,
outline = 1,
padding = 0.14
},
nodes = {
create_toggle({
label = G.localization.misc.dictionary.bunc_fixed_sprites,
info = {
G.localization.misc.dictionary.bunc_default_true..', '..G.localization.misc.dictionary.bunc_requires_restart,
'',
G.localization.misc.dictionary.bunc_fixed_sprites_desc,
G.localization.misc.dictionary.bunc_fixed_sprites_desc_2
},
ref_table = BUNCOMOD.content.config,
ref_value = 'fixed_sprites',
callback = function() BUNCOMOD.content:save_config()
end})
}
}
}
},
{n = G.UIT.C, config = {r = 0.1, minw = 4, align = "tc", padding = 0.2, colour = G.C.BLACK}, nodes =
{
{
n = G.UIT.R,
config = {
align = "cm",
r = 0.1,
emboss = 0.1,
outline = 1,
padding = 0.14
},
nodes = {
create_toggle({
label = G.localization.misc.dictionary.bunc_gameplay_reworks,
info = {
G.localization.misc.dictionary.bunc_default_true..', '..G.localization.misc.dictionary.bunc_requires_restart,
'',
G.localization.misc.dictionary.bunc_gameplay_reworks_desc,
G.localization.misc.dictionary.bunc_gameplay_reworks_desc_2
},
ref_table = BUNCOMOD.content.config,
ref_value = 'gameplay_reworks',
callback = function() BUNCOMOD.content:save_config()
if config.gameplay_reworks then
G.P_CENTERS.c_lovers.config.max_highlighted = 2
else
G.P_CENTERS.c_lovers.config.max_highlighted = 1
end
end})
}
},
{
n = G.UIT.R,
config = {
align = "cm",
r = 0.1,
emboss = 0.1,
outline = 1,
padding = 0.14
},
nodes = {
create_toggle({
label = G.localization.misc.dictionary.bunc_fixed_badges,
info = {
G.localization.misc.dictionary.bunc_default_false,
'',
G.localization.misc.dictionary.bunc_fixed_badges_desc,
G.localization.misc.dictionary.bunc_fixed_badges_desc_2
},
ref_table = BUNCOMOD.content.config,
ref_value = 'fixed_badges',
callback = function() BUNCOMOD.content:save_config()
end})
}
},
{
n = G.UIT.R,
config = {
align = "cm",
r = 0.1,
emboss = 0.1,
outline = 1,
padding = 0.14
},
nodes = {
create_toggle({
label = G.localization.misc.dictionary.bunc_jokerlike_consumable_editions,
info = {
G.localization.misc.dictionary.bunc_default_false,
'',
G.localization.misc.dictionary.bunc_jokerlike_consumable_editions_desc,
G.localization.misc.dictionary.bunc_jokerlike_consumable_editions_desc_2
},
ref_table = BUNCOMOD.content.config,
ref_value = 'jokerlike_consumable_editions',
callback = function() BUNCOMOD.content:save_config()
end})
}
}
}
}
}}
end
-- Shaders
if config.high_quality_shaders then
local background_shader = NFS.read(BUNCOMOD.content.path..'assets/shaders/background.fs')
local splash_shader = NFS.read(BUNCOMOD.content.path..'assets/shaders/splash.fs')
local flame_shader = NFS.read(BUNCOMOD.content.path..'assets/shaders/flame.fs')
G.SHADERS['background'] = love.graphics.newShader(background_shader)
G.SHADERS['splash'] = love.graphics.newShader(splash_shader)
G.SHADERS['flame'] = love.graphics.newShader(flame_shader)
end
-- Fixed badges
SMODS.Consumable:take_ownership('pluto', {
set_card_type_badge = function(self, card, badges)
badges[1] = create_badge(config.fixed_badges and localize('k_planet') or localize('k_dwarf_planet'), get_type_colour(self or card.config, card), nil, 1.2)
end
})
SMODS.Consumable:take_ownership('ceres', {
set_card_type_badge = function(self, card, badges)
badges[1] = create_badge(config.fixed_badges and localize('k_planet_q') or localize('k_dwarf_planet'), get_type_colour(self or card.config, card), nil, 1.2)
end
})
SMODS.Consumable:take_ownership('eris', {
set_card_type_badge = function(self, card, badges)
badges[1] = create_badge(config.fixed_badges and localize('k_planet_q') or localize('k_dwarf_planet'), get_type_colour(self or card.config, card), nil, 1.2)
end
})
-- Fixed sprites
SMODS.Atlas({key = 'bunco_resprites_jokers', path = 'Resprites/Jokers.png', px = 71, py = 95})
SMODS.Atlas({key = 'bunco_resprites_consumables', path = 'Resprites/Consumables.png', px = 71, py = 95})
SMODS.Shader({key = 'pinch', path = 'pinch.fs'})
if config.fixed_sprites then
-- High contrast
SMODS.Atlas{key = 'cards_2', path = 'Resprites/EnhancedContrast.png', px = 71, py = 95, prefix_config = {key = false}}
SMODS.Atlas{key = 'ui_2', path = 'Resprites/EnhancedUIContrast.png', px = 18, py = 18, prefix_config = {key = false}}
G.C['SO_2'] = {
Hearts = HEX('ee151b'),
Diamonds = HEX('e56b10'),
Spades = HEX('5d55a6'),
Clubs = HEX('197f77')
}
G.C['SO_1']['Spades'] = HEX('3c4368')
G.C.SUITS = G.C["SO_" .. (G.SETTINGS.colourblind_option and 2 or 1)]
-- Jokers
SMODS.Joker:take_ownership('juggler', {
pos = coordinate(1),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('drunkard', {
pos = coordinate(2),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('acrobat', {
pos = coordinate(3),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('credit_card', {
pos = coordinate(4),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('troubadour', {
pos = coordinate(5),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('even_steven', {
pos = coordinate(6),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('odd_todd', {
pos = coordinate(7),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('fibonacci', {
pos = coordinate(8),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('drivers_license', {
pos = coordinate(9),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('gift', {
pos = coordinate(10),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('flash', {
pos = coordinate(11),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('ramen', {
pos = coordinate(12),
atlas = 'bunco_resprites_jokers'
})
SMODS.Joker:take_ownership('selzer', {
pos = coordinate(13),
atlas = 'bunco_resprites_jokers'
})
-- Consumables
SMODS.Consumable:take_ownership('fool', {
pos = coordinate(1),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('lovers', {
pos = coordinate(2),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('chariot', {
pos = coordinate(3),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('wheel_of_fortune', {
pos = coordinate(4),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('tower', {
pos = coordinate(5),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('moon', {
pos = coordinate(6),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('world', {
pos = coordinate(7),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('soul', {
pos = coordinate(8),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('ceres', {
pos = coordinate(9),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('mercury', {
pos = coordinate(10),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('uranus', {
pos = coordinate(11),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('pluto', {
pos = coordinate(12),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('incantation', {
pos = coordinate(13),
atlas = 'bunco_resprites_consumables'
})
SMODS.Consumable:take_ownership('black_hole', {
pos = coordinate(14),
atlas = 'bunco_resprites_consumables'
})
end
-- Text icons
local font_replacement = NFS.read(BUNCOMOD.content.path..'assets/fonts/font.ttf')
love.filesystem.write('font_replacement.ttf', font_replacement)
G.LANG.font.FONT = love.graphics.newFont('font_replacement.ttf', G.TILESIZE * 10)
love.filesystem.remove('font_replacement.ttf')
-- Gameplay reworks
if config.gameplay_reworks then
BUNCOMOD.content.config.gameplay_reworks = true
G.P_CENTERS.c_lovers.config.max_highlighted = 2
SMODS.Joker:take_ownership('luchador', {
loc_vars = function(self, info_queue)
info_queue[#info_queue + 1] = {key = 'tag_bunc_breaking', set = 'Tag'}
return {key = 'j_bunc_luchador'}
end,
calculate = function(self, card, context)
if context.selling_self then
G.E_MANAGER:add_event(Event({
func = (function()
add_tag(Tag('tag_bunc_breaking'))
play_sound('generic1', 0.9 + math.random() * 0.1, 0.8)
play_sound('holo1', 1.2 + math.random() * 0.1, 0.4)
return true
end)
}))
end
end
})
SMODS.Joker:take_ownership('red_card', {
loc_vars = function(self, info_queue)
return {key = 'j_bunc_red_card'}
end,
calculate = function(self, card, context)
if context.skipping_booster and not context.blueprint then
card.ability.mult = card.ability.mult + (card.ability.extra * G.GAME.pack_choices)
event({
func = function()
card_eval_status_text(card, 'extra', nil, nil, nil, {
message = localize{type = 'variable', key = 'a_mult', vars = {card.ability.extra * G.GAME.pack_choices}},
colour = G.C.RED,
delay = 0.45,
card = card
})
return true end})
end
end
})
SMODS.Tag:take_ownership('boss', {
loc_vars = function(self, info_queue)
info_queue[#info_queue + 1] = {key = 'p_bunc_blind', set = 'Other', vars = {G.P_CENTERS.p_bunc_blind_1.config.extra}}
return {key = 'tag_bunc_boss'}
end,
config = {type = 'new_blind_choice'},
apply = function(self, tag, context)
if context.type == self.config.type then
G.CONTROLLER.locks[tag.ID] = true
tag:yep('+', G.C.SECONDARY_SET.Spectral, function()
local key = 'p_bunc_blind_'..(math.random(4))
local card = Card(G.play.T.x + G.play.T.w/2 - G.CARD_W*1.27/2,
G.play.T.y + G.play.T.h/2-G.CARD_H*1.27/2, G.CARD_W*1.27, G.CARD_H*1.27, G.P_CARDS.empty, G.P_CENTERS[key], {bypass_discovery_center = true, bypass_discovery_ui = true})
card.cost = 0
card.from_tag = true
G.FUNCS.use_card({config = {ref_table = card}})
card:start_materialize()
G.CONTROLLER.locks[tag.ID] = nil
return true
end)
tag.triggered = true
return true
end
end
})
end
-- Temporary extra chips
local original_end_round = end_round
function end_round()
for _, v in ipairs(G.playing_cards) do
if v.ability and type(v.ability) == 'table' and v.ability.temporary_extra_chips then
v.ability.temporary_extra_chips = nil
end
end
original_end_round()
end
local Card_get_chip_bonus = Card.get_chip_bonus
function Card:get_chip_bonus()
return Card_get_chip_bonus(self) + (self.ability and type(self.ability) == 'table' and not self.debuff and self.ability.temporary_extra_chips or 0)
end
-- Miscellaneous stuff
local original_game_update = Game.update
function Game:update(dt)
-- The Wind
if G.GAME and G.GAME.blind and G.GAME.blind.name == 'bl_bunc_wind' and G.GAME.blind.ready and not G.GAME.blind.disabled then
if G.jokers then
for i = 1, #G.jokers.cards do
G.GAME.blind:debuff_card(G.jokers.cards[i])
end
end
end
-- Reactive
if G.jokers then
for i = 1, #G.jokers.cards do
if G.jokers.cards[i].ability.bunc_reactive then
G.GAME.blind:debuff_card(G.jokers.cards[i])
end
end
end
original_game_update(self, dt)
end
function BUNCOMOD.content.set_debuff(card)
-- Fluorescent edition
if card.edition and card.edition.bunc_fluorescent then
return 'prevent_debuff'
end
-- Card position
local my_pos = nil
for i = 1, #G.jokers.cards do
if G.jokers.cards[i] == card then my_pos = i; break end
end
-- The Wind
if G.GAME.blind.name == 'bl_bunc_wind' and G.GAME.blind.ready and not G.GAME.blind.disabled and my_pos == 1 then
return true
end
-- The Prince
if G.GAME.blind.name == 'bl_bunc_prince' and G.GAME.blind.ready and not G.GAME.blind.disabled and card.area == G.jokers then
return true
end
-- Gameplan
if my_pos then
if G.jokers.cards[my_pos - 1] and G.jokers.cards[my_pos - 1].config.center.key == 'j_bunc_gameplan' and not G.jokers.cards[my_pos - 1].debuff then return true end
if G.jokers.cards[my_pos + 1] and G.jokers.cards[my_pos + 1].config.center.key == 'j_bunc_gameplan' and not G.jokers.cards[my_pos + 1].debuff then return true end
end
-- Conquest
for i = 1, #G.jokers.cards do
if G.jokers.cards[i].config.center.key == 'j_bunc_conquest' then
if G.jokers.cards[i].ability.extra.joker ~= 0 and card == G.jokers.cards[i].ability.extra.joker then
return true
end
end
end
-- Reactive
for i = 1, #G.jokers.cards do
if card == G.jokers.cards[i] and G.jokers.cards[i].ability.bunc_reactive then
local condition
for _, v in pairs(G.GAME.round_resets.blind_states) do
if v == 'Skipped' then
condition = true
end
end
if not condition then
return true
end
end
end
return false
end
local original_start_run = Game.start_run
function Game:start_run(args)
original_start_run(self, args)
local sledgehammers = SMODS.find_card('j_bunc_sledgehammer')
for _, card in ipairs(sledgehammers) do
G.P_CENTERS.m_glass.config.Xmult = G.P_CENTERS.m_glass.config.Xmult + card.ability.extra.plus_xmult
end
if #sledgehammers >= 1 then
G.P_CENTERS.m_glass.config.extra = G.P_CENTERS.m_glass.config.extra / G.P_CENTERS['j_bunc_sledgehammer'].config.extra.div_chance_denom
end
end
SMODS.Tag:take_ownership('double', {
loc_vars = function(self)
if G.GAME and G.GAME.used_vouchers['v_bunc_pin_collector'] then
return {key = 'tag_bunc_double'}
end
end,
})
SMODS.Challenge:take_ownership('c_mad_world_1', {
register = function(self)
SMODS.Challenge.register(self)
table.insert(self.restrictions.banned_other, {id = 'bl_bunc_cadaver', type = 'blind'})
end
})
-- Joker creation setup
SMODS.Atlas({key = 'bunco_jokers', path = 'Jokers/Jokers.png', px = 71, py = 95})
SMODS.Atlas({key = 'bunco_jokers_exotic', path = 'Jokers/JokersExotic.png', px = 71, py = 95})
SMODS.Atlas({key = 'bunco_jokers_legendary', path = 'Jokers/JokersLegendary.png', px = 71, py = 95})
SMODS.Atlas({key = 'bunco_jokers_the_joker', path = 'Jokers/JokerBlind.png', px = 71, py = 95})
SMODS.Atlas({key = 'bunco_jokers_taped', path = 'Jokers/JokerTaped.png', px = 127, py = 113})
SMODS.Atlas({key = 'bunco_jokers_headache', path = 'Jokers/JokerHeadache.png', px = 71, py = 95})
SMODS.Sound({key = 'gunshot', path = 'gunshot.ogg'})
SMODS.Sound({key = 'mousetrap', path = 'mousetrap.ogg'})
SMODS.Shader({key = 'headache', path = 'headache.fs'})
local function create_joker(joker)
-- Sprite position
local width = 10 -- Width of the spritesheet (in Jokers)
-- Soul sprite
if joker.rarity == 'Legendary' then
joker.soul = get_coordinates(joker.position) -- Calculates coordinates based on the position variable
end
joker.position = get_coordinates(joker.position - 1)
-- Sprite atlas
local atlas
if joker.type == nil then
atlas = 'bunco_jokers'
elseif joker.type == 'Exotic' then
atlas = 'bunco_jokers_exotic'
end
if joker.rarity == 'Legendary' then
atlas = 'bunco_jokers_legendary'
end
-- Key generation from name
local key = string.gsub(string.lower(joker.name), '%s', '_') -- Removes spaces and uppercase letters
-- Rarity conversion
if joker.rarity == 'Common' then
joker.rarity = 1
elseif joker.rarity == 'Uncommon' then
joker.rarity = 2
elseif joker.rarity == 'Rare' then
joker.rarity = 3
elseif joker.rarity == 'Legendary' then
joker.rarity = 4
end
-- Config values
if joker.vars == nil then joker.vars = {} end
joker.config = {extra = {}}
for _, kv_pair in ipairs(joker.vars) do
-- kv_pair is {a = 1}
local k, v = next(kv_pair)
joker.config.extra[k] = v
end
-- Exotic Joker pool isolation
local pool
if joker.type == 'Exotic' then
pool = BUNCOMOD.funcs.exotic_in_pool
end
-- Joker creation
if not (joker.purist == false and config.purist_mode) then SMODS.Joker{
name = joker.name,
key = key,
atlas = joker.custom_atlas or atlas,
pos = joker.position,
soul_pos = joker.soul,
rarity = joker.rarity,
cost = joker.cost,
unlocked = joker.unlocked,
check_for_unlock = joker.check_for_unlock,
unlock_condition = joker.unlock_condition,
discovered = false,
blueprint_compat = joker.blueprint,
eternal_compat = joker.eternal,
process_loc_text = joker.process_loc_text,
config = joker.custom_config or joker.config,
loc_vars = joker.custom_vars or function(self, info_queue, card)
-- Localization values
local vars = {}
for _, kv_pair in ipairs(joker.vars) do
-- kv_pair is {a = 1}
local k, v = next(kv_pair)
-- k is `a`, v is `1`
table.insert(vars, card.ability.extra[k])
end
return {vars = vars}
end,
locked_loc_vars = joker.locked_vars,
calculate = joker.calculate,
update = joker.update,
remove_from_deck = joker.remove,
add_to_deck = joker.add,
set_ability = joker.set_ability,
set_sprites = joker.set_sprites,
load = joker.load,
in_pool = joker.custom_in_pool or pool,
effect = joker.effect
}
end
end
-- Jokers
create_joker({ -- Cassette
name = 'Cassette', position = 1,
vars = {{chips = 45}, {mult = 6}, {side = 'A'}},
rarity = 'Uncommon', cost = 5,
blueprint = true, eternal = true,
unlocked = true,
calculate = function(self, card, context)
if context.pre_discard then
card:flip()
end
if context.flip then
if card.ability.extra.side == 'A' then
card.ability.extra.side = 'B'
else
card.ability.extra.side = 'A'
end
end
if context.individual and context.cardarea == G.play then
local other_card = context.other_card
local side = card.ability.extra.side
if other_card:is_suit('Hearts') or other_card:is_suit('Diamonds') or other_card:is_suit('bunc_Fleurons') then
if side == 'A' then
return {
chips = card.ability.extra.chips,
card = card
}
end
end
if other_card:is_suit('Spades') or other_card:is_suit('Clubs') or other_card:is_suit('bunc_Halberds') then
if side == 'B' then
return {
mult = card.ability.extra.mult,
card = card
}
end
end
end
end,
update = function(self, card)
if card.VT.w <= 0 then
if card.ability.extra.side == 'A' then
card.children.center:set_sprite_pos(coordinate(1))
else
card.children.center:set_sprite_pos(coordinate(2))
end
end
end
})
--[[
create_joker({ -- Mosaic
name = 'Mosaic', position = 3,
vars = {{mult = 6}},
rarity = 'Uncommon', cost = 4,
blueprint = true, eternal = true,
unlocked = false,
check_for_unlock = function(self, args)
if args.type == 'hand_contents' then
local tally = 0
for j = 1, #args.cards do
if args.cards[j].config.center == G.P_CENTERS.m_stone then
tally = tally + 1
end
end
if tally >= 5 then
unlock_card(self)
end
end
end,
custom_in_pool = function()
local condition = false
if G.playing_cards then
for k, v in pairs(G.playing_cards) do
if v.config.center == G.P_CENTERS.m_stone then condition = true break end
end
end
return condition
end,
calculate = function(self, card, context)
if context.individual and context.cardarea == G.play then
if context.other_card.config.center == G.P_CENTERS.m_stone then
return {
mult = card.ability.extra.mult,
card = card
}
end
end
end
})
--]]
create_joker({ -- Voxel
name = 'Voxel', position = 4,
vars = {{base = 3}, {bonus = 0.1}, {xmult = 3}, {tally = 0}, {unlock = 10}},
locked_vars = function(self, info_queue, card)
return {vars = {self.config.extra.unlock}}
end,
rarity = 'Uncommon', cost = 5,
blueprint = true, eternal = true,
unlocked = false,
check_for_unlock = function(self, args)
if args.type == 'modify_deck' then
local count = 0
for _, v in pairs(G.playing_cards) do
if v.config.center ~= G.P_CENTERS.c_base then count = count + 1 end
end
if count >= self.config.extra.unlock then
unlock_card(self)
end
end
end,
calculate = function(self, card, context)
if context.joker_main then
if card.ability.extra.xmult ~= 1 then
return {
Xmult_mod = card.ability.extra.xmult,
card = card,
message = localize {
type = 'variable',
key = 'a_xmult',
vars = { card.ability.extra.xmult }
}
}
end
end
end,
update = function(self, card)
if G.playing_cards ~= nil then
card.ability.extra.tally = 0
for k, v in pairs(G.playing_cards) do
if v.config.center ~= G.P_CENTERS.c_base then card.ability.extra.tally = card.ability.extra.tally + 1 end
end
if (card.ability.extra.base - card.ability.extra.tally * card.ability.extra.bonus) >= 1 then
card.ability.extra.xmult = card.ability.extra.base - card.ability.extra.tally * card.ability.extra.bonus
else
card.ability.extra.xmult = 1
end
end
end
})
--[[
create_joker({ -- Crop Circles
name = 'Crop Circles', position = 5,
rarity = 'Common', cost = 4,
custom_vars = function(self)
if G.GAME and G.GAME.Exotic then
return {key = self.key..'_exotic'}
end
end,
blueprint = true, eternal = true,
unlocked = true,
calculate = function(self, card, context)
if context.individual and context.cardarea == G.play then
local other_card = context.other_card
if other_card.config.center ~= G.P_CENTERS.m_stone then
if other_card.base.suit == ('bunc_Fleurons') then
if other_card:get_id() == 8 then
return {
mult = 6,
card = card
}
elseif other_card:get_id() == 12 or other_card:get_id() == 10 or other_card:get_id() == 9 or other_card:get_id() == 6 then
return {
mult = 5,
card = card
}
else
return {
mult = 4,
card = card
}
end
elseif other_card.base.suit == ('Clubs') then
if other_card:get_id() == 8 then
return {
mult = 5,