Skip to content

Commit b73c788

Browse files
committed
Digital Hallucinations refactor
- Also tried to fix more enhanced deck UI crashes
1 parent e12336f commit b73c788

File tree

5 files changed

+72
-28
lines changed

5 files changed

+72
-28
lines changed

items/code.lua

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ local code = {
2020
can_stack = true,
2121
can_divide = true,
2222
}
23+
local code_digital_hallucinations_compat = {
24+
colour = HEX("14b341"),
25+
loc_key = "cry_plus_code",
26+
create = function()
27+
local ccard = create_card("Code", G.consumeables, nil, nil, nil, nil, nil, "diha")
28+
ccard:set_edition({ negative = true }, true)
29+
ccard:add_to_deck()
30+
G.consumeables:emplace(ccard)
31+
end
32+
}
2333
local pack1 = {
2434
dependencies = {
2535
items = {
@@ -51,6 +61,7 @@ local pack1 = {
5161
}
5262
end,
5363
group_key = "k_cry_program_pack",
64+
cry_digital_hallucinations = code_digital_hallucinations_compat,
5465
}
5566
local pack2 = {
5667
dependencies = {
@@ -83,6 +94,7 @@ local pack2 = {
8394
}
8495
end,
8596
group_key = "k_cry_program_pack",
97+
cry_digital_hallucinations = code_digital_hallucinations_compat,
8698
}
8799
local packJ = {
88100
dependencies = {
@@ -115,6 +127,7 @@ local packJ = {
115127
}
116128
end,
117129
group_key = "k_cry_program_pack",
130+
cry_digital_hallucinations = code_digital_hallucinations_compat,
118131
}
119132
local packM = {
120133
dependencies = {
@@ -147,6 +160,7 @@ local packM = {
147160
}
148161
end,
149162
group_key = "k_cry_program_pack",
163+
cry_digital_hallucinations = code_digital_hallucinations_compat,
150164
}
151165
local console = {
152166
dependencies = {
@@ -2225,7 +2239,7 @@ local machinecode = {
22252239
use = function(self, card, area, copier)
22262240
local card = create_card(
22272241
"Consumeables",
2228-
G.consumables,
2242+
G.consumeables,
22292243
nil,
22302244
nil,
22312245
nil,
@@ -2245,7 +2259,7 @@ local machinecode = {
22452259
a[b] = (a[b] or 0) + 1
22462260
end
22472261
for k, v in pairs(a) do
2248-
local card = create_card("Consumeables", G.consumables, nil, nil, nil, nil, k.key)
2262+
local card = create_card("Consumeables", G.consumeables, nil, nil, nil, nil, k.key)
22492263
card:set_edition({ cry_glitched = true })
22502264
card:add_to_deck()
22512265
if Incantation then
@@ -4362,7 +4376,7 @@ local CodeJoker = {
43624376
calculate = function(self, card, context)
43634377
if context.setting_blind and not (context.blueprint_card or self).getting_sliced then
43644378
play_sound("timpani")
4365-
local card = create_card("Code", G.consumables, nil, nil, nil, nil)
4379+
local card = create_card("Code", G.consumeables, nil, nil, nil, nil)
43664380
card:set_edition({
43674381
negative = true,
43684382
})
@@ -4608,7 +4622,7 @@ local blender = {
46084622
and not context.consumeable.beginning_end
46094623
then
46104624
if #G.consumeables.cards + G.GAME.consumeable_buffer < G.consumeables.config.card_limit then
4611-
local card = create_card("Consumeables", G.consumables, nil, nil, nil, nil, nil, "cry_blender")
4625+
local card = create_card("Consumeables", G.consumeables, nil, nil, nil, nil, nil, "cry_blender")
46124626
card:add_to_deck()
46134627
G.consumeables:emplace(card)
46144628
end

items/enhanced.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ return {
382382
end
383383
end
384384
function cry_enhancement_config_UI(center)
385+
if not center.edeck_type then
386+
return
387+
end
385388
G.SETTINGS.paused = true
386389
G.your_collection = {}
387390
G.your_collection[1] = CardArea(

items/misc.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
-- Packs
2+
local meme_digital_hallucinations_compat = {
3+
colour = G.C.CRY_ASCENDANT,
4+
loc_key = "k_plus_joker",
5+
create = function()
6+
local ccard = create_card("Meme", G.jokers, nil, nil, true, true, nil, "diha")
7+
ccard:set_edition({ negative = true }, true)
8+
ccard:add_to_deck()
9+
G.jokers:emplace(ccard) --Note: Will break if any non-Joker gets added to the meme pool
10+
end
11+
}
212
local meme1 = {
313
object_type = "Booster",
414
dependencies = {
@@ -43,6 +53,7 @@ local meme1 = {
4353
SMODS.Booster.update_pack(self, dt)
4454
end,
4555
group_key = "k_cry_meme_pack",
56+
cry_digital_hallucinations = meme_digital_hallucinations_compat,
4657
}
4758
local meme2 = {
4859
object_type = "Booster",
@@ -89,6 +100,7 @@ local meme2 = {
89100
SMODS.Booster.update_pack(self, dt)
90101
end,
91102
group_key = "k_cry_meme_pack",
103+
cry_digital_hallucinations = meme_digital_hallucinations_compat,
92104
}
93105
local meme3 = {
94106
object_type = "Booster",
@@ -136,6 +148,7 @@ local meme3 = {
136148
SMODS.Booster.update_pack(self, dt)
137149
end,
138150
group_key = "k_cry_meme_pack",
151+
cry_digital_hallucinations = meme_digital_hallucinations_compat,
139152
}
140153

141154
if not AurinkoAddons then
@@ -1796,7 +1809,7 @@ local blessing = {
17961809
local forced_key = get_random_consumable("blessing", nil, "c_cry_blessing")
17971810
local _card = create_card(
17981811
"Consumeables",
1799-
G.consumables,
1812+
G.consumeables,
18001813
nil,
18011814
nil,
18021815
nil,

items/misc_joker.lua

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7404,6 +7404,27 @@ local digitalhallucinations = {
74047404
)
74057405
then
74067406
local boosty = context.card
7407+
-- finally mod compat?
7408+
if boosty.config.center.cry_digital_hallucinations then
7409+
local conf = boosty.config.center.cry_digital_hallucinations
7410+
G.E_MANAGER:add_event(Event({
7411+
trigger = "before",
7412+
delay = 0.0,
7413+
func = function()
7414+
conf.create()
7415+
return true
7416+
end,
7417+
}))
7418+
card_eval_status_text(
7419+
context.blueprint_card or card,
7420+
"extra",
7421+
nil,
7422+
nil,
7423+
nil,
7424+
{ message = localize(conf.loc_key), colour = conf.colour }
7425+
)
7426+
return nil, true
7427+
end
74077428
local consums = { "Arcana", "Celestial", "Spectral" }
74087429
local short1 = { "tarot", "planet", "spectral" }
74097430
local short2 = { "Tarot", "Planet", "Spectral" }
@@ -7413,7 +7434,7 @@ local digitalhallucinations = {
74137434
trigger = "before",
74147435
delay = 0.0,
74157436
func = function()
7416-
local ccard = create_card(short2[i], G.consumables, nil, nil, nil, nil, nil, "diha")
7437+
local ccard = create_card(short2[i], G.consumeables, nil, nil, nil, nil, nil, "diha")
74177438
ccard:set_edition({ negative = true }, true)
74187439
ccard:add_to_deck()
74197440
G.consumeables:emplace(ccard)
@@ -7431,28 +7452,6 @@ local digitalhallucinations = {
74317452
return nil, true -- this triggers BEFORE a retrigger joker and looks like jank. i can't get a message showing up without status text so this is the best option rn
74327453
end
74337454
end
7434-
if boosty.ability.name:find("code") then
7435-
G.E_MANAGER:add_event(Event({
7436-
trigger = "before",
7437-
delay = 0.0,
7438-
func = function()
7439-
local ccard = create_card("Code", G.consumables, nil, nil, nil, nil, nil, "diha")
7440-
ccard:set_edition({ negative = true }, true)
7441-
ccard:add_to_deck()
7442-
G.consumeables:emplace(ccard)
7443-
return true
7444-
end,
7445-
}))
7446-
card_eval_status_text(
7447-
context.blueprint_card or card,
7448-
"extra",
7449-
nil,
7450-
nil,
7451-
nil,
7452-
{ message = localize("cry_plus_code"), colour = G.C.SET.Code }
7453-
)
7454-
return nil, true
7455-
end
74567455
if boosty.ability.name:find("Buffoon") then
74577456
G.E_MANAGER:add_event(Event({
74587457
trigger = "before",

items/tag.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ local empoweredPack = {
156156
end
157157
end,
158158
group_key = "k_spectral_pack",
159+
cry_digital_hallucinations = {
160+
colour = G.C.SECONDARY_SET.Spectral,
161+
loc_key = "k_plus_spectral",
162+
create = function()
163+
local ccard
164+
if pseudorandom(pseudoseed("diha")) < 0.5 then
165+
ccard = create_card("Spectral", G.consumeables, nil, nil, true, true, "c_soul")
166+
else
167+
ccard = create_card("Spectral", G.consumeables, nil, nil, true, true, "c_cry_gateway")
168+
end
169+
ccard:set_edition({ negative = true }, true)
170+
ccard:add_to_deck()
171+
G.consumeables:emplace(ccard)
172+
end
173+
}
159174
}
160175
local empowered = {
161176
object_type = "Tag",

0 commit comments

Comments
 (0)