Skip to content

Commit 0d7e084

Browse files
committed
pin and circus crossmod stuff
1 parent e356461 commit 0d7e084

File tree

6 files changed

+112
-52
lines changed

6 files changed

+112
-52
lines changed

Cryptid.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,14 @@ function SMODS.injectItems(...)
236236
G.P_CENTERS.c_cryptid.misprintize_caps = { extra = 100, max_highlighted = 100 }
237237
G.P_CENTERS.c_immolate.misprintize_caps = { destroy = 1e300 }
238238
Cryptid.inject_pointer_aliases()
239+
240+
--this has to be here because the colors dont exist earlier then this
241+
Cryptid.circus_rarities["rare"] = {rarity = 3, base_mult = 2, order = 1, colour = G.C.RARITY.Rare}
242+
Cryptid.circus_rarities["epic"] ={rarity = "cry_epic", base_mult = 3, order = 2, colour = G.C.RARITY.cry_epic}
243+
Cryptid.circus_rarities["legendary"] ={rarity = 4, base_mult = 4, order = 3, colour = G.C.RARITY.Legendary}
244+
Cryptid.circus_rarities["exotic"] ={rarity = "cry_exotic", base_mult = 20, order = 4, colour = G.C.RARITY.cry_exotic}
245+
246+
Cryptid.reload_localization()
239247
end
240248

241249
local old_repitions = SMODS.calculate_repetitions

items/blind.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ local pin = {
624624
card.config.center.rarity == 4
625625
or card.config.center.rarity == "cry_epic"
626626
or card.config.center.rarity == "cry_exotic"
627+
or Cryptid.pin_debuff[card.config.center.rarity]
627628
)
628629
then
629630
return true

items/epic.lua

Lines changed: 66 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,20 +1122,6 @@ local circus = {
11221122
key = "circus",
11231123
pos = { x = 4, y = 4 },
11241124
config = {
1125-
extra = {
1126-
rare_mult_mod = 2,
1127-
epic_mult_mod = 3,
1128-
legend_mult_mod = 4,
1129-
exotic_mult_mod = 20,
1130-
},
1131-
immutable = {
1132-
rarity_map = {
1133-
[3] = "rare_mult_mod",
1134-
[4] = "legend_mult_mod",
1135-
["cry_epic"] = "epic_mult_mod",
1136-
["cry_exotic"] = "exotic_mult_mod",
1137-
},
1138-
},
11391125
},
11401126
dependencies = {
11411127
items = {
@@ -1144,55 +1130,89 @@ local circus = {
11441130
},
11451131
atlas = "atlasepic",
11461132
order = 33,
1133+
11471134
loc_vars = function(self, info_queue, center)
1135+
local extra_rarities = {}
1136+
local mults = {}
1137+
Cryptid.circus_rarities["exotic"].colour = G.C.CRY_EXOTIC
1138+
for i, v in pairs(Cryptid.circus_rarities) do
1139+
extra_rarities[#extra_rarities+1] = v
1140+
end
1141+
table.sort(extra_rarities, function(a, b) return a.order < b.order end)
1142+
mults.colours = {
1143+
1144+
}
1145+
for i, v in pairs(extra_rarities) do
1146+
if not v.hidden then
1147+
mults[#mults+1] = number_format(center.ability.extra[tostring(v.rarity).."_mult_mod"])
1148+
mults.colours[#mults.colours + 1] = v.colour
1149+
end
1150+
end
11481151
return {
1149-
vars = {
1150-
number_format(center.ability.extra.rare_mult_mod),
1151-
number_format(center.ability.extra.epic_mult_mod),
1152-
number_format(center.ability.extra.legend_mult_mod),
1153-
number_format(center.ability.extra.exotic_mult_mod),
1154-
},
1152+
vars = mults,
11551153
}
1154+
end,
1155+
set_ability = function(self, center)
1156+
local extra_rarities = {}
1157+
local mults = {}
1158+
local mult_numbers = {}
1159+
for i, v in pairs(Cryptid.circus_rarities) do
1160+
extra_rarities[#extra_rarities+1] = v
1161+
end
1162+
table.sort(extra_rarities, function(a, b) return a.order < b.order end)
1163+
for i, v in pairs(extra_rarities) do
1164+
mult_numbers[tostring(v.rarity).."_mult_mod"] = v.base_mult
1165+
mults[v.rarity] = tostring(v.rarity).."_mult_mod"
1166+
end
1167+
if not self.config.extra then
1168+
self.config.extra = mult_numbers
1169+
center.ability.extra = mult_numbers
1170+
self.config.immutable = {
1171+
rarity_map = mults
1172+
}
1173+
center.ability.immutable = {
1174+
rarity_map = mults
1175+
}
1176+
end
11561177
end,
11571178
rarity = "cry_epic",
11581179
cost = 16,
11591180
blueprint_compat = true,
11601181
demicoloncompat = true,
11611182
calculate = function(self, card, context)
1162-
local function calculate_xmult(mult_mod)
1163-
if not Talisman.config_file.disable_anims then
1164-
G.E_MANAGER:add_event(Event({
1165-
func = function()
1166-
context.other_joker:juice_up(0.5, 0.5)
1167-
return true
1168-
end,
1169-
}))
1170-
end
1171-
1172-
local xmult = lenient_bignum(math.max(1, to_big(card.ability.extra.Xmult)) * to_big(mult_mod))
1173-
return {
1174-
message = localize({
1175-
type = "variable",
1176-
key = "a_xmult",
1177-
vars = { number_format(xmult) },
1178-
}),
1179-
Xmult_mod = xmult,
1180-
}
1181-
end
11821183

11831184
if context.other_joker and card ~= context.other_joker then
11841185
local mod_key = card.ability.immutable.rarity_map[context.other_joker.config.center.rarity]
1185-
if mod_key then
1186-
return calculate_xmult(card.ability.extra[mod_key])
1186+
if mod_key and card.ability.extra[mod_key] and to_big(card.ability.extra[mod_key]) > to_big(1) then
1187+
if not Talisman.config_file.disable_anims then
1188+
G.E_MANAGER:add_event(Event({
1189+
func = function()
1190+
context.other_joker:juice_up(0.5, 0.5)
1191+
return true
1192+
end,
1193+
}))
1194+
end
1195+
local xmult = card.ability.extra[mod_key]
1196+
return {
1197+
message = localize({
1198+
type = "variable",
1199+
key = "a_xmult",
1200+
vars = { number_format(xmult) },
1201+
}),
1202+
Xmult_mod = xmult,
1203+
}
11871204
end
11881205
end
11891206
if context.forcetrigger then
1207+
local total = 1
1208+
for i, v in pairs(card.ability.extra) do
1209+
if type(v) == "number" or (type(v) == "table" and v.tetrate) then
1210+
total = total * v
1211+
end
1212+
end
11901213
return {
11911214
Xmult_mod = (
1192-
card.ability.extra.rare_mult_mod
1193-
* card.ability.extra.epic_mult_mod
1194-
* card.ability.extra.legend_mult_mod
1195-
* card.ability.extra.exotic_mult_mod
1215+
total
11961216
),
11971217
}
11981218
end

lib/misc.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,3 +1000,31 @@ function Cryptid.table_merge(t1, t2)
10001000
end
10011001
return tbl
10021002
end
1003+
1004+
function Cryptid.get_circus_description()
1005+
local desc = {}
1006+
local ind = 1
1007+
local extra_rarities = {}
1008+
for i, v in pairs(Cryptid.circus_rarities) do
1009+
if not v.hidden then
1010+
extra_rarities[#extra_rarities+1] = v
1011+
end
1012+
end
1013+
table.sort(extra_rarities, function(a, b) return a.order < b.order end)
1014+
for i, v in pairs(extra_rarities) do
1015+
local rarity = v.rarity
1016+
rarity = localize(({
1017+
[1] = "k_common",
1018+
[2] = "k_uncommon",
1019+
[3] = "k_rare",
1020+
[4] = "k_legendary"
1021+
})[rarity] or "k_"..rarity)
1022+
local orig = localize("cry_circus_generic")
1023+
orig = string.gsub(orig, "#1#", ind)
1024+
orig = string.gsub(orig, "#2#", rarity)
1025+
orig = string.gsub(orig, "#3#", "#"..tostring(ind).."#")
1026+
desc[#desc+1] = orig
1027+
ind = ind + 1
1028+
end
1029+
return desc
1030+
end

localization/en-us.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,12 +1319,7 @@ return {
13191319
},
13201320
j_cry_circus = {
13211321
name = "Circus",
1322-
text = {
1323-
"{C:red}Rare{} Jokers each give {X:mult,C:white} X#1# {} Mult",
1324-
"{C:cry_epic}Epic{} Jokers each give {X:mult,C:white} X#2# {} Mult",
1325-
"{C:legendary}Legendary{} Jokers each give {X:mult,C:white} X#3# {} Mult",
1326-
"{C:cry_exotic}Exotic{} Jokers each give {X:mult,C:white} X#4# {} Mult",
1327-
},
1322+
text = Cryptid.get_circus_description(), --for translaters: this is automatically localized you can copy it over as long as cry_circus_generic is translated too
13281323
unlock = {
13291324
"Obtain a {C:red}Rare{},",
13301325
"{C:cry_epic}Epic{} and {C:legendary}Legendary{}",
@@ -5023,6 +5018,8 @@ return {
50235018
b_reset_gameset_modest = "Reset Gameset Config (Modest)",
50245019
b_reset_gameset_mainline = "Reset Gameset Config (Mainline)",
50255020
b_reset_gameset_madness = "Reset Gameset Config (Madness)",
5021+
5022+
cry_circus_generic = "{V:#1#}#2#{} Jokers each give {X:mult,C:white} X#3# {} Mult"
50265023
},
50275024
labels = {
50285025
food_jokers = "Food Jokers",

lovely/lib_misc.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ Cryptid.aliases = {}
134134
Cryptid.pointerblist = {}
135135
Cryptid.pointerblistrarity = {}
136136
Cryptid.mod_gameset_whitelist = {}
137+
138+
Cryptid.pin_debuff = {}
139+
Cryptid.circus_rarities = {
140+
--format {base_mult = ..., loc_key = ..., rarity=..., order=...}
141+
}
142+
137143
function cry_format(...)
138144
return ...
139145
end

0 commit comments

Comments
 (0)