Skip to content

Commit d857f75

Browse files
committed
code card ui stuff
1 parent b197ab1 commit d857f75

File tree

8 files changed

+608
-827
lines changed

8 files changed

+608
-827
lines changed

assets/1x/atlasnotjokers.png

-273 Bytes
Loading

items/code.lua

Lines changed: 93 additions & 791 deletions
Large diffs are not rendered by default.

items/pointer.lua

Lines changed: 123 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,125 @@ local pointer = {
2929
return true
3030
end,
3131
use = function(self, card, area, copier)
32+
if not card.ability.cry_multiuse or to_big(card.ability.cry_multiuse) <= to_big(1) then
33+
G.GAME.CODE_DESTROY_CARD = copy_card(card)
34+
G.consumeables:emplace(G.GAME.CODE_DESTROY_CARD)
35+
else
36+
card.ability.cry_multiuse = card.ability.cry_multiuse + 1
37+
end
3238
G.GAME.USING_CODE = true
33-
G.GAME.USING_POINTER = true
34-
G.ENTERED_CARD = ""
35-
G.CHOOSE_CARD = UIBox({
36-
definition = create_UIBox_pointer(card),
37-
config = {
38-
align = "cm",
39-
offset = { x = 0, y = 10 },
40-
major = G.ROOM_ATTACH,
41-
bond = "Weak",
42-
instance_type = "POPUP",
43-
},
44-
})
45-
G.CHOOSE_CARD.alignment.offset.y = 0
46-
G.ROOM.jiggle = G.ROOM.jiggle + 1
47-
G.CHOOSE_CARD:align_to_major()
48-
check_for_unlock({ cry_used_consumable = "c_cry_pointer" })
39+
G.E_MANAGER:add_event(Event({
40+
func = function()
41+
G.GAME.USING_POINTER = true
42+
G.FUNCS.overlay_menu({definition = create_UIBox_your_collection()})
43+
return true
44+
end
45+
}))
46+
G.GAME.POINTER_SUBMENU = nil
4947
end,
5048
init = function(self)
49+
local ccl = Card.click
50+
function Card:click()
51+
if G.GAME.USING_POINTER then
52+
if not self.debuff then
53+
if self.config.center.consumeable then
54+
local copy = copy_card(self)
55+
copy:add_to_deck()
56+
G.consumeables:emplace(copy)
57+
G.FUNCS.exit_overlay_menu_code()
58+
ccl(self)
59+
if G.GAME.CODE_DESTROY_CARD then
60+
G.GAME.CODE_DESTROY_CARD:start_dissolve()
61+
G.GAME.CODE_DESTROY_CARD = nil
62+
end
63+
elseif self.config.center.set == "Booster" then
64+
G.FUNCS.exit_overlay_menu_code()
65+
local card = copy_card(self)
66+
card.cost = 0
67+
card.from_tag = true
68+
G.FUNCS.use_card({ config = { ref_table = card } })
69+
card:start_materialize()
70+
created = true
71+
ccl(self)
72+
if G.GAME.CODE_DESTROY_CARD then
73+
G.GAME.CODE_DESTROY_CARD:start_dissolve()
74+
G.GAME.CODE_DESTROY_CARD = nil
75+
end
76+
elseif self.config.center.key == "c_base" or self.config.center.set == "Enhanced" or self.edition or G.GAME.POINTER_SUBMENU == "Edition" then
77+
--submenu stuff
78+
if G.GAME.POINTER_SUBMENU == "Rank" then
79+
G.GAME.POINTER_PLAYING.rank = self.base.value
80+
G.FUNCS.overlay_menu{
81+
definition = create_UIBox_pointer_suit()
82+
}
83+
elseif G.GAME.POINTER_SUBMENU == "Suit" then
84+
G.GAME.POINTER_PLAYING.suit = self.base.suit
85+
G.FUNCS.overlay_menu{
86+
definition = create_UIBox_pointer_enhancement()
87+
}
88+
elseif G.GAME.POINTER_SUBMENU == "Enhancement" then
89+
G.GAME.POINTER_PLAYING.center = self.config.center.key
90+
G.FUNCS.overlay_menu{
91+
definition = create_UIBox_pointer_edition()
92+
}
93+
elseif G.GAME.POINTER_SUBMENU == "Edition" then
94+
if self.edition then
95+
G.GAME.POINTER_PLAYING.edition = self.edition.key
96+
end
97+
G.FUNCS.overlay_menu{
98+
definition = create_UIBox_pointer_seal()
99+
}
100+
elseif G.GAME.POINTER_SUBMENU == "Seal" then
101+
G.GAME.POINTER_PLAYING.seal = self.seal
102+
local card = SMODS.create_card{key=G.GAME.POINTER_PLAYING.center, rank = G.GAME.POINTER_PLAYING.rank, suit = G.GAME.POINTER_PLAYING.suit}
103+
print(G.GAME.POINTER_PLAYING.center)
104+
card:set_ability(G.P_CENTERS[G.GAME.POINTER_PLAYING.center])
105+
if G.GAME.POINTER_PLAYING.seal then card:set_seal(G.GAME.POINTER_PLAYING.seal) end
106+
if G.GAME.POINTER_PLAYING.edition then card:set_edition(G.GAME.POINTER_PLAYING.edition) end
107+
if G.STATE == G.STATES.SELECTING_HAND then
108+
G.hand:emplace(card)
109+
else
110+
G.deck:emplace(card)
111+
end
112+
table.insert(G.playing_cards, card)
113+
G.FUNCS.exit_overlay_menu_code()
114+
G.GAME.POINTER_PLAYING = nil
115+
if G.GAME.CODE_DESTROY_CARD then
116+
G.GAME.CODE_DESTROY_CARD:start_dissolve()
117+
G.GAME.CODE_DESTROY_CARD = nil
118+
end
119+
end
120+
else
121+
G.ENTERED_CARD = self.config.center.key
122+
local ret = G.FUNCS.pointer_apply()
123+
G.FUNCS.pointer_cancel()
124+
if ret then
125+
G.FUNCS.exit_overlay_menu_code()
126+
ccl(self)
127+
if G.GAME.CODE_DESTROY_CARD then
128+
G.GAME.CODE_DESTROY_CARD:start_dissolve()
129+
G.GAME.CODE_DESTROY_CARD = nil
130+
end
131+
else
132+
G.GAME.USING_CODE = true
133+
G.GAME.USING_POINTER = true
134+
end
135+
end
136+
end
137+
else
138+
ccl(self)
139+
end
140+
end
141+
local emplace_ref = CardArea.emplace
142+
function CardArea:emplace(card, ...)
143+
if G.GAME.USING_POINTER then
144+
if Cryptid.pointergetblist(card.config.center.key)[1] then
145+
card.debuff = true
146+
end
147+
end
148+
return emplace_ref(self, card, ...)
149+
end
150+
51151
function create_UIBox_pointer(card)
52152
G.E_MANAGER:add_event(Event({
53153
blockable = false,
@@ -135,7 +235,9 @@ local pointer = {
135235
return t
136236
end
137237
G.FUNCS.pointer_cancel = function()
138-
G.CHOOSE_CARD:remove()
238+
if G.CHOOSE_CARD then
239+
G.CHOOSE_CARD:remove()
240+
end
139241
G.GAME.USING_CODE = false
140242
G.GAME.USING_POINTER = false
141243
G.DEBUG_POINTER = false
@@ -250,11 +352,13 @@ local pointer = {
250352
created = true
251353
end
252354
if created then
253-
G.CHOOSE_CARD:remove()
355+
if G.CHOOSE_CARD then
356+
G.CHOOSE_CARD:remove()
357+
end
254358
G.GAME.USING_CODE = false
255359
G.GAME.USING_POINTER = false
256360
G.DEBUG_POINTER = false
257-
return
361+
return true
258362
end
259363
end
260364

0 commit comments

Comments
 (0)