Skip to content

Commit bd13ac1

Browse files
Merge pull request #782 from InvalidOS/patch-7
Make Scalae and Double Scale store original scaling rate per-joker
2 parents 1ee137b + 44fd76c commit bd13ac1

File tree

3 files changed

+63
-53
lines changed

3 files changed

+63
-53
lines changed

items/epic.lua

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,6 @@ local number_blocks = {
10091009

10101010
-- Double Scale
10111011
-- Scaling jokers scale quadratically
1012-
-- Most of the code for this lies in Card:cry_double_scale_calc in lib/calculate.lua
10131012
local double_scale = {
10141013
object_type = "Joker",
10151014
name = "cry-Double Scale",
@@ -1036,28 +1035,30 @@ local double_scale = {
10361035
cost = 18,
10371036
immutable = true,
10381037
atlas = "atlasepic",
1039-
calc_scaling = function(self, card, other, current_scaling, current_scalar, args)
1040-
if not G.GAME.cryptid_base_scales then
1041-
G.GAME.cryptid_base_scales = {}
1042-
end
1043-
if not G.GAME.cryptid_base_scales[other.config.center.key] then
1044-
G.GAME.cryptid_base_scales[other.config.center.key] = {}
1045-
end
1046-
if not G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] then
1047-
G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] = current_scalar
1038+
calc_scaling = function(self, card, other, current_scaling, current_scalar, args)
1039+
-- store original scaling rate
1040+
if not other.ability.cry_scaling_info then
1041+
other.ability.cry_scaling_info = {
1042+
[args.scalar_value] = current_scalar
1043+
}
1044+
elseif not other.ability.cry_scaling_info[args.scalar_value] then
1045+
other.ability.cry_scaling_info[args.scalar_value] = current_scalar
10481046
end
1049-
local true_base = G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value]
1050-
local orig_scale_scale = current_scaling
1047+
1048+
local original_scalar = other.ability.cry_scaling_info[args.scalar_value]
1049+
1050+
-- joker scaling stuff
10511051
if Cryptid.gameset(self) == "exp_modest" then
10521052
return {
1053-
scalar_value = lenient_bignum(to_big(true_base) * 2),
1053+
scalar_value = lenient_bignum(to_big(original_scalar) * 2),
1054+
message = localize("k_upgrade_ex"),
1055+
}
1056+
else
1057+
args.scalar_table[args.scalar_value] = current_scalar + original_scalar
1058+
return {
10541059
message = localize("k_upgrade_ex"),
10551060
}
10561061
end
1057-
args.scalar_table[args.scalar_value] = new_scale
1058-
return {
1059-
message = localize("k_upgrade_ex"),
1060-
}
10611062
end,
10621063
cry_credits = {
10631064
idea = {
@@ -1068,7 +1069,7 @@ local double_scale = {
10681069
},
10691070
code = {
10701071
"Math",
1071-
"Mathguy",
1072+
"Mathguy"
10721073
},
10731074
},
10741075
}

items/exotic.lua

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -819,41 +819,42 @@ local scalae = {
819819
end
820820
end,
821821
calc_scaling = function(self, card, other, current_scaling, current_scalar, args)
822-
if other.ability.name ~= "cry-Scalae" then
823-
if not G.GAME.cryptid_base_scales then
824-
G.GAME.cryptid_base_scales = {}
825-
end
826-
if not G.GAME.cryptid_base_scales[other.config.center.key] then
827-
G.GAME.cryptid_base_scales[other.config.center.key] = {}
828-
end
829-
if not G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] then
830-
G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] = current_scalar
831-
end
832-
local true_base = G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value]
833-
local orig_scale_scale = current_scaling
834-
local new_scale = lenient_bignum(
835-
to_big(true_base)
836-
* (
837-
(
838-
1
839-
+ (
840-
(to_big(orig_scale_scale) / to_big(true_base))
841-
^ (to_big(1) / to_big(card.ability.extra.scale))
842-
)
843-
) ^ to_big(card.ability.extra.scale)
844-
)
845-
)
846-
if not Cryptid.is_card_big(other) and to_big(new_scale) >= to_big(1e300) then
847-
new_scale = 1e300
848-
end
849-
return {
850-
scalar_value = new_scale,
851-
message = localize("k_upgrade_ex"),
822+
-- checks if the scaled joker is also a scalae
823+
-- if so, return nothing
824+
if other.config.center.key == self.key then return end
825+
826+
-- store original scaling rate
827+
if not other.ability.cry_scaling_info then
828+
other.ability.cry_scaling_info = {
829+
[args.scalar_value] = current_scalar
852830
}
831+
elseif not other.ability.cry_scaling_info[args.scalar_value] then
832+
other.ability.cry_scaling_info[args.scalar_value] = current_scalar
853833
end
834+
835+
-- joker scaling stuff
836+
local original_scalar = other.ability.cry_scaling_info[args.scalar_value]
837+
local new_scale = lenient_bignum(
838+
to_big(original_scalar) * (
839+
(
840+
1
841+
+ (
842+
(to_big(current_scaling) / to_big(original_scalar))
843+
^ (to_big(1) / to_big(card.ability.extra.scale))
844+
)
845+
) ^ to_big(card.ability.extra.scale)
846+
)
847+
)
848+
args.scalar_table[args.scalar_value] = new_scale
849+
850+
return {
851+
message = localize("k_upgrade_ex"),
852+
}
854853
end,
854+
855855
loc_vars = function(self, info_queue, card)
856856
local example = { 2, 3, 4 }
857+
-- this is literally just straight up wrong atm, scalae doesn't work like this
857858
for i = 1, #example do
858859
example[i] = to_big(example[i]) ^ (card.ability.extra.scale + 1)
859860
end

lib/misprintize.lua

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,20 @@ function Cryptid.manipulate_table(card, ref_table, ref_value, args, tblkey)
499499
or Cryptid.base_values[card.config.center.key][i .. "consumeable"]
500500
end
501501
end
502-
if args.big ~= nil then
503-
ref_table[ref_value][i] = Cryptid.manipulate_value(num, args, args.big, i)
504-
else
505-
ref_table[ref_value][i] = Cryptid.manipulate_value(num, args, Cryptid.is_card_big(card), i)
502+
local new_val = Cryptid.manipulate_value(
503+
num,
504+
args,
505+
args.big or Cryptid.is_card_big(card),
506+
i
507+
)
508+
ref_table[ref_value][i] = new_val
509+
510+
-- take double scale / scalae into account
511+
if ref_value == "ability" and ref_table.ability.cry_scaling_info then
512+
ref_table.ability.cry_scaling_info[i] = new_val
506513
end
507-
elseif i ~= "immutable" and type(v) == "table" and Cryptid.misprintize_value_blacklist[i] ~= false then
514+
515+
elseif i ~= "immutable" and not (ref_value == "ability" and i == "cry_scaling_info") and type(v) == "table" and Cryptid.misprintize_value_blacklist[i] ~= false then
508516
Cryptid.manipulate_table(card, ref_table[ref_value], i, args)
509517
end
510518
end

0 commit comments

Comments
 (0)