Skip to content

Commit 726e8de

Browse files
Custom main menu changes
- Splash screen Joker is no longer Jolly Joker if Custom Main Menu is disabled - Ace in the splash screen no longer appears Glitched if custom main menu is disabled - Removed CCD cards from the splash screen because they caused fps drope on profiles where consumables are undiscovered
1 parent 603108c commit 726e8de

File tree

1 file changed

+259
-0
lines changed

1 file changed

+259
-0
lines changed

lib/lib_misc.toml

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
[manifest]
2+
version = "1.0.0"
3+
dump_lua = true
4+
priority = -1
5+
6+
# Make the splash screen more jolly
7+
# Requires "Custom Main Menu" config to be enabled
8+
[[patches]]
9+
[patches.pattern]
10+
target = "game.lua"
11+
pattern = "SC = Card(G.ROOM.T.w/2 - SC_scale*G.CARD_W/2, 10. + G.ROOM.T.h/2 - SC_scale*G.CARD_H/2, SC_scale*G.CARD_W, SC_scale*G.CARD_H, G.P_CARDS.empty, G.P_CENTERS['j_joker'])"
12+
position = "after"
13+
payload = '''
14+
if Cryptid_config.menu then
15+
SC = Card(G.ROOM.T.w/2 - SC_scale*G.CARD_W/2, 10. + G.ROOM.T.h/2 - SC_scale*G.CARD_H/2, SC_scale*G.CARD_W, SC_scale*G.CARD_H, G.P_CARDS.empty, G.P_CENTERS['j_jolly'],{bypass_discovery_center = true, bypass_discovery_ui = true})
16+
end
17+
'''
18+
match_indent = true
19+
20+
# Make cards in splash screen CCD cards
21+
# Disabling this because it caused fps drops on profiles with nothing discovered
22+
[[patches]]
23+
[patches.pattern]
24+
target = "game.lua"
25+
pattern = "if math.random() > 0.8 then card.sprite_facing = 'back'; card.facing = 'back' end"
26+
position = "before"
27+
payload = '''
28+
--if Cryptid.random_consumable then card:set_ability(Cryptid.random_consumable('cry_splash',{"no_grc"},nil,nil,true), true, nil) end
29+
'''
30+
match_indent = true
31+
32+
# Show Glitched Edition to confirm Cryptid is Active if custom main menu is enabled
33+
[[patches]]
34+
[patches.pattern]
35+
target = "game.lua"
36+
pattern = "replace_card.states.visible = false"
37+
position = "before"
38+
payload = '''
39+
if Cryptid_config.menu then
40+
replace_card:set_edition(G.P_CENTERS.e_cry_glitched and 'e_cry_glitched' or 'e_negative',true,true)
41+
end
42+
'''
43+
match_indent = true
44+
45+
# Patch related crash
46+
[[patches]]
47+
[patches.pattern]
48+
target = "card.lua"
49+
pattern = "if not initial then G.GAME.blind:debuff_card(self) end"
50+
position = "at"
51+
payload = "if not initial and G.GAME and G.GAME.blind then G.GAME.blind:debuff_card(self) end"
52+
match_indent = true
53+
54+
# Draw midground layer
55+
[[patches]]
56+
[patches.pattern]
57+
target = "card.lua"
58+
pattern = "if self.config.center.soul_pos and (self.config.center.discovered or self.bypass_discovery_center) then"
59+
position = "after"
60+
payload = '''
61+
if self.config.center.soul_pos and self.config.center.soul_pos.extra and (self.config.center.discovered or self.bypass_discovery_center) then
62+
local scale_mod = 0.07-- + 0.02*math.cos(1.8*G.TIMERS.REAL) + 0.00*math.cos((G.TIMERS.REAL - math.floor(G.TIMERS.REAL))*math.pi*14)*(1 - (G.TIMERS.REAL - math.floor(G.TIMERS.REAL)))^3
63+
local rotate_mod = 0--0.05*math.cos(1.219*G.TIMERS.REAL) + 0.00*math.cos((G.TIMERS.REAL)*math.pi*5)*(1 - (G.TIMERS.REAL - math.floor(G.TIMERS.REAL)))^2
64+
self.children.floating_sprite2:draw_shader('dissolve',0, nil, nil, self.children.center,scale_mod, rotate_mod,nil, 0.1--[[ + 0.03*math.cos(1.8*G.TIMERS.REAL)--]],nil, 0.6)
65+
self.children.floating_sprite2:draw_shader('dissolve', nil, nil, nil, self.children.center, scale_mod, rotate_mod)
66+
end
67+
'''
68+
match_indent = true
69+
70+
71+
# Custom variables in info queue
72+
[[patches]]
73+
[patches.pattern]
74+
target = "functions/common_events.lua"
75+
pattern = "function generate_card_ui(_c, full_UI_table, specific_vars, card_type, badges, hide_desc, main_start, main_end)"
76+
position = "after"
77+
payload = "if _c.specific_vars then specific_vars = _c.specific_vars end"
78+
match_indent = true
79+
80+
# Fix not all cards returning to hand on big hands
81+
[[patches]]
82+
[patches.pattern]
83+
target = "game.lua"
84+
pattern = "{card_limit = 500, type = 'discard'})"
85+
position = "at"
86+
payload = "{card_limit = 1e308, type = 'discard'})"
87+
match_indent = true
88+
89+
# When hand size exceeds deck size, space the cards as if the hand size was equal to the deck size
90+
[[patches]]
91+
[patches.pattern]
92+
target = "cardarea.lua"
93+
pattern = "function CardArea:align_cards()"
94+
position = "after"
95+
payload = '''
96+
if self.config.type == 'hand' then
97+
self.config.temp_limit = math.min(self.config.card_limit, #G.playing_cards)
98+
end
99+
'''
100+
match_indent = true
101+
102+
# Crash fix
103+
[[patches]]
104+
[patches.pattern]
105+
target = "functions/button_callbacks.lua"
106+
pattern = "if not G.SAVED_GAME.VERSION or G.SAVED_GAME.VERSION < '0.9.2' then"
107+
position = "at"
108+
payload = "if not G.SAVED_GAME or not G.SAVED_GAME.VERSION or G.SAVED_GAME.VERSION < '0.9.2' then"
109+
match_indent = true
110+
111+
# Register banned bosses for rush hour
112+
# Also initializes disabled/enabled cards
113+
[[patches]]
114+
[patches.pattern]
115+
target = "game.lua"
116+
pattern = "set_profile_progress()"
117+
position = "before"
118+
payload = '''
119+
for i = 1, #G.CHALLENGES do
120+
if (G.CHALLENGES[i].id == 'c_cry_rush_hour' or G.CHALLENGES[i].id == 'c_cry_rush_hour_ii' or G.CHALLENGES[i].id == 'c_cry_rush_hour_iii') and #G.CHALLENGES[i].restrictions.banned_other == 0 then
121+
for k, v in pairs(G.P_BLINDS) do
122+
if k ~= "bl_cry_clock" and k ~= "bl_cry_lavender_loop" and v.boss then
123+
G.CHALLENGES[i].restrictions.banned_other[#G.CHALLENGES[i].restrictions.banned_other+1] = {id = k, type = 'blind'}
124+
end
125+
end
126+
end
127+
end
128+
'''
129+
match_indent = true
130+
131+
# Prevent Jokers from spitting empty messages
132+
[[patches]]
133+
[patches.pattern]
134+
target = "functions/common_events.lua"
135+
pattern = "text = extra.message or text"
136+
position = "after"
137+
payload = "if not text or text == '' then return end"
138+
match_indent = true
139+
140+
# Add default pool value for Consumeables
141+
[[patches]]
142+
[patches.pattern]
143+
target = "functions/common_events.lua"
144+
pattern = 'else _pool[#_pool + 1] = "j_joker"'
145+
position = "before"
146+
payload = '''elseif _type == 'Consumeables' then _pool[#_pool + 1] = "c_ceres"'''
147+
match_indent = true
148+
149+
# hand size forgiveness if playing negative or antimatter deck (someone please fix)
150+
[[patches]]
151+
[patches.pattern]
152+
target = "game.lua"
153+
pattern = "function Game:update_draw_to_hand(dt)"
154+
position = "after"
155+
payload = '''
156+
if G.GAME.selected_back and (G.GAME.selected_back.name == 'cry--Negative Deck' or G.GAME.selected_back.name == 'cry-Antimatter') and G.hand.config.card_limit <= 0 then -- 'cry--Negative Deck'... sure
157+
G.hand.config.card_limit = 1
158+
end
159+
'''
160+
match_indent = true
161+
162+
# init Cryptid global through lovely
163+
# so other mods can add things to obj pools
164+
# and define some stub functions so that the game does not immediately crash when talisman isn't loaded
165+
[[patches]]
166+
[patches.pattern]
167+
target = "main.lua"
168+
pattern = '''function love.load()'''
169+
position = "before"
170+
payload = '''
171+
Cryptid = {}
172+
Cryptid.aliases = {}
173+
function cry_format(...)
174+
return ...
175+
end
176+
177+
-- These ones are deprecated, they do not do anything and are just here to prevent crashes
178+
Cryptid.memepack = {}
179+
Cryptid.food = {}
180+
Cryptid.M_jokers = {}
181+
Cryptid.Megavouchers = {}
182+
'''
183+
match_indent = true
184+
185+
# Adds cry_creating_card event
186+
[[patches]]
187+
[patches.pattern]
188+
target = "functions/common_events.lua"
189+
pattern = '''
190+
check_for_unlock({type = 'have_edition'})
191+
end
192+
'''
193+
position = "after"
194+
payload = '''
195+
SMODS.calculate_context{cry_creating_card = true, card = card}
196+
'''
197+
match_indent = true
198+
199+
# plural handler (annoyingly fragile overwrite)
200+
# also i pass the whole vars here, even though it's inefficient, just because it looks better
201+
# whatever
202+
[[patches]]
203+
[patches.pattern]
204+
target = "functions/misc_functions.lua"
205+
pattern = '''
206+
assembled_string = assembled_string..(type(subpart) == 'string' and subpart or format_ui_value(args.vars[tonumber(subpart[1])]) or 'ERROR')
207+
'''
208+
position = "at"
209+
payload = '''
210+
assembled_string = assembled_string..(type(subpart) == 'string' and subpart or (Cryptid.pluralize and Cryptid.pluralize(subpart[1], args.vars)) or format_ui_value(args.vars[tonumber(subpart[1])]) or 'ERROR')
211+
'''
212+
match_indent = true
213+
214+
# prevent misprint crashing when big
215+
[[patches]]
216+
[patches.pattern]
217+
target = "card.lua"
218+
pattern = '''
219+
for i = self.ability.extra.min, self.ability.extra.max do
220+
r_mults[#r_mults+1] = tostring(i)
221+
end
222+
'''
223+
position = "at"
224+
payload = '''
225+
if self.ability.extra.max - self.ability.extra.min < 500 then
226+
for i = self.ability.extra.min, self.ability.extra.max do
227+
r_mults[#r_mults+1] = tostring(i)
228+
end
229+
else
230+
for i = 1, 50 do
231+
r_mults[#r_mults+1] = tostring(math.random(self.ability.extra.min, self.ability.extra.max))
232+
end
233+
end
234+
235+
'''
236+
match_indent = true
237+
238+
# handle banned playing cards
239+
# this must patch into pseudorandom_element to not break Steamodded in_pool logic
240+
[[patches]]
241+
[patches.pattern]
242+
target = "functions/misc_functions.lua"
243+
pattern = "if keep then"
244+
position = "before"
245+
payload = '''
246+
if G.GAME and G.GAME.cry_banned_pcards and G.GAME.cry_banned_pcards[k] then
247+
keep = false
248+
end
249+
'''
250+
match_indent = true
251+
252+
# Cross-Mod Content - allow Cryptid to load atlas/sound/shader files from other mods
253+
[[patches]]
254+
[patches.pattern]
255+
target = '''=[SMODS _ "src/game_object.lua"]'''
256+
pattern = "self.full_path = (self.mod and self.mod.path or SMODS.path) .."
257+
position = "at"
258+
payload = "self.full_path = (self.mod_path or self.mod and self.mod.path or SMODS.path) .."
259+
match_indent = true

0 commit comments

Comments
 (0)