-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGrim.lua
4263 lines (4037 loc) · 157 KB
/
Grim.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: Grim
--- MOD_ID: GRM
--- PREFIX: grm
--- MOD_AUTHOR: [mathguy]
--- MOD_DESCRIPTION: Skill trees in Balatro! Thank you to Mr.Clover for Taiwanese Mandarin translation
--- VERSION: 1.1.0
----------------------------------------------
------------MOD CODE -------------------------
if not IncantationAddons then
IncantationAddons = {
Stacking = {},
Dividing = {},
BulkUse = {},
StackingIndividual = {},
DividingIndividual = {},
BulkUseIndividual = {}
}
end
table.insert(IncantationAddons.Stacking, "Lunar")
table.insert(IncantationAddons.Stacking, "Stellar")
table.insert(IncantationAddons.Dividing, "Lunar")
table.insert(IncantationAddons.Dividing, "Stellar")
table.insert(IncantationAddons.BulkUse, "Lunar")
table.insert(IncantationAddons.BulkUse, "Stellar")
local areaType = SMODS.ConsumableType {
key = 'Area',
loc_txt = {},
primary_colour = G.C.GREEN,
secondary_colour = G.C.GREEN,
collection_rows = { 4, 4 },
shop_rate = 0,
default = "c_grm_classic"
}
local lunarType = SMODS.ConsumableType {
key = 'Lunar',
loc_txt = {},
primary_colour = HEX('505A8D'),
secondary_colour = HEX('7F82C4'),
collection_rows = { 4, 4 },
shop_rate = 0,
default = "c_grm_moon"
}
local stellarType = SMODS.ConsumableType {
key = 'Stellar',
loc_txt = {},
primary_colour = HEX('AAA65B'),
secondary_colour = HEX('D2CE84'),
collection_rows = { 3, 2 },
shop_rate = 0,
default = "c_grm_sun"
}
local elementType = SMODS.ConsumableType {
key = 'Elemental',
loc_txt = {},
primary_colour = HEX('e9e4d3'),
secondary_colour = HEX('e9e4d3'),
collection_rows = { 4, 4 },
shop_rate = 0,
default = "c_grm_m_lead"
}
local attackType = SMODS.ConsumableType {
key = 'Attack',
loc_txt = {},
primary_colour = HEX('E9D3D3'),
secondary_colour = HEX('E9D3D3'),
collection_rows = { 4, 4 },
shop_rate = 0,
default = "c_grm_debuff"
}
local lootType = SMODS.ConsumableType {
key = 'Loot',
loc_txt = {},
primary_colour = HEX('7190A6'),
secondary_colour = HEX('7190A6'),
collection_rows = { 4, 4 },
shop_rate = 0,
default = "c_grm_hand_refresh"
}
SMODS.Lunar = SMODS.Consumable:extend {
set = 'Lunar',
use = function(self, card, area, copier)
G.GAME.special_levels[self.special_level] = G.GAME.special_levels[self.special_level] + 1
card_eval_status_text(card, 'jokers', nil, nil, nil, {colour = G.C.BLUE, message = localize('k_upgrade_ex')})
end,
can_use = function(self, card)
return true
end,
cost = 3
}
SMODS.Stellar = SMODS.Consumable:extend {
set = 'Stellar',
use = function(self, card, area, copier)
G.GAME.special_levels[self.special_level] = G.GAME.special_levels[self.special_level] + 1
G.GAME.stellar_levels[self.special_level .. "s"].chips = (G.GAME.special_levels and (G.GAME.special_levels[self.special_level]) or 0) * card.ability.chips
G.GAME.stellar_levels[self.special_level .. "s"].mult = (G.GAME.special_levels and (G.GAME.special_levels[self.special_level]) or 0) * card.ability.mult
card_eval_status_text(card, 'jokers', nil, nil, nil, {colour = G.C.MONEY, message = localize('k_upgrade_ex')})
end,
bulk_use = function(self, card, area, copier, number)
G.GAME.special_levels[self.special_level] = G.GAME.special_levels[self.special_level] + number
G.GAME.stellar_levels[self.special_level .. "s"].chips = (G.GAME.special_levels and (G.GAME.special_levels[self.special_level]) or 0) * card.ability.chips
G.GAME.stellar_levels[self.special_level .. "s"].mult = (G.GAME.special_levels and (G.GAME.special_levels[self.special_level]) or 0) * card.ability.mult
card_eval_status_text(card, 'jokers', nil, nil, nil, {colour = G.C.MONEY, message = localize('k_upgrade_ex')})
end,
can_use = function(self, card)
return true
end,
cost = 5,
loc_vars = function(self, info_queue, card)
return {vars = {
((self.config.suit == "Fleurons") or (self.config.suit == "Halberds")) and (self.config.suit) or localize(self.config.suit, 'suits_plural'),
G.GAME.special_levels[self.special_level] + 1,
string.format("%.2f", self.config.mult),
string.format("%.1f", self.config.chips),
string.format("%.2f",(G.GAME.special_levels and (G.GAME.special_levels[self.special_level]) or 0) * self.config.mult),
string.format("%.1f",(G.GAME.special_levels and (G.GAME.special_levels[self.special_level]) or 0) * self.config.chips),
}}
end
}
SMODS.Area = SMODS.Consumable:extend {
set = 'Area',
use = function(self, card, area, copier)
leave_area(G.GAME.area)
G.GAME.area = self.area
G.GAME.region = self.region or 'Classic'
G.GAME.area_data.norm_color = self.norm_color
G.GAME.area_data.endless_color = self.endless_color
G.GAME.area_data.adjacent = {}
if self.adjacent then
for i, j in pairs(self.adjacent) do
G.GAME.area_data.adjacent[i] = true
end
end
G.GAME.area_data.adjacent[G.GAME.region] = true
enter_area(self.area, card)
card_eval_status_text(card, 'jokers', nil, nil, nil, {colour = G.C.GREEN, message = localize('k_new_area')})
for i = 1, #G.jokers.cards do
eval = G.jokers.cards[i]:calculate_joker({visited_area = self.area})
end
end,
region = "Classic",
can_use = function(self, card)
return true
end,
cost = 10,
in_pool = function(self, card)
return (self.area ~= G.GAME.area) and (G.GAME.area_data and G.GAME.area_data.adjacent and G.GAME.area_data.adjacent[self.region or 'Classic'])
end,
set_badges = function(self, card, badges)
local colours = {
Classic = HEX('115f15'),
Sewer = HEX('9ae4b5'),
Spooky = HEX("6317a8"),
Metro = HEX("d8aeff"),
Aether = HEX("ffffd0"),
}
local len = string.len(card.config.center.region)
local size = 1.3 - (len > 5 and 0.02 * (len - 5) or 0)
if card.config.center.discovered then
badges[#badges + 1] = create_badge(localize("region_" .. card.config.center.region:lower()), colours[card.config.center.region], nil, size)
end
end
}
SMODS.Element = SMODS.Consumable:extend {
set = 'Elemental',
use = function(self, card, area, copier)
local used_tarot = copier or card
G.E_MANAGER:add_event(Event({trigger = 'after', delay = skip_animation or 0.4, func = function()
play_sound('tarot1')
used_tarot:juice_up(0.3, 0.5)
return true end }))
for i=1, #G.hand.highlighted do
local percent = 1.15 - (i-0.999)/(#G.hand.highlighted-0.998)*0.3
G.E_MANAGER:add_event(Event({trigger = 'after',delay = 0.15,func = function() G.hand.highlighted[i]:flip();play_sound('card1', percent);G.hand.highlighted[i]:juice_up(0.3, 0.3);return true end }))
end
delay(0.2)
if self.status then
for i=1, #G.hand.highlighted do
G.hand.highlighted[i].ability.grm_status = G.hand.highlighted[i].ability.grm_status or {}
if (self.status == "gust") and not G.hand.highlighted[i].ability.grm_status.gust and not card.debuff then
G.hand.config.highlighted_limit = G.hand.config.highlighted_limit + 1
end
G.E_MANAGER:add_event(Event({trigger = 'after',delay = 0.1,func = function()
G.hand.highlighted[i].ability.grm_status[self.status] = true
return true
end }))
end
else
for i=1, #G.hand.highlighted do
G.E_MANAGER:add_event(Event({trigger = 'after',delay = 0.1,func = function() G.hand.highlighted[i]:set_ability(G.P_CENTERS[card.ability.consumeable.mod_conv]);return true end }))
end
end
for i=1, #G.hand.highlighted do
local percent = 0.85 + (i-0.999)/(#G.hand.highlighted-0.998)*0.3
G.E_MANAGER:add_event(Event({trigger = 'after',delay = 0.15,func = function() G.hand.highlighted[i]:flip();play_sound('tarot2', percent, 0.6);G.hand.highlighted[i]:juice_up(0.3, 0.3);return true end }))
end
G.E_MANAGER:add_event(Event({trigger = 'after', delay = 0.2,func = function() G.hand:unhighlight_all(); return true end }))
delay(0.5)
end,
cost = 4,
m_type = 'Common',
set_badges = function(self, card, badges)
local colours = {
Common = HEX('939393'),
Precious = HEX('e2d583'),
Modern = HEX("339d41"),
}
local len = string.len(card.config.center.m_type)
local size = 1.3 - (len > 5 and 0.02 * (len - 5) or 0)
if card.config.center.discovered then
badges[#badges + 1] = create_badge(card.config.center.m_type, colours[card.config.center.m_type], nil, size)
end
end
}
SMODS.Attack = SMODS.Consumable:extend {
set = 'Attack',
use = function(self, card, area, copier)
local a = 1
end,
cost = 4,
discovered = true,
}
SMODS.Loot = SMODS.Consumable:extend {
set = 'Loot',
cost = 4,
can_use = function(self, card)
return true
end,
discovered = true,
}
SMODS.UndiscoveredSprite {
key = 'Lunar',
atlas = 'lunar',
pos = {x = 2, y = 1}
}
SMODS.UndiscoveredSprite {
key = 'Stellar',
atlas = 'stellar',
pos = {x = 0, y = 1}
}
SMODS.UndiscoveredSprite {
key = 'Skill',
atlas = 'skills',
pos = {x = 0, y = 0}
}
SMODS.UndiscoveredSprite {
key = 'Area',
atlas = 'areas',
pos = {x = 0, y = 1}
}
SMODS.UndiscoveredSprite {
key = 'Elemental',
atlas = 'metal',
pos = {x = 0, y = 0}
}
SMODS.UndiscoveredSprite {
key = 'Attack',
atlas = 'attack',
pos = {x = 0, y = 2}
}
SMODS.UndiscoveredSprite {
key = 'Loot',
atlas = 'loot',
pos = {x = 0, y = 0}
}
function SMODS.current_mod.reset_game_globals()
G.GAME.grim_hand_size_bonus = 0
end
SMODS.current_mod.custom_collection_tabs = function()
return { UIBox_button {
count = G.ACTIVE_MOD_UI and modsCollectionTally(G.P_CENTER_POOLS['Skill']),
button = 'your_collection_skills', label = {"Skills"}, count = G.ACTIVE_MOD_UI and modsCollectionTally(G.P_CENTER_POOLS['Skill']), minw = 5, id = 'your_collection_skills'
}}
end
SMODS.current_mod.set_debuff = function(card)
if skill_active("sk_grm_motley_1") and ((card.ability.name == 'Wild Card') or (skill_active("sk_grm_motley_3") and (card.config.center ~= G.P_CENTERS.c_base))) then
return 'prevent_debuff'
end
if card.ability.temp_debuff then
return true
end
end
function create_UIBox_Skills()
local deck_tables = {}
G.your_collection = {}
for j = 1, 4 do
G.your_collection[j] = CardArea(
G.ROOM.T.x + 0.2*G.ROOM.T.w/2,G.ROOM.T.h,
(5.25)*G.CARD_W,
1*G.CARD_W,
{card_limit = 5, type = 'title', highlight_limit = 0, collection = true})
table.insert(deck_tables,
{n=G.UIT.R, config={align = "cm", padding = 0, no_fill = true}, nodes={
{n=G.UIT.O, config={object = G.your_collection[j]}}
}}
)
end
local tarot_options = {}
for i = 1, math.ceil(#G.P_CENTER_POOLS['Skill']/20) do
table.insert(tarot_options, localize('k_page')..' '..tostring(i)..'/'..tostring(math.ceil(#G.P_CENTER_POOLS['Skill']/20)))
end
for j = 1, #G.your_collection do
for i = 1, 5 do
local center = G.P_CENTER_POOLS['Skill'][i+(j-1)*(5)]
if (i+(j-1)*(5)) <= #G.P_CENTER_POOLS['Skill'] then
local card = Card(G.your_collection[j].T.x + G.your_collection[j].T.w/2, G.your_collection[j].T.y, G.CARD_W, G.CARD_H, nil, center)
card:start_materialize(nil, i>1 or j>1)
card.sticker = get_skill_win_banner(center)
if card.sticker then
card.no_shader = true
end
G.your_collection[j]:emplace(card)
end
end
end
INIT_COLLECTION_CARD_ALERTS()
local t = create_UIBox_generic_options({ back_func = G.ACTIVE_MOD_UI and "openModUI_"..G.ACTIVE_MOD_UI.id or 'your_collection', contents = {
{n=G.UIT.R, config={align = "cm", minw = 2.5, padding = 0.1, r = 0.1, colour = G.C.BLACK, emboss = 0.05}, nodes=deck_tables},
{n=G.UIT.R, config={align = "cm"}, nodes={
create_option_cycle({options = tarot_options, w = 4.5, cycle_shoulders = true, opt_callback = 'your_collection_skill_page', focus_args = {snap_to = true, nav = 'wide'},current_option = 1, colour = G.C.RED, no_pips = true})
}}
}})
return t
end
G.FUNCS.your_collection_skills = function(e)
G.SETTINGS.paused = true
G.FUNCS.overlay_menu{
definition = create_UIBox_Skills(),
}
end
G.FUNCS.your_collection_skill_page = function(args)
if not args or not args.cycle_config then return end
for j = 1, #G.your_collection do
for i = #G.your_collection[j].cards,1, -1 do
local c = G.your_collection[j]:remove_card(G.your_collection[j].cards[i])
c:remove()
c = nil
end
end
for i = 1, 5 do
for j = 1, #G.your_collection do
local center = G.P_CENTER_POOLS['Skill'][i+(j-1)*5 + (5*#G.your_collection*(args.cycle_config.current_option - 1))]
if not center then break end
local card = Card(G.your_collection[j].T.x + G.your_collection[j].T.w/2, G.your_collection[j].T.y, G.CARD_W, G.CARD_H, G.P_CARDS.empty, center)
card.sticker = get_skill_win_banner(center)
if card.sticker then
card.no_shader = true
end
G.your_collection[j]:emplace(card)
end
end
INIT_COLLECTION_CARD_ALERTS()
end
function SMODS.SAVE_UNLOCKS()
boot_print_stage("Saving Unlocks")
G:save_progress()
-------------------------------------
local TESTHELPER_unlocks = false and not _RELEASE_MODE
-------------------------------------
if not love.filesystem.getInfo(G.SETTINGS.profile .. '') then
love.filesystem.createDirectory(G.SETTINGS.profile ..
'')
end
if not love.filesystem.getInfo(G.SETTINGS.profile .. '/' .. 'meta.jkr') then
love.filesystem.append(
G.SETTINGS.profile .. '/' .. 'meta.jkr', 'return {}')
end
convert_save_to_meta()
local meta = STR_UNPACK(get_compressed(G.SETTINGS.profile .. '/' .. 'meta.jkr') or 'return {}')
meta.unlocked = meta.unlocked or {}
meta.discovered = meta.discovered or {}
meta.alerted = meta.alerted or {}
G.P_LOCKED = {}
for k, v in pairs(G.P_CENTERS) do
if not v.wip and not v.demo then
if TESTHELPER_unlocks then
v.unlocked = true; v.discovered = true; v.alerted = true
end --REMOVE THIS
if not v.unlocked and meta.unlocked[k] then
v.unlocked = true
end
if not v.unlocked then
G.P_LOCKED[#G.P_LOCKED + 1] = v
end
if not v.discovered and meta.discovered[k] then
v.discovered = true
end
if v.discovered and meta.alerted[k] or v.set == 'Back' or v.start_alerted then
v.alerted = true
elseif v.discovered then
v.alerted = false
end
end
end
table.sort(G.P_LOCKED, function (a, b) return a.order and b.order and a.order < b.order end)
for k, v in pairs(G.P_BLINDS) do
v.key = k
if not v.wip and not v.demo then
if TESTHELPER_unlocks then v.discovered = true; v.alerted = true end --REMOVE THIS
if not v.discovered and meta.discovered[k] then
v.discovered = true
end
if v.discovered and meta.alerted[k] then
v.alerted = true
elseif v.discovered then
v.alerted = false
end
end
end
for k, v in pairs(G.P_TAGS) do
v.key = k
if not v.wip and not v.demo then
if TESTHELPER_unlocks then v.discovered = true; v.alerted = true end --REMOVE THIS
if not v.discovered and meta.discovered[k] then
v.discovered = true
end
if v.discovered and meta.alerted[k] then
v.alerted = true
elseif v.discovered then
v.alerted = false
end
end
end
for k, v in pairs(G.P_SEALS) do
v.key = k
if not v.wip and not v.demo then
if TESTHELPER_unlocks then
v.discovered = true; v.alerted = true
end --REMOVE THIS
if not v.discovered and meta.discovered[k] then
v.discovered = true
end
if v.discovered and meta.alerted[k] then
v.alerted = true
elseif v.discovered then
v.alerted = false
end
end
end
for k, v in pairs(G.P_SKILLS or {}) do
v.key = k
if not v.wip and not v.demo then
if TESTHELPER_unlocks then
v.unlocked = true; v.discovered = true; v.alerted = true
end --REMOVE THIS
if not v.unlocked and meta.unlocked[k] then
v.unlocked = true
end
if not v.discovered and meta.discovered[k] then
v.discovered = true
end
if v.discovered then
v.alerted = false
end
end
end
for k, v in pairs(G.P_CRAFTS or {}) do
v.key = k
if not v.wip and not v.demo then
if TESTHELPER_unlocks then
v.unlocked = true; v.discovered = true; v.alerted = true
end --REMOVE THIS
if not v.unlocked and meta.unlocked[k] then
v.unlocked = true
end
if not v.discovered and meta.discovered[k] then
v.discovered = true
end
if v.discovered then
v.alerted = false
end
end
end
for _, t in ipairs{
G.P_CENTERS,
G.P_BLINDS,
G.P_TAGS,
G.P_SEALS,
G.P_SKILLS or {},
G.P_CRAFTS or {},
} do
for k, v in pairs(t) do
v._discovered_unlocked_overwritten = true
end
end
end
function get_skills(during_game)
local shown_skills = {}
for i, j in ipairs(G.P_CENTER_POOLS['Skill']) do
local layer = get_skill_layer(j.key)
j.layer = layer
if not shown_skills[layer] then
shown_skills[layer] = {offset = 0, tier = layer}
end
if during_game and not G.GAME.hide_unlearnable then
shown_skills[layer][#shown_skills[layer] + 1] = j.key
else
local valid = true
if j.prereq then
for i2, j2 in ipairs(j.prereq) do
if not during_game or not G.GAME.skills[j2] then
valid = false
end
end
end
if valid then
shown_skills[layer][#shown_skills[layer] + 1] = j.key
end
end
end
return shown_skills
end
function refresh_skill_menu_skills()
local offsets = {}
offsets[1] = G.GAME.skill_tree_data[1].offset
offsets[2] = G.GAME.skill_tree_data[2].offset
offsets[3] = G.GAME.skill_tree_data[3].offset
G.GAME.skill_tree_data = get_skills(true)
for i = 1, 3 do
if offsets[i] + 5 > #G.GAME.skill_tree_data[i] then
offsets[i] = math.max(0, #G.GAME.skill_tree_data[i] - 5)
end
end
G.GAME.skill_tree_data[1].offset = offsets[1]
G.GAME.skill_tree_data[2].offset = offsets[2]
G.GAME.skill_tree_data[3].offset = offsets[3]
for i = 1, 3 do
local offset = G.GAME.skill_tree_data[i].offset
skills = {offset = offset, tier = i}
for j = offset + 1, offset + 5 do
if G.GAME.skill_tree_data[i][j] then
table.insert(skills, G.GAME.skill_tree_data[i][j])
end
end
for j = 5, 1, -1 do
if G.areas[i].cards[j] then
G.areas[i].cards[j]:remove()
end
end
for k, j in ipairs(skills) do
local center = G.P_SKILLS[j]
local card = Card(G.areas[i].T.x + G.areas[i].T.w/2, G.areas[i].T.y, G.CARD_W, G.CARD_H, nil, center)
card:start_materialize()
if G.GAME.skill_debuffs[center.key] then
card.debuff = true
end
G.areas[i]:emplace(card)
end
end
end
function get_skill_layer(direct_)
local tier = 1
local skill = G.P_SKILLS[direct_]
if skill.layer then
return skill.layer
end
if skill then
for i, j in ipairs(skill.prereq) do
local skill2 = G.P_SKILLS[j]
if skill2.branch ~= skill.branch then
tier = math.max(get_skill_layer(j) + 1, tier)
else
tier = math.max(get_skill_layer(j), tier)
end
end
end
return math.min(3, tier)
end
function fix_ante_scaling(do_blind)
local result = 1
for i, j in pairs(G.GAME.scaling_multipliers) do
result = result * j
end
result = 0.01 * math.max(1,math.floor(result * 100))
local orig = G.GAME.starting_params.ante_scaling
G.GAME.starting_params.ante_scaling = result * G.GAME.base_ante_scaling
local mult = 0.01 * math.max(1,math.floor(G.GAME.starting_params.ante_scaling / orig * 100))
if not do_blind and G.GAME.blind and G.GAME.blind.chips and G.GAME.blind.chip_text then
G.GAME.blind.chips = math.floor(G.GAME.blind.chips * mult)
G.GAME.blind.chip_text = number_format(G.GAME.blind.chips)
end
end
function learn_skill(card, direct_, debuffing)
local obj, key = "", ""
if direct_ then
obj = G.P_SKILLS[direct_]
key = direct_
else
obj = card.config.center
key = obj.key
end
if not debuffing then
G.GAME.skills[key] = true
end
if G.GAME.ante_banners and not G.GAME.ante_banners[key] then
G.GAME.ante_banners[key] = G.GAME.round_resets.ante
end
if not obj.class and (G.GAME.free_skills and (G.GAME.free_skills > 0)) then
G.GAME.free_skills = G.GAME.free_skills - 1
elseif not debuffing then
G.GAME.skill_xp = G.GAME.skill_xp - obj.xp_req
G.GAME.xp_spent = (G.GAME.xp_spent or 0) + obj.xp_req
end
if obj.token_req and not debuffing then
G.GAME.legendary_tokens = G.GAME.legendary_tokens - obj.token_req
end
check_for_unlock({type = 'skill_check', learned_skill = key, learned_tier = obj.tier})
if card then
discover_card(obj)
card:set_sprites(obj)
end
if key == "sk_grm_ease_1" then
G.GAME.scaling_multipliers.ease1 = 0.9
fix_ante_scaling()
elseif key == "sk_grm_ease_2" then
G.GAME.scaling_multipliers.ease2 = 0.8
fix_ante_scaling()
elseif key == "sk_grm_hexahedron_1" then
G.E_MANAGER:add_event(Event({func = function()
G.GAME.round_resets.reroll_cost = G.GAME.round_resets.reroll_cost - 1
G.GAME.current_round.reroll_cost = math.max(0, G.GAME.current_round.reroll_cost - 1)
return true end }))
elseif key == "sk_grm_ocean_1" then
G.hand:change_size(1)
elseif key == "sk_grm_stake_1" then
G.GAME.win_ante = G.GAME.win_ante + 1
G.hand:change_size(1)
elseif key == "sk_grm_stake_2" then
G.GAME.win_ante = G.GAME.win_ante + 2
G.E_MANAGER:add_event(Event({func = function()
if G.jokers then
G.jokers.config.card_limit = G.jokers.config.card_limit + 1
end
return true end }))
elseif key == "sk_grm_stake_3" then
G.GAME.scaling_multipliers.stake = 1.3 ^ G.GAME.round_resets.ante
fix_ante_scaling()
G.E_MANAGER:add_event(Event({func = function()
if G.jokers then
G.jokers.config.card_limit = G.jokers.config.card_limit + 3
end
return true end }))
elseif key == "sk_grm_scarce_1" then
for i, j in ipairs({'p_buffoon_normal_1', 'p_buffoon_normal_2', 'p_buffoon_jumbo_1', 'p_buffoon_mega_1'}) do
if not G.GAME.banned_keys[j] then
G.GAME.banned_keys[j] = 'grim'
end
end
G.GAME.orig_joker_rate = G.GAME.joker_rate
elseif key == "sk_grm_ghost_1" then
G.hand:change_size(-1)
elseif key == "sk_grm_ghost_2" then
G.hand:change_size(-2)
elseif key == "sk_grm_chime_3" then
G.GAME.round_resets.hands = G.GAME.round_resets.hands - 1
ease_hands_played(-1)
if ((G.GAME.round_resets.ante) % 3 == 0) and not G.GAME.reset_antes3[G.GAME.round_resets.ante] then
G.GAME.reset_antes3[G.GAME.round_resets.ante] = true
ease_ante(-1, true)
if skill_active("sk_grm_stake_3") then
G.GAME.scaling_multipliers.stake = 1.3 ^ G.GAME.round_resets.ante
fix_ante_scaling()
end
end
elseif key == "sk_grm_strike_3" then
G.GAME.scaling_multipliers.strike = 1.2
fix_ante_scaling()
elseif key == "sk_grm_receipt_3" then
G.GAME.bankrupt_at = G.GAME.bankrupt_at - 25
elseif key == "sk_grm_mystical_2" then
G.E_MANAGER:add_event(Event({func = function()
for k, v in pairs(G.I.CARD) do
if v.set_cost then v:set_cost() end
end
return true end }))
elseif key == "sk_grm_receipt_2" then
G.E_MANAGER:add_event(Event({func = function()
for k, v in pairs(G.I.CARD) do
if v.set_cost then v:set_cost() end
end
return true end }))
elseif key == "sk_grm_chime_1" and ((G.GAME.round_resets.ante) % 8 == 0) and not G.GAME.reset_antes[G.GAME.round_resets.ante] then
G.GAME.reset_antes[G.GAME.round_resets.ante] = true
ease_ante(-1, true)
if skill_active("sk_grm_stake_3") then
G.GAME.scaling_multipliers.stake = 1.3 ^ G.GAME.round_resets.ante
fix_ante_scaling()
end
elseif key == "sk_grm_chime_2" and ((G.GAME.round_resets.ante) % 4 == 0) and not G.GAME.reset_antes2[G.GAME.round_resets.ante] then
G.GAME.reset_antes2[G.GAME.round_resets.ante] = true
ease_ante(-1, true)
if skill_active("sk_grm_stake_3") then
G.GAME.scaling_multipliers.stake = 1.3 ^ G.GAME.round_resets.ante
fix_ante_scaling()
end
elseif key == "sk_grm_cl_hoarder" then
G.hand:change_size(-1)
G.GAME.grim_class.hoarder = true
G.GAME.grim_class.class = true
elseif key == "sk_grm_cl_astronaut" then
G.GAME.grim_class.astronaut = true
G.GAME.grim_class.class = true
elseif key == "sk_grm_cl_alchemist" then
G.GAME.banned_keys['c_devil'] = true
G.GAME.elemental_rate = 4
G.GAME.grim_class.alchemist = true
G.GAME.grim_class.class = true
elseif key == "sk_grm_cl_explorer" then
G.GAME.grim_class.explorer = true
G.GAME.grim_class.class = true
elseif key == "sk_grm_orbit_1" then
G.GAME.lunar_rate = 4
G.GAME.stellar_rate = 4
elseif key == "sk_grm_sticky_2" then
G.GAME.perishable_rounds = (G.GAME.perishable_rounds or 5) + 3
for i = 1, #G.jokers.cards do
if G.jokers.cards[i].ability.perishable then
G.jokers.cards[i].ability.perish_tally = (G.jokers.cards[i].ability.perish_tally or 5) + 3
G.jokers.cards[i]:set_debuff()
end
end
elseif key == "sk_grm_sticky_3" then
G.GAME.rental_rate = -G.GAME.rental_rate
elseif key == "sk_grm_shelf_1" then
change_shop_size(-1)
G.GAME.grm_modify_booster_slots = (G.GAME.grm_modify_booster_slots or 0) + 2
if G.shop then
for i = 3, 4 do
local card = Card(G.shop_booster.T.x + G.shop_booster.T.w/2,
G.shop_booster.T.y, G.CARD_W*1.27, G.CARD_H*1.27, G.P_CARDS.empty, G.P_CENTERS[get_pack('shop_pack').key], {bypass_discovery_center = true, bypass_discovery_ui = true})
create_shop_card_ui(card, 'Booster', G.shop_booster)
card.ability.booster_pos = i
card:start_materialize()
G.shop_booster:emplace(card)
end
end
elseif key == "sk_grm_shelf_2" then
if not G.GAME.grm_did_purchase then
change_shop_size(1)
end
elseif key == "sk_grm_prestige_1" then
if not debuffing then
local pool = {}
for i, j in pairs(G.GAME.skills) do
if not G.P_SKILLS[i].class and (i ~= "sk_grm_prestige_1") then
table.insert(pool, i)
end
end
for i, j in ipairs(pool) do
unlearn_skill(j)
end
skills_page = nil
if G.GAME.xp_spent >= 2500 then
G.GAME.legendary_tokens = (G.GAME.legendary_tokens or 0) + 1
end
else
G.GAME.legendary_tokens = (G.GAME.legendary_tokens or 0) + 1
end
elseif key == "sk_grm_dash_1" then
if G.GAME.force_grm_packs then
table.insert(G.GAME.force_grm_packs, "Standard")
end
elseif key == "sk_grm_midas_touch" then
for i, j in ipairs(G.playing_cards) do
j:set_ability(G.P_CENTERS.m_gold)
end
if G.pack_cards and G.pack_cards.cards then
for i, j in ipairs(G.pack_cards.cards) do
j:set_ability(G.P_CENTERS.m_gold)
end
end
elseif key == "sk_cry_ace_1" then
pseudoseed("cry_crash")
elseif key == "sk_cry_m_3" then
if #G.jokers.cards < G.jokers.config.card_limit then
local card = SMODS.create_card { key = "j_grm_jolly_jimball" }
card:add_to_deck()
G.jokers:emplace(card)
end
elseif key == "sk_poke_energetic_1" then
G.GAME.energy_plus = (G.GAME.energy_plus or 0) + 1
elseif key == "sk_ortalab_decay_1" then
for i, j in ipairs({'p_arcana_normal_1', 'p_arcana_normal_2', 'p_arcana_normal_3', 'p_arcana_normal_4', 'p_arcana_jumbo_1', 'p_arcana_jumbo_2', 'p_arcana_mega_1', 'p_arcana_mega_2', 'p_celestial_normal_1', 'p_celestial_normal_2', 'p_celestial_normal_3', 'p_celestial_normal_4', 'p_celestial_jumbo_1', 'p_celestial_jumbo_2', 'p_celestial_mega_1', 'p_celestial_mega_2'}) do
if not G.GAME.banned_keys[j] then
G.GAME.banned_keys[j] = 'grim'
end
end
G.GAME.orig_tarot_rate = G.GAME.tarot_rate
G.GAME.orig_planet_rate = G.GAME.planet_rate
elseif key == "sk_ortalab_starry_3" then
G.GAME.orig_Zodiac_Reduction = G.GAME.Ortalab_Zodiac_Reduction
G.GAME.Ortalab_Zodiac_Reduction = 0
end
end
function unlearn_skill(direct_, debuffing)
local obj, key = G.P_SKILLS[direct_], direct_
if not debuffing then
G.GAME.skills[key] = nil
end
if G.GAME.skill_debuffs[direct_] and not debuffing then
G.GAME.skill_debuffs[direct_] = nil
return
end
if key == "sk_grm_ease_1" then
G.GAME.scaling_multipliers.ease1 = nil
fix_ante_scaling()
elseif key == "sk_grm_ease_2" then
G.GAME.scaling_multipliers.ease2 = nil
fix_ante_scaling()
elseif key == "sk_grm_hexahedron_1" then
G.E_MANAGER:add_event(Event({func = function()
G.GAME.round_resets.reroll_cost = G.GAME.round_resets.reroll_cost + 1
G.GAME.current_round.reroll_cost = math.max(0, G.GAME.current_round.reroll_cost + 1)
return true end }))
elseif key == "sk_grm_ocean_1" then
G.hand:change_size(-1)
elseif key == "sk_grm_stake_1" then
G.GAME.win_ante = G.GAME.win_ante - 1
G.hand:change_size(-1)
elseif key == "sk_grm_stake_2" then
G.GAME.win_ante = G.GAME.win_ante - 2
G.E_MANAGER:add_event(Event({func = function()
if G.jokers then
G.jokers.config.card_limit = G.jokers.config.card_limit - 1
end
return true end }))
elseif key == "sk_grm_stake_3" then
G.GAME.scaling_multipliers.stake = nil
fix_ante_scaling()
G.E_MANAGER:add_event(Event({func = function()
if G.jokers then
G.jokers.config.card_limit = G.jokers.config.card_limit - 3
end
return true end }))
elseif key == "sk_grm_scarce_1" then
for i, j in ipairs({'p_buffoon_normal_1', 'p_buffoon_normal_2', 'p_buffoon_jumbo_1', 'p_buffoon_mega_1'}) do
if G.GAME.banned_keys[j] == 'grim' then
G.GAME.banned_keys[j] = nil
end
end
G.GAME.joker_rate = G.GAME.orig_joker_rate
G.GAME.orig_joker_rate = nil
elseif key == "sk_grm_ghost_1" then
G.hand:change_size(1)
elseif key == "sk_grm_ghost_2" then
G.hand:change_size(2)
elseif key == "sk_grm_chime_3" then
G.GAME.round_resets.hands = G.GAME.round_resets.hands + 1
ease_hands_played(1)
elseif key == "sk_grm_strike_3" then
G.GAME.scaling_multipliers.strike = nil
fix_ante_scaling()
elseif key == "sk_grm_receipt_3" then
G.GAME.bankrupt_at = G.GAME.bankrupt_at + 25
elseif key == "sk_grm_mystical_2" then
G.E_MANAGER:add_event(Event({func = function()
for k, v in pairs(G.I.CARD) do
if v.set_cost then v:set_cost() end
end
return true end }))
elseif key == "sk_grm_receipt_2" then
G.E_MANAGER:add_event(Event({func = function()
for k, v in pairs(G.I.CARD) do
if v.set_cost then v:set_cost() end
end
return true end }))
-- elseif key == "sk_grm_cl_hoarder" then
-- G.hand:change_size(1)
-- G.GAME.grim_class.hoarder = true
-- G.GAME.grim_class.class = true
-- elseif key == "sk_grm_cl_astronaut" then
-- G.GAME.grim_class.astronaut = true
-- G.GAME.grim_class.class = true
-- elseif key == "sk_grm_cl_alchemist" then
-- G.GAME.banned_keys['c_devil'] = true
-- G.GAME.elemental_rate = 4
-- G.GAME.grim_class.alchemist = true
-- G.GAME.grim_class.class = true
-- elseif key == "sk_grm_cl_explorer" then
-- G.GAME.grim_class.explorer = true
-- G.GAME.grim_class.class = true
elseif key == "sk_grm_orbit_1" then
G.GAME.lunar_rate = 0
G.GAME.stellar_rate = 0
elseif key == "sk_grm_sticky_2" then
G.GAME.perishable_rounds = (G.GAME.perishable_rounds or 5) - 3
for i = 1, #G.jokers.cards do
if G.jokers.cards[i].ability.perishable then
G.jokers.cards[i].ability.perish_tally = math.max(0,(G.jokers.cards[i].ability.perish_tally or 5) - 3)
G.jokers.cards[i]:set_debuff()
end
end
elseif key == "sk_grm_sticky_3" then
G.GAME.rental_rate = -G.GAME.rental_rate
elseif key == "sk_grm_shelf_1" then
change_shop_size(1)
G.GAME.grm_modify_booster_slots = (G.GAME.grm_modify_booster_slots or 0) - 2
if G.shop then
end
elseif key == "sk_grm_shelf_2" then
if not G.GAME.grm_did_purchase then
change_shop_size(-1)
end
elseif key == "sk_cry_m_3" then
for i = 1, #G.jokers.cards do
local card = G.jokers.cards[i]
if (card.ability.name == "JollyJimball") and not card.ability.eternal then
card:start_dissolve()
return
end
end
elseif key == "sk_poke_energetic_1" then
G.GAME.energy_plus = (G.GAME.energy_plus or 0) - 1
elseif key == "sk_grm_prestige_1" then
G.GAME.legendary_tokens = (G.GAME.legendary_tokens or 0) - 1
elseif key == "sk_ortalab_decay_1" then
for i, j in ipairs({'p_arcana_normal_1', 'p_arcana_normal_2', 'p_arcana_normal_3', 'p_arcana_normal_4', 'p_arcana_jumbo_1', 'p_arcana_jumbo_2', 'p_arcana_mega_1', 'p_arcana_mega_2', 'p_celestial_normal_1', 'p_celestial_normal_2', 'p_celestial_normal_3', 'p_celestial_normal_4', 'p_celestial_jumbo_1', 'p_celestial_jumbo_2', 'p_celestial_mega_1', 'p_celestial_mega_2'}) do
if G.GAME.banned_keys[j] == 'grim' then
G.GAME.banned_keys[j] = nil
end
end
G.GAME.tarot_rate = G.GAME.orig_tarot_rate
G.GAME.orig_tarot_rate = nil
G.GAME.planet_rate = G.GAME.orig_planet_rate
G.GAME.orig_planet_rate = nil
elseif key == "sk_ortalab_starry_3" then
G.GAME.Ortalab_Zodiac_Reduction = G.GAME.orig_Zodiac_Reduction
G.GAME.orig_Zodiac_Reduction = nil
end
end
function debuff_skill(debuff_, direct_)
if debuff_ == nil then
debuff_ = true
end
if debuff_ == false then
debuff_ = nil
end
G.GAME.skill_debuffs = G.GAME.skill_debuffs or {}
if debuff_ and not G.GAME.skill_debuffs[direct_] then
unlearn_skill(direct_, true)
elseif not debuff_ and G.GAME.skill_debuffs[direct_] then
learn_skill(nil, direct_, true)
end
G.GAME.skill_debuffs[direct_] = debuff_
end
function skill_active(direct_)
if G.GAME.skill_debuffs and G.GAME.skill_debuffs[direct_] then
return false
end
if G.GAME.skills[direct_] then
return true
end