-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.lua
More file actions
163 lines (140 loc) · 4.67 KB
/
main.lua
File metadata and controls
163 lines (140 loc) · 4.67 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
SMODS.Atlas {
key = "modicon",
path = "BFDIIcon.png",
px = 34,
py = 34
}
SMODS.current_mod.optional_features = { cardareas = { unscored = true } }
to_big = to_big or function(x) return x end
to_number = to_number or function(x) return x end
if not count_consumables then
count_consumables = function()
if G.consumeables.get_total_count then
return G.consumeables:get_total_count()
else
return #G.consumeables.cards + G.GAME.consumeable_buffer
end
end
end
function count_tarots()
local tarot_counter = 0
if G.consumeables then
for _, card in pairs(G.consumeables.cards) do
if card.ability.set == "Tarot" then
tarot_counter = tarot_counter + 1
end
end
end
return tarot_counter
end
local allFolders = { "none", "items" }
local allFiles = { ["none"] = {}, ["items"] = { "BFDI", "BFDIA", "BFB-TPoT", "BFDIE", "OtherCharacters", "Misc", "Decks" } }
for i = 1, #allFolders do
if allFolders[i] == "none" then
for j = 1, #allFiles[allFolders[i]] do
assert(SMODS.load_file(allFiles[allFolders[i]][j] .. ".lua"))()
end
else
for j = 1, #allFiles[allFolders[i]] do
assert(SMODS.load_file(allFolders[i] .. "/" .. allFiles[allFolders[i]][j] .. ".lua"))()
end
end
end
G.C.BFDI = {}
G.C.BFDI.MISC_COLOURS = {
BFDI_GREEN = HEX("076908"),
BFDIE_ORANGE = HEX("E45D3B"),
BFDIE_LIME = HEX("D5E857")
}
local loc_colour_ref = loc_colour
function loc_colour(_c, default)
if not G.ARGS.LOC_COLOURS then
loc_colour_ref(_c, default)
elseif not G.ARGS.LOC_COLOURS.bfdi_colours then
G.ARGS.LOC_COLOURS.bfdi_colours = true
local new_colors = {
bfdi_green = G.C.BFDI_GREEN,
bfdi_orange = G.C.BFDIE_ORANGE,
bfdi_lime = G.C.BFDIE_LIME,
}
for k, v in pairs(new_colors) do
G.ARGS.LOC_COLOURS[k] = v
end
end
return loc_colour_ref(_c, default)
end
local ref = Card.start_dissolve
function Card:start_dissolve()
if self.config.center.bfdi_shatters then
return self:shatter()
else
return ref(self)
end
end
local igo = Game.init_game_object
function Game:init_game_object()
local ret = igo(self)
ret.current_round.book_card = { rank = "Ace", id = 14 }
ret.current_round.fanny_card = { rank = "Ace", id = 14 }
ret.current_round.bracelety_card = { rank = "Ace", id = 14 }
return ret
end
function SMODS.current_mod.reset_game_globals(run_start)
G.GAME.current_round.book_card = { rank = "Ace", id = 14 }
G.GAME.current_round.fanny_card = { rank = "Ace", id = 14 }
G.GAME.current_round.bracelety_card = { rank = "Ace", id = 14 }
local valid_cards = {}
for i, j in ipairs(G.playing_cards) do
if not SMODS.has_no_rank(j) then
valid_cards[#valid_cards + 1] = j
end
end
if valid_cards[1] then
local book_chosen_card = pseudorandom_element(valid_cards, pseudoseed('book' .. G.GAME.round_resets.ante))
G.GAME.current_round.book_card.rank = book_chosen_card.base.value
G.GAME.current_round.book_card.id = book_chosen_card.base.id
local fanny_chosen_card = pseudorandom_element(valid_cards, pseudoseed('fanny' .. G.GAME.round_resets.ante))
G.GAME.current_round.fanny_card.rank = fanny_chosen_card.base.value
G.GAME.current_round.fanny_card.id = fanny_chosen_card.base.id
local bracelety_chosen_card = pseudorandom_element(valid_cards, pseudoseed('bracelety' .. G.GAME.round_resets.ante))
G.GAME.current_round.bracelety_card.rank = bracelety_chosen_card.base.value
G.GAME.current_round.bracelety_card.id = bracelety_chosen_card.base.id
end
end
local update_ref = Game.update
function Game:update(dt)
for k, v in pairs(G.P_CENTERS) do
if v.bfdi_anim then
if not v.bfdi_anim.t then v.bfdi_anim.t = 0 end
if not v.bfdi_anim.length then
v.bfdi_anim.length = 0
for _, frame in ipairs(v.bfdi_anim) do
v.bfdi_anim.length = v.bfdi_anim.length + (frame.t or 0)
end
end
v.bfdi_anim.t = (v.bfdi_anim.t + dt) % v.bfdi_anim.length
local ix = 0
local t_tally = 0
for _, frame in ipairs(v.bfdi_anim) do
ix = ix + 1
t_tally = t_tally + frame.t
if t_tally > v.bfdi_anim.t then break end
end
v.pos.x = v.bfdi_anim[ix].x
v.pos.y = v.bfdi_anim[ix].y
end
end
return update_ref(self, dt)
end
local ref = Game.main_menu
function Game:main_menu(change_context)
for k, v in pairs(G.P_CENTERS) do
if v.config and v.config.extra and type(v.config.extra) == "table" and v.config.extra.is_contestant then
v.set_badges = function(self, card, badges)
badges[#badges + 1] = create_badge(localize('contestant_joker_badge'), G.C.BFDI.MISC_COLOURS.BFDI_GREEN,
G.C.WHITE, 1)
end
end
end
ref(self, change_context)
end