forked from lord-ruby/Overflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverflow.lua
More file actions
142 lines (138 loc) · 6.63 KB
/
Overflow.lua
File metadata and controls
142 lines (138 loc) · 6.63 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
131
132
133
134
135
136
137
138
139
140
141
142
if not SMODS then
local calculate_jokerref = Card.calculate_joker
function Card:calculate_joker(context)
if self.debuff then return nil end
if self.ability.set == "Planet" and not self.debuff then
if context.joker_main then
return {
message = localize{type = 'variable', key = 'a_xmult', vars = {G.P_CENTERS.v_observatory.config.extra}},
Xmult_mod = to_big(G.P_CENTERS.v_observatory.config.extra) ^ to_big(self.qty or 1)
}
end
elseif self.ability.set == "Joker" and self.ability.name == "Perkeo" then
return PerkeoOverride(G.P_CENTERS.j_perkeo, self, context)
elseif self.ability.name == 'Constellation' and not context.blueprint and context.consumeable.ability.set == 'Planet' then
self.ability.x_mult = self.ability.x_mult + (self.ability.extra * (context.consumeable.qty_used or 1))
G.E_MANAGER:add_event(Event({
func = function() card_eval_status_text(self, 'extra', nil, nil, nil, {message = localize{type='variable',key='a_xmult',vars={self.ability.x_mult}}}); return true
end}))
return
end
return calculate_jokerref(self, context)
end
end
function PerkeoOverride(self, orig_card, context)
if context.ending_shop or context.forcetrigger then
if G.consumeables.cards[1] then
local card
if to_big(G.consumeables:get_total_count()) < to_big(200) then
local cards = {}
for i, v in ipairs(G.consumeables.cards) do
for k = 1, (v:getQty() or 1) do
cards[#cards+1] = v
end
end
card = pseudorandom_element(cards, pseudoseed('perkeo'))
else
local cards = {}
for i, v in ipairs(G.consumeables.cards) do
cards[#cards+1] = {to_big(v:getQty() or 1) / to_big(v.area:get_total_count()), v}
end
card = Overflow.weighted_random(cards, "perkeo")
end
if card and card.config.center.set == "Joker" then
if not Overflow.should_skip_animations() then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = copy_card(card, nil)
new_card.qty = 1
new_card:set_edition("e_negative", true)
new_card:add_to_deck()
G.consumeables:emplace(new_card)
return true
end
}))
else
local new_card = copy_card(card, nil)
new_card.qty = 1
new_card:set_edition("e_negative", true)
new_card:add_to_deck()
G.consumeables:emplace(new_card)
end
elseif card and Overflow.can_merge(card, card, true) and not Overflow.is_blacklisted(card) then
if card.qty then
if not Overflow.should_skip_animations() then
G.E_MANAGER:add_event(Event({
func = function()
play_sound('negative', 1.5, 0.4)
Overflow.set_amount(card, card.qty + 1, true)
card:juice_up()
return true
end
}))
else
Overflow.set_amount(card, card.qty + 1, true)
end
else
local check
for i, v in ipairs(G.consumeables.cards) do
if v.edition and v.edition.negative and v.config.center.key == card.config.center.key and v ~= card and not v.dissolve then
if not Overflow.should_skip_animations() then
G.E_MANAGER:add_event(Event({
func = function()
play_sound('negative', 1.5, 0.4)
v:juice_up()
Overflow.set_amount(v, (v.qty or 1) + 1, true)
return true
end
}))
else
Overflow.set_amount(v, (v.qty or 1) + 1, true)
end
check = true
end
end
if not check then
if not Overflow.should_skip_animations() then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = copy_card(card, nil)
new_card.qty = 1
new_card:set_edition("e_negative", true)
new_card:add_to_deck()
G.consumeables:emplace(new_card)
return true
end
}))
else
local new_card = copy_card(card, nil)
new_card.qty = 1
new_card:set_edition("e_negative", true)
new_card:add_to_deck()
G.consumeables:emplace(new_card)
end
end
end
elseif card then
local new_card = copy_card(card, nil)
new_card.qty = 1
new_card:set_edition("e_negative", true)
new_card:add_to_deck()
G.consumeables:emplace(new_card)
end
if not Overflow.should_skip_animations() then
card_eval_status_text(context.blueprint_card or orig_card, 'extra', nil, nil, nil, {message = localize('k_duplicated_ex')})
end
return {calculated = true}
end
end
end
require("overflow/ui")
require("overflow/hooks")
require("overflow/utils")
require("overflow/bulk_use")
Incantation = {}
Noituus = {CustomPluralNames = {}}
to_big = to_big or function(num) return num or -1e300 end
is_number = is_number or function(num) return type(num) == "number" end
to_number = to_number or function(num) return num or -1e300 end