forked from MrYamiTsu/Giga-Balatro_Mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
280 lines (278 loc) · 6.43 KB
/
main.lua
File metadata and controls
280 lines (278 loc) · 6.43 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
Giga = SMODS.current_mod
Giga_path = SMODS.current_mod.path
Giga_config = SMODS.current_mod.config
Giga.calculate = function (self, context)
if context.end_of_round and context.main_eval then
for _, card in pairs(G.playing_cards) do
card.ability.giga_goldplusplus_increase = nil
end
G.GAME.giga.discarded_overcharge = 0
end
if context.card_added and context.card.ability.set == 'Giga_Artefact' then
G.GAME.giga.artefact_create = G.GAME.giga.artefact_create + 1
end
if context.discard then
if not context.other_card.debuff and Giga.has_overcharge(context.other_card) then
G.GAME.giga.discarded_overcharge = G.GAME.giga.discarded_overcharge + 1
end
end
if context.ending_shop then
Giga.check_fusion()
end
end
--#region LOADING FILES --
local load_u = {
'function',
'hook',
'ownership',
'pool',
'ui'
}
for _, v in pairs(load_u) do
assert(SMODS.load_file('utils/'..v..'.lua'))()
end
local load_i = {
'artefact',
'blind',
'booster',
'deck',
'deckskin',
'edition',
'enhancement',
'food',
'joker',
'overcharge',
'planet',
'pokerhand',
'seal',
'spectral',
'tarot',
'voucher'
}
for _, v in pairs(load_i) do
assert(SMODS.load_file('items/'..v..'.lua'))()
end
if next(SMODS.find_mod('foolsGambit')) then
local full = FG.config.version
local major, minor = tonumber(string.sub(full,1,1)), tonumber(string.sub(full,3,3))
if major == 0 and minor >= 3 then
local load_fg = {
'food',
'joker'
}
for _,v in pairs(load_fg) do
assert(SMODS.load_file('items/CrossMod/foolsgambit/'..v..'.lua'))()
end
else
error("Your version of Fool's Gambit isn't supported. Please update to version 0.3.0.")
end
end
if CardSleeves then
SMODS.load_file('items/CrossMod/cardsleeves.lua')()
end
if next(SMODS.find_mod('partner')) then
SMODS.load_file('items/CrossMod/partner.lua')()
end
if next(SMODS.find_mod('paperback')) then
SMODS.load_file('items/CrossMod/paperback.lua')()
end
--#endregion
--#region ATLAS --
SMODS.Atlas{
key = 'modicon',
path = 'modicon.png',
px = 32,
py = 32
}
SMODS.Atlas{
key = 'Jokers',
path = 'Joker.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Foods',
path = 'Food.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Enhancements',
path = 'Enhancement.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Vouchers',
path = 'Voucher.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Boosters',
path = 'Booster.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Decks',
path = 'Deck.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Consumeables',
path = 'Consumeable.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Seals',
path = 'Seal.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Blinds',
path = 'Blind.png',
px = 34,
py = 34,
frames = 21,
atlas_table = 'ANIMATION_ATLAS'
}
SMODS.Atlas{
key = 'Planets',
path = 'Planet.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Overcharges',
path = 'Overcharge.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'Artefacts',
path = 'Artefact.png',
px = 71,
py = 95
}
SMODS.Atlas {
key = 'skin_lc',
path = 'Skin_Opt1.png',
px = 71,
py = 95
}
SMODS.Atlas {
key = 'skin_hc',
path = 'Skin_Opt2.png',
px = 71,
py = 95
}
SMODS.Atlas{
key = 'secret1',
path = 'secret1.png',
px = 166,
py = 162
}
SMODS.Atlas{
key = 'secret2',
path = 'secret2.png',
px = 252,
py = 173
}
SMODS.Atlas{
key = 'secret3',
path = 'secret3.png',
px = 147,
py = 184
}
SMODS.Atlas{
key = 'secret4',
path = 'secret4.png',
px = 191,
py = 170
}
--#endregion
--#region RARITY --
SMODS.Rarity{
key = 'megaLegendary',
loc_txt = {
name = 'Mega Legendary',
},
badge_colour = HEX('dbd809'),
}
--#endregion
--#region CUSTOM COLOUR --
loc_colour()
G.ARGS.LOC_COLOURS.giga_Food = HEX('F2A5A6FF')
G.ARGS.LOC_COLOURS.giga_Artefact = HEX('444444FF')
--#endregion
--#region CONFIG --
-- From Maximus (so thx Maximus)
Giga.config_tab = function()
return{
n = G.UIT.ROOT,
config = { align = "m", r = 0.1, padding = 0.1, colour = G.C.BLACK, minw = 8, minh = 6 },
nodes = {
{ n = G.UIT.R, config = { align = "cl", padding = 0, minh = 0.1 }, nodes = {} },
{
n = G.UIT.R,
config = { align = "cl", padding = 0 },
nodes = {
{
n = G.UIT.C,
config = { align = "cl", padding = 0.05 },
nodes = {
create_toggle { col = true, label = "", scale = 1, w = 0, shadow = true, ref_table = Giga_config, ref_value = "menu_card" },
}
},
{
n = G.UIT.C,
config = { align = "c", padding = 0 },
nodes = {
{ n = G.UIT.T, config = { text = localize('b_giga_custom_menu_card'), scale = 0.45, colour = G.C.UI.TEXT_LIGHT } },
}
}
}
}
}
}
end
--#endregion
--#region INITIALISATION --
Giga.reset_game_globals = function(run_start)
if run_start then
G.GAME.giga = {}
G.GAME.giga.vouchers = {}
G.GAME.giga.astral_chance = {1, 20}
G.GAME.giga.shiny_chance = {2, 25}
G.GAME.giga.discarded_overcharge = 0
G.GAME.giga.artefact_create = 0
end
end
--#endregion
--#region RANDOM SCORING ORDER --
-- From TogaStuff (so thx Toga)
Giga.preprocess = function(context, input)
local output = input or context.cardarea and context.cardarea.cards or nil
if not output then
if context.cardarea == G.play then output = context.full_hand
elseif context.cardarea == G.hand then output = G.hand.cards
elseif context.cardarea == 'unscored' then output = context.full_hand end
end
if not output then return end
if G.GAME.modifiers.giga_randomscore then output = ShuffleMyTable(output, 'kjgas') end
return output
end
Giga.areaprocess = function(t)
t = t or {}
local output = t
if G.GAME.modifiers.giga_randomscore then output = ShuffleMyTable(output, 'kjgas') end
return output
end
Giga.areaorderprocess = function(t)
return Giga.areaprocess(t)
end
--#endregion