Skip to content

Commit c38d887

Browse files
Combine hooks
This one was pretty big geez
1 parent 0e90049 commit c38d887

File tree

4 files changed

+207
-217
lines changed

4 files changed

+207
-217
lines changed

items/code.lua

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -5120,84 +5120,6 @@ local code_cards = {
51205120
return {
51215121
name = "Code Cards",
51225122
init = function()
5123-
--allow Program Packs to let you keep the cards
5124-
local G_UIDEF_use_and_sell_buttons_ref = G.UIDEF.use_and_sell_buttons
5125-
function G.UIDEF.use_and_sell_buttons(card)
5126-
if (card.area == G.pack_cards and G.pack_cards) and card.ability.consumeable then --Add a use button
5127-
if card.ability.set == "Code" then
5128-
return {
5129-
n = G.UIT.ROOT,
5130-
config = { padding = -0.1, colour = G.C.CLEAR },
5131-
nodes = {
5132-
{
5133-
n = G.UIT.R,
5134-
config = {
5135-
ref_table = card,
5136-
r = 0.08,
5137-
padding = 0.1,
5138-
align = "bm",
5139-
minw = 0.5 * card.T.w - 0.15,
5140-
minh = 0.7 * card.T.h,
5141-
maxw = 0.7 * card.T.w - 0.15,
5142-
hover = true,
5143-
shadow = true,
5144-
colour = G.C.UI.BACKGROUND_INACTIVE,
5145-
one_press = true,
5146-
button = "use_card",
5147-
func = "can_reserve_card",
5148-
},
5149-
nodes = {
5150-
{
5151-
n = G.UIT.T,
5152-
config = {
5153-
text = localize("b_pull"),
5154-
colour = G.C.UI.TEXT_LIGHT,
5155-
scale = 0.55,
5156-
shadow = true,
5157-
},
5158-
},
5159-
},
5160-
},
5161-
{
5162-
n = G.UIT.R,
5163-
config = {
5164-
ref_table = card,
5165-
r = 0.08,
5166-
padding = 0.1,
5167-
align = "bm",
5168-
minw = 0.5 * card.T.w - 0.15,
5169-
maxw = 0.9 * card.T.w - 0.15,
5170-
minh = 0.1 * card.T.h,
5171-
hover = true,
5172-
shadow = true,
5173-
colour = G.C.UI.BACKGROUND_INACTIVE,
5174-
one_press = true,
5175-
button = "Do you know that this parameter does nothing?",
5176-
func = "can_use_consumeable",
5177-
},
5178-
nodes = {
5179-
{
5180-
n = G.UIT.T,
5181-
config = {
5182-
text = localize("b_use"),
5183-
colour = G.C.UI.TEXT_LIGHT,
5184-
scale = 0.45,
5185-
shadow = true,
5186-
},
5187-
},
5188-
},
5189-
},
5190-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
5191-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
5192-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
5193-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
5194-
-- Betmma can't explain it, neither can I
5195-
},
5196-
}
5197-
end
5198-
end
5199-
return G_UIDEF_use_and_sell_buttons_ref(card)
5200-
end
52015123
--Code from Betmma's Vouchers
52025124
G.FUNCS.can_reserve_card = function(e)
52035125
local c1 = e.config.ref_table

items/misc.lua

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,123 +1434,6 @@ local double_sided = {
14341434
end,
14351435
}))
14361436
end
1437-
local use_and_sell_buttonsref = G.UIDEF.use_and_sell_buttons
1438-
function G.UIDEF.use_and_sell_buttons(card)
1439-
local retval = use_and_sell_buttonsref(card)
1440-
if
1441-
card.area
1442-
and card.edition
1443-
and (card.area == G.jokers or card.area == G.consumeables or card.area == G.hand)
1444-
and card.edition.cry_double_sided
1445-
and not Card.no(card, "dbl")
1446-
then
1447-
local use = {
1448-
n = G.UIT.C,
1449-
config = { align = "cr" },
1450-
nodes = {
1451-
{
1452-
n = G.UIT.C,
1453-
config = {
1454-
ref_table = card,
1455-
align = "cr",
1456-
maxw = 1.25,
1457-
padding = 0.1,
1458-
r = 0.08,
1459-
hover = true,
1460-
shadow = true,
1461-
colour = G.C.UI.BACKGROUND_INACTIVE,
1462-
one_press = true,
1463-
button = "flip",
1464-
func = "can_flip_card",
1465-
},
1466-
nodes = {
1467-
{ n = G.UIT.B, config = { w = 0.1, h = 0.3 } },
1468-
{
1469-
n = G.UIT.T,
1470-
config = {
1471-
text = localize("b_flip"),
1472-
colour = G.C.UI.TEXT_LIGHT,
1473-
scale = 0.3,
1474-
shadow = true,
1475-
},
1476-
},
1477-
},
1478-
},
1479-
},
1480-
}
1481-
local m = retval.nodes[1]
1482-
if not card.added_to_deck then
1483-
use.nodes[1].nodes = { use.nodes[1].nodes[2] }
1484-
if card.ability.consumeable then
1485-
m = retval
1486-
end
1487-
end
1488-
m.nodes = m.nodes or {}
1489-
table.insert(m.nodes, { n = G.UIT.R, config = { align = "cl" }, nodes = {
1490-
use,
1491-
} })
1492-
return retval
1493-
end
1494-
if
1495-
card.area
1496-
and (card.area == G.jokers or card.area == G.consumeables or card.area == G.hand)
1497-
and (not card.edition or not card.edition.cry_double_sided)
1498-
and not card.ability.eternal
1499-
and not Card.no(card, "dbl")
1500-
then
1501-
for i = 1, #card.area.cards do
1502-
if card.area.cards[i].edition and card.area.cards[i].edition.cry_double_sided then
1503-
local use = {
1504-
n = G.UIT.C,
1505-
config = { align = "cr" },
1506-
nodes = {
1507-
{
1508-
n = G.UIT.C,
1509-
config = {
1510-
ref_table = card,
1511-
align = "cr",
1512-
maxw = 1.25,
1513-
padding = 0.1,
1514-
r = 0.08,
1515-
hover = true,
1516-
shadow = true,
1517-
colour = G.C.UI.BACKGROUND_INACTIVE,
1518-
one_press = true,
1519-
button = "flip_merge",
1520-
func = "can_flip_merge_card",
1521-
},
1522-
nodes = {
1523-
{ n = G.UIT.B, config = { w = 0.1, h = 0.3 } },
1524-
{
1525-
n = G.UIT.T,
1526-
config = {
1527-
text = localize("b_merge"),
1528-
colour = G.C.UI.TEXT_LIGHT,
1529-
scale = 0.3,
1530-
shadow = true,
1531-
},
1532-
},
1533-
},
1534-
},
1535-
},
1536-
}
1537-
local m = retval.nodes[1]
1538-
if not card.added_to_deck then
1539-
use.nodes[1].nodes = { use.nodes[1].nodes[2] }
1540-
if card.ability.consumeable then
1541-
m = retval
1542-
end
1543-
end
1544-
m.nodes = m.nodes or {}
1545-
table.insert(m.nodes, { n = G.UIT.R, config = { align = "cl" }, nodes = {
1546-
use,
1547-
} })
1548-
return retval
1549-
end
1550-
end
1551-
end
1552-
return retval
1553-
end
15541437
function Cryptid.copy_dbl_card(C, c, deck_effects)
15551438
if not deck_effects then
15561439
Cdeck = C.added_to_deck

items/spooky.lua

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,27 +1723,6 @@ items = {
17231723
}
17241724
return {
17251725
name = "Spooky",
1726-
init = function()
1727-
--Cursed rarity patches
1728-
--Really hacky patch to remove sell button for cursed jokers
1729-
local G_UIDEF_use_and_sell_buttons_ref = G.UIDEF.use_and_sell_buttons
1730-
function G.UIDEF.use_and_sell_buttons(card)
1731-
local m = G_UIDEF_use_and_sell_buttons_ref(card)
1732-
if
1733-
card.area
1734-
and card.area.config.type == "joker"
1735-
and card.config
1736-
and card.config.center
1737-
and card.config.center.rarity == "cry_cursed"
1738-
and card.ability.name ~= "cry-Monopoly"
1739-
then
1740-
table.remove(m.nodes[1].nodes, 1)
1741-
end
1742-
if card.config and card.config.center and card.config.center.key == "c_cry_potion" then
1743-
table.remove(m.nodes[1].nodes, 1)
1744-
end
1745-
return m
1746-
end
1747-
end,
1726+
init = function() end,
17481727
items = items,
17491728
}

0 commit comments

Comments
 (0)