forked from Evgast/JimboAnd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
303 lines (280 loc) · 7.22 KB
/
main.lua
File metadata and controls
303 lines (280 loc) · 7.22 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
JAND = SMODS.current_mod
JAND.optional_features = {
retrigger_joker = true,
}
JAND.ui_config = {
colour = darken(G.C.GREEN, 0.6),
author_colour = G.C.PURPLE,
bg_colour = { G.C.GREEN[1], G.C.GREEN[2], G.C.GREEN[2], 0.3 },
back_colour = G.C.GREEN,
tab_button_colour = G.C.GREEN,
}
JAND.custom_ui = function(nodes)
local logo = { n = G.UIT.R, config = { align = 'cm' }, nodes = {
{n = G.UIT.R, config = { align = 'cm' }, nodes = {
{n = G.UIT.O, config = {object = SMODS.create_sprite(0, 0, 7, 2.8, 'jand_jandgo', { x = 0, y = 0 })}}
}}
}}
table.insert(nodes, 2, logo)
return nodes
end
JAND.custom_collection_tabs = function()
local t = UIBox_button({button = 'your_collection_shopkeepers', label = {"Shopkeepers"}, minw = 5})
return { t }
end
JAND.set_debuff = function(card)
if card.ability.jand_minty then
return "prevent_debuff"
end
end
JAND.calculate = function(self, context)
if context.starting_shop and not G.PROFILES[G.SETTINGS.profile].shopkey_tut then
G.PROFILES[G.SETTINGS.profile].shopkey_tut = true
local loc = {}
local quip = {}
localize{type = "descriptions", key = "extra_shop_keyb", set = "Tutor", default_col = G.C.UI.TEXT_LIGHT, nodes = loc, vars = {}, scale = 1.5}
quip = {transparent_multiline_text(loc)}
G.FUNCS.overlay_menu({
definition = create_UIBox_generic_options({
contents = {
{n=G.UIT.R, config={align = "cm"}, nodes=
quip
}
}
})
})
end
if context.ante_change and context.ante_end then
restock_extra_shop()
end
if context.jimband_joker_align then
for k, card in pairs(G.jokers.cards) do
if card.ability.jand_weight_d and card.area == G.jokers then
for i = 1, #G.jokers.cards do
if G.jokers.cards[i] == card then
local half = #G.jokers.cards / 2
if math.floor(half) < half then
half = half + 1
end
if i > half then
SMODS.debuff_card(card, true, "weight_d")
else
SMODS.debuff_card(card, false, "weight_d")
end
end
end
end
if card.ability.jand_weight_u and card.area == G.jokers then
for i = 1, #G.jokers.cards do
if G.jokers.cards[i] == card then
local half = #G.jokers.cards / 2
local brainfart = false
if math.floor(half) < half then
half = math.ceil(half)
brainfart = true
end
if (i <= half and not brainfart) or (i < half and brainfart) then
SMODS.debuff_card(card, true, "weight_u")
else
SMODS.debuff_card(card, false, "weight_u")
end
end
end
end
end
end
end
JAND.custom_card_areas = function(G)
G.danbo = CardArea(
0, 0, 0, 0,
{
card_limit = 1,
type = 'discard',
highlight_limit = 1,
no_card_count = true
}
)
G.jand_shopkeep = CardArea(
0, 0, G.CARD_W * 1.05, G.CARD_H * 1.05,
{
card_limit = 1,
type = 'joker',
highlight_limit = 1,
no_card_count = true
}
)
G.jand_shop = CardArea(
0, 0, G.CARD_W * 5.05, G.CARD_H * 1.05,
{
card_limit = 1,
type = 'shop',
highlight_limit = 1,
no_card_count = true,
jand_no_use = true
}
)
end
SMODS.Atlas {
key = "jimband",
path = "jimband.png",
px = 71,
py = 95
}
SMODS.Atlas {
key = "cardmods",
path = "cardmods.png",
px = 71,
py = 95
}
SMODS.Atlas {
key = "keepers",
path = "keepers.png",
px = 71,
py = 95
}
SMODS.Atlas {
key = "jandgo",
path = "jandgo.png",
px = 338,
py = 133
}
SMODS.Atlas {
key = "modicon",
path = "modicon.png",
px = 34,
py = 34
}
if not SMODS.ObjectTypes['Food'] then
SMODS.ObjectType({
key = "Food",
default = "j_ice_cream",
cards = {
j_gros_michel = true,
j_egg = true,
j_ice_cream = true,
j_cavendish = true,
j_turtle_bean = true,
j_diet_cola = true,
j_popcorn = true,
j_ramen = true,
j_selzer = true,
},
})
end
SMODS.ObjectType({
key = "jand_sk",
cards = {
},
})
SMODS.load_file("hooks.lua")()
SMODS.load_file("extra_shop.lua")()
--I'll probably add a feature for disabling packs one day
SMODS.load_file("content/jokers/azumatsuba.lua")()
SMODS.load_file("content/jokers/danbo_func.lua")()
--gimko
SMODS.load_file("content/jokers/gimmiko.lua")()
SMODS.load_file("content/stickers/gimmiko.lua")()
SMODS.load_file("content/shopkeepers/gimmiko.lua")()
function table.contains(table, element) --why did I have that again? Sure I'll probably use it one day but I still didn't do so
if table and type(table) == "table" then
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end
end
function JAND.table_remove(table, element)
for i = 1, #table do
if table[i] == element then
table.remove(table, i)
end
end
return table
end
function JAND.value_mod(value, multiplier, depth)
for k, v in pairs(value) do
if not depth then
depth = 0
end
if type(v) == "number" then
value[k] = value[k] * multiplier
elseif not (depth>2) and type(v) == "table" then
JAND.value_mod(v, multiplier, depth+1)
end
end
end
function Card:is_movable()
if self.pinned or self.ability.immovable then
return false
else
return true
end
end
function JAND.swap_cards(card, type, amount, jump)
local og_slot
local sw_slot
for i=1, #card.area.cards do
if card.area.cards[i] == card then
og_slot = i
end
end
if type == "leftmost" then
if og_slot == 1 then
sw_slot = 1
elseif not card.area.cards[1]:is_movable() then
local stop
for i=1, #card.area.cards do
if card.area.cards[i]:is_movable() and not stop then
sw_slot = i
stop = true
end
end
elseif card.area.cards[1]:is_movable() then
sw_slot = 1
end
elseif type == "rightmost" then
if not card.area.cards[#card.area.cards]:is_movable() then
for i=1, #card.area.cards do
if card.area.cards[i]:is_movable() then
sw_slot = i
end
end
else
sw_slot = #card.area.cards
end
elseif type == "adjacent" then
if card.area.cards[og_slot+amount] then
if card.area.cards[og_slot+amount]:is_movable() then
sw_slot = og_slot + amount
elseif jump and not card.area.cards[og_slot+amount]:is_movable() then
sw_slot = og_slot
local stop
for i=1, #card.area.cards do
if amount > 0 then
if (i > og_slot+amount) and not stop then
if card.area.cards[i] and card.area.cards[i]:is_movable() then
sw_slot = i
stop = true
end
end
end
if amount < 0 then
if i < og_slot+amount then
if card.area.cards[i] and card.area.cards[i]:is_movable() then
sw_slot = i
end
end
end
end
else
sw_slot = og_slot
end
end
end
if (og_slot and sw_slot) and (og_slot ~= sw_slot) then
card.area.cards[og_slot], card.area.cards[sw_slot] = card.area.cards[sw_slot], card.area.cards[og_slot]
end
return sw_slot
end