Skip to content

Commit 86a5418

Browse files
committed
add quantify
1 parent 6498c99 commit 86a5418

File tree

6 files changed

+190
-15
lines changed

6 files changed

+190
-15
lines changed

assets/1x/atlasnotjokers.png

-8.93 KB
Loading

assets/2x/atlasnotjokers.png

468 Bytes
Loading

items/code.lua

Lines changed: 138 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3904,10 +3904,10 @@ local quantify = {
39043904
"HexaCryonic",
39053905
},
39063906
art = {
3907-
"?",
3907+
"gemstonez",
39083908
},
39093909
code = {
3910-
"Unimplemented (but will be Nova probably)",
3910+
"lord.ruby",
39113911
},
39123912
},
39133913
dependencies = {
@@ -3923,16 +3923,142 @@ local quantify = {
39233923
cost = 4,
39243924
atlas = "atlasnotjokers",
39253925
order = 425,
3926+
config = { extra = 1 },
3927+
loc_vars = function(self, queue, card)
3928+
return {
3929+
vars = {
3930+
card.ability.extra,
3931+
},
3932+
}
3933+
end,
39263934
can_use = function(self, card)
3927-
return false
3935+
local h, t = Cryptid.get_quantify(card)
3936+
for i, highlighted in pairs(h) do
3937+
if highlighted.children.price then
3938+
if to_big(G.GAME.dollars - G.GAME.bankrupt_at) < to_big(highlighted.cost) then
3939+
return
3940+
end
3941+
end
3942+
end
3943+
return t > 0 and t <= card.ability.extra
39283944
end,
3929-
-- use = function(self, card, area, copier)
3930-
3931-
-- end,
3932-
-- bulk_use = function(self, card, area, copier, number)
3933-
3934-
-- end,
3935-
} -- MISSING ART!!! -- UNIMPLEMENTED
3945+
use = function(self, card)
3946+
for i, v in pairs(Cryptid.get_quantify(card)) do
3947+
Cryptid.handle_quantify(v)
3948+
end
3949+
end,
3950+
init = function()
3951+
local calculate_ref = Card.calculate_joker
3952+
function Card:calculate_joker(context)
3953+
local ret, post = calculate_ref(self, context)
3954+
if not ret and not post then
3955+
if context.joker_main or context.forcetrigger then
3956+
if self.config.center.key == "c_base" or self.config.center.set == "Enhanced" then
3957+
local enhancement =
3958+
eval_card(self, { cardarea = G.play, main_scoring = true, scoring_hand = {} })
3959+
local ret2 = {}
3960+
local ret3 = {}
3961+
if enhancement then
3962+
ret2 = enhancement
3963+
end
3964+
local hand_enhancement =
3965+
eval_card(self, { cardarea = G.hand, main_scoring = true, scoring_hand = {} })
3966+
if hand_enhancement then
3967+
ret3 = hand_enhancement
3968+
end
3969+
for _, tbl in pairs(ret2) do
3970+
for i, v in pairs(tbl) do
3971+
SMODS.calculate_individual_effect({ [i] = v }, self, i, v, false)
3972+
end
3973+
end
3974+
for _, tbl in pairs(ret3) do
3975+
for i, v in pairs(tbl) do
3976+
SMODS.calculate_individual_effect({ [i] = v }, self, i, v, false)
3977+
end
3978+
end
3979+
end
3980+
if self.config.center.set == "Booster" then
3981+
local limit = self.ability.extra
3982+
local choose = self.ability.choose
3983+
local kind = self.config.center.kind
3984+
local kindmap = {
3985+
["Standard"] = "Enhanced",
3986+
["Buffoon"] = "Joker",
3987+
["Arcana"] = "Tarot",
3988+
}
3989+
kind = kindmap[kind] or kind
3990+
if not G.P_CENTER_POOLS[kind] then
3991+
kind = "Tarot"
3992+
end
3993+
for i = 1, G.jokers.config.card_limit - #G.jokers.cards do
3994+
if to_big(self.ability.choose) > to_big(0) then
3995+
self.ability.choose = self.ability.choose - 1
3996+
local tbl = self.config.center.create_card and self.config.center:create_card(self) or {}
3997+
local card = create_card(kind or tbl.set, G.jokers, tbl.legendary, tbl.rarity, tbl.skip_materialize, tbl.soulable, tbl.forced_key, "cry_quantify_booster")
3998+
G.jokers:emplace(card)
3999+
if to_big(self.ability.choose) <= to_big(0) then
4000+
self:start_dissolve()
4001+
end
4002+
end
4003+
end
4004+
end
4005+
end
4006+
end
4007+
return ret, post
4008+
end
4009+
local debuff_handref = Blind.debuff_hand
4010+
function Blind:debuff_hand(cards, hand, handname, check)
4011+
local tbl = {}
4012+
for i, v in pairs(G.jokers.cards) do
4013+
if v.base.nominal and v.base.suit then
4014+
tbl[#tbl + 1] = v
4015+
end
4016+
end
4017+
return debuff_handref(self, Cryptid.table_merge(cards, tbl), hand, handname, check)
4018+
end
4019+
function Cryptid.get_quantify(card)
4020+
local highlighted = {}
4021+
local total = 0
4022+
for i, v in pairs(G.I.CARD) do
4023+
if v.highlighted and v ~= card then
4024+
highlighted[#highlighted+1] = v
4025+
total = total + 1
4026+
end
4027+
end
4028+
return highlighted, total
4029+
end
4030+
function Cryptid.handle_quantify(target)
4031+
if type(target) == "table" and target.calculate_joker then
4032+
local highlighted = target
4033+
--removing from jokers just to readd to jokers is pointless
4034+
if highlighted and highlighted.area ~= G.consumeables or not G.GAME.modifiers.cry_beta then
4035+
if highlighted.children.price then
4036+
if to_big(G.GAME.dollars - G.GAME.bankrupt_at) < to_big(highlighted.cost) then
4037+
return
4038+
end
4039+
ease_dollars(-highlighted.cost)
4040+
highlighted.children.price:remove()
4041+
end
4042+
highlighted.area:remove_card(highlighted)
4043+
highlighted.children.price = nil
4044+
if highlighted.children.buy_button then
4045+
highlighted.children.buy_button:remove()
4046+
end
4047+
highlighted.children.buy_button = nil
4048+
remove_nils(highlighted.children)
4049+
G.E_MANAGER:add_event(Event({
4050+
func = function()
4051+
highlighted:highlight()
4052+
return true
4053+
end,
4054+
}))
4055+
G.jokers:emplace(highlighted)
4056+
return true
4057+
end
4058+
end
4059+
end
4060+
end,
4061+
}
39364062
-- ://Divide,
39374063
-- Halves item costs in shop
39384064
local divide = {
@@ -5285,8 +5411,8 @@ local code_cards = {
52855411
global,
52865412
global_sticker,
52875413
variable,
5288-
-- crylog, -- this and quantify will be implemented later on
5289-
-- quantify,
5414+
-- crylog, -- this will be implemented later on
5415+
quantify,
52905416
divide,
52915417
multiply,
52925418
delete,

lib/misc.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,3 +989,14 @@ function Cryptid.get_highlighted_cards(areas, ignore, min, max, blacklist, seed)
989989
end
990990
return {}
991991
end
992+
993+
function Cryptid.table_merge(t1, t2)
994+
local tbl = {}
995+
for i, v in pairs(t1) do
996+
tbl[#tbl + 1] = v
997+
end
998+
for i, v in pairs(t2) do
999+
tbl[#tbl + 1] = v
1000+
end
1001+
return tbl
1002+
end

localization/en-us.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,10 @@ return {
672672
},
673673
c_cry_quantify = {
674674
name = "://QUANTIFY",
675-
text = { -- "{C:cry_code}J{C:cry_exotic}o{C:legendary}k{C:cry_epic}e{C:cry_candy}r{C:rare}i{C:uncommon}z{C:common}e{C:dark_edition}!{} an object",
676-
"To Be {C:cry_code}Implemented{}",
677-
"in a future {C:cry_code}update{}",
675+
text = {
676+
"Transfer {C:attention}#1#{} selected",
677+
"{C:attention}Card#<s>1#{}, or {C:attention}Booster#<s>1#{}",
678+
"to the {C:attention}Jokers{} tray",
678679
},
679680
},
680681
c_cry_divide = {

lovely/code.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,3 +533,40 @@ for i = 1, #G.play.cards do
533533
end
534534
'''
535535
match_indent = true
536+
537+
[[patches]]
538+
[patches.pattern]
539+
target = "cardarea.lua"
540+
pattern = "local text,disp_text,poker_hands = G.FUNCS.get_poker_hand_info(self.highlighted)"
541+
position = "after"
542+
payload = '''
543+
local text,disp_text,poker_hands
544+
if self == G.hand then
545+
local tbl = {}
546+
for i, v in pairs(G.jokers.cards) do
547+
if v.base.nominal and v.base.suit then
548+
tbl[#tbl+1] = v
549+
end
550+
end
551+
text,disp_text,poker_hands = G.FUNCS.get_poker_hand_info(Cryptid.table_merge(self.highlighted, tbl))
552+
else
553+
text,disp_text,poker_hands = G.FUNCS.get_poker_hand_info(self.highlighted)
554+
end
555+
'''
556+
match_indent = true
557+
558+
[[patches]]
559+
[patches.pattern]
560+
target = "functions/state_events.lua"
561+
pattern = "local text,disp_text,poker_hands,scoring_hand,non_loc_disp_text = G.FUNCS.get_poker_hand_info(G.play.cards)"
562+
position = "after"
563+
payload = '''
564+
local tbl = {}
565+
for i, v in pairs(G.jokers.cards) do
566+
if v.base.nominal and v.base.suit then
567+
tbl[#tbl+1] = v
568+
end
569+
end
570+
local text,disp_text,poker_hands,scoring_hand,non_loc_disp_text = G.FUNCS.get_poker_hand_info(Cryptid.table_merge(G.play.cards, tbl))
571+
'''
572+
match_indent = true

0 commit comments

Comments
 (0)