forked from Evgast/JimboAnd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.lua
More file actions
130 lines (125 loc) · 4.97 KB
/
hooks.lua
File metadata and controls
130 lines (125 loc) · 4.97 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
local highlight_hooky = Card.highlight
function Card:highlight(is_highlighted)
highlight_hooky(self, is_highlighted)
local danbo_use = {n = G.UIT.ROOT, config = { minw = 1, minh = 1, align = "tm", colour = G.C.CLEAR}, nodes = {
{n = G.UIT.C, config = { minw = 1, minh = 1, colour = G.C.CLEAR, r = 0.1, padding = 0.15, func = "jand_recalc" }, nodes = {
UIBox_button{ label = {localize("b_use")}, scale = 0.6, minw = 1.5, minh = 1, colour = G.C.BLACK, r = 0.1, button = nil, ref_table = self, func = "danboskill", shadow = true},
}}}}
local lv_buy = { n=G.UIT.ROOT, config = {ref_table = card, minw = 1.1, maxw = 1.3, padding = 0.1, align = 'bm', colour = G.C.SECONDARY_SET.Planet, shadow = true, r = 0.08, minh = 0.94, hover = true, ref_value = self, func = "can_buy_lv", button = "buy_lv_butt"}, nodes={
{n=G.UIT.T, config={text = localize('b_buy'),colour = G.C.WHITE, scale = 0.5}}
}}
local sacrifice = {n = G.UIT.ROOT, config = { minw = 1, minh = 1, align = "tm", colour = G.C.CLEAR}, nodes = {
{n = G.UIT.C, config = { minw = 1, minh = 1, colour = G.C.CLEAR, r = 0.1, padding = 0.15, }, nodes = {
UIBox_button{ label = {"SACRIFICE"}, scale = 0.6, minw = 1.5, minh = 1, colour = G.C.BLACK, r = 0.1, button = nil, ref_table = self, func = "sacrifunc", shadow = true},
}}}}
--danbo
if self.highlighted and self.config.center.key == "j_jand_danbo" and not self.ability.extra.to_copy then
self.children.danbo_button = UIBox({
definition = danbo_use,
config = {
parent = self,
align = 'tm',
offset = { x = 0, y = 3.55 },
colour = G.C.CLEAR}})
elseif self.children.danbo_button and not self.highlighted and self.config.center.key == "j_jand_danbo" then
self.children.danbo_button:remove()
self.children.danbo_button = nil
end
--hand level shop buy
if self.highlighted and self.children.lv_price and not self.children.buy_lv then
self.children.buy_lv = UIBox{
definition = lv_buy,
config = {
align="bm",
offset = {x=0,y=-0.35},
major = self,
bond = 'Weak',
parent = self
}
}
elseif self.children.buy_lv and not self.highlighted then
self.children.buy_lv:remove()
self.children.buy_lv = nil
end
--hand level sacrifice
if self.highlighted and self.sacrifice then
self.children.use_button= UIBox{
definition = sacrifice,
config = {
align="bm",
offset = {x=0,y=-0.35},
major = self,
bond = 'Weak',
parent = self
}
}
elseif self.sacrifice and self.children.use_button and not self.highlighted then
self.children.use_button:remove()
self.children.use_button = nil
end
--I might be an idiot but yeah
if self.highlighted and self.area.config.jand_no_use and self.children.use_button then
self.children.use_button:remove()
self.children.use_button = nil
end
end
local align_hooky = CardArea.align_cards
function CardArea:align_cards()
local pre_align = {}
if self.config.type == "joker" then
for k, v in pairs(self.cards) do
pre_align[#pre_align+1] = v
end
end
align_hooky(self)
local joker_realigned = false
if self.config.type == "joker" then
for k, v in pairs(self.cards) do
if pre_align[k] ~= v then
joker_realigned = true
end
end
end
if joker_realigned then
SMODS.calculate_context({jimband_joker_align = true})
end
end
local scale_hook = SMODS.scale_card
function SMODS.scale_card(card, args)
if #SMODS.find_card("j_jand_yomi") ~= 0 then
for k, v in pairs(G.P_CENTER_POOLS["Food"]) do
if v.key == card.config.center.key then
SMODS.calculate_effect({message = localize("k_nope_ex"), colour = G.C.PURPLE, delay = 0.2}, card)
return
end
end
end
scale_hook(card, args)
end
local start_run_ref = Game.start_run
function Game:start_run(args)
start_run_ref(self, args)
extra_shop_create()
if not G.GAME.stocked then
restock_extra_shop()
end
for k, v in pairs(G.jand_shopkeep.cards) do
v.config.center:apply()
end
G.GAME.stocked = true
end
local use_hook = G.FUNCS.use_card
function G.FUNCS.use_card(e, mute, nosave)
use_hook(e, mute, nosave)
if G.GAME.current_shop == "Jand" then
JAND.hide_shop(G.extra_shop)
G.E_MANAGER:add_event(Event({
trigger = "after",
delay = 0.3,
func = function()
JAND.show_shop(G.extra_shop)
return true
end
}))
end
end