diff --git a/items/epic.lua b/items/epic.lua index 04e46c890..fcf78505e 100644 --- a/items/epic.lua +++ b/items/epic.lua @@ -1009,7 +1009,6 @@ local number_blocks = { -- Double Scale -- Scaling jokers scale quadratically --- Most of the code for this lies in Card:cry_double_scale_calc in lib/calculate.lua local double_scale = { object_type = "Joker", name = "cry-Double Scale", @@ -1036,28 +1035,30 @@ local double_scale = { cost = 18, immutable = true, atlas = "atlasepic", - calc_scaling = function(self, card, other, current_scaling, current_scalar, args) - if not G.GAME.cryptid_base_scales then - G.GAME.cryptid_base_scales = {} - end - if not G.GAME.cryptid_base_scales[other.config.center.key] then - G.GAME.cryptid_base_scales[other.config.center.key] = {} - end - if not G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] then - G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] = current_scalar + calc_scaling = function(self, card, other, current_scaling, current_scalar, args) + -- store original scaling rate + if not other.ability.cry_scaling_info then + other.ability.cry_scaling_info = { + [args.scalar_value] = current_scalar + } + elseif not other.ability.cry_scaling_info[args.scalar_value] then + other.ability.cry_scaling_info[args.scalar_value] = current_scalar end - local true_base = G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] - local orig_scale_scale = current_scaling + + local original_scalar = other.ability.cry_scaling_info[args.scalar_value] + + -- joker scaling stuff if Cryptid.gameset(self) == "exp_modest" then return { - scalar_value = lenient_bignum(to_big(true_base) * 2), + scalar_value = lenient_bignum(to_big(original_scalar) * 2), + message = localize("k_upgrade_ex"), + } + else + args.scalar_table[args.scalar_value] = current_scalar + original_scalar + return { message = localize("k_upgrade_ex"), } end - args.scalar_table[args.scalar_value] = new_scale - return { - message = localize("k_upgrade_ex"), - } end, cry_credits = { idea = { @@ -1068,7 +1069,7 @@ local double_scale = { }, code = { "Math", - "Mathguy", + "Mathguy" }, }, } diff --git a/items/exotic.lua b/items/exotic.lua index 7c78ac408..6a90978d0 100644 --- a/items/exotic.lua +++ b/items/exotic.lua @@ -819,41 +819,42 @@ local scalae = { end end, calc_scaling = function(self, card, other, current_scaling, current_scalar, args) - if other.ability.name ~= "cry-Scalae" then - if not G.GAME.cryptid_base_scales then - G.GAME.cryptid_base_scales = {} - end - if not G.GAME.cryptid_base_scales[other.config.center.key] then - G.GAME.cryptid_base_scales[other.config.center.key] = {} - end - if not G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] then - G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] = current_scalar - end - local true_base = G.GAME.cryptid_base_scales[other.config.center.key][args.scalar_value] - local orig_scale_scale = current_scaling - local new_scale = lenient_bignum( - to_big(true_base) - * ( - ( - 1 - + ( - (to_big(orig_scale_scale) / to_big(true_base)) - ^ (to_big(1) / to_big(card.ability.extra.scale)) - ) - ) ^ to_big(card.ability.extra.scale) - ) - ) - if not Cryptid.is_card_big(other) and to_big(new_scale) >= to_big(1e300) then - new_scale = 1e300 - end - return { - scalar_value = new_scale, - message = localize("k_upgrade_ex"), + -- checks if the scaled joker is also a scalae + -- if so, return nothing + if other.config.center.key == self.key then return end + + -- store original scaling rate + if not other.ability.cry_scaling_info then + other.ability.cry_scaling_info = { + [args.scalar_value] = current_scalar } + elseif not other.ability.cry_scaling_info[args.scalar_value] then + other.ability.cry_scaling_info[args.scalar_value] = current_scalar end + + -- joker scaling stuff + local original_scalar = other.ability.cry_scaling_info[args.scalar_value] + local new_scale = lenient_bignum( + to_big(original_scalar) * ( + ( + 1 + + ( + (to_big(current_scaling) / to_big(original_scalar)) + ^ (to_big(1) / to_big(card.ability.extra.scale)) + ) + ) ^ to_big(card.ability.extra.scale) + ) + ) + args.scalar_table[args.scalar_value] = new_scale + + return { + message = localize("k_upgrade_ex"), + } end, + loc_vars = function(self, info_queue, card) local example = { 2, 3, 4 } + -- this is literally just straight up wrong atm, scalae doesn't work like this for i = 1, #example do example[i] = to_big(example[i]) ^ (card.ability.extra.scale + 1) end diff --git a/lib/misprintize.lua b/lib/misprintize.lua index 323a38d04..f328207c3 100644 --- a/lib/misprintize.lua +++ b/lib/misprintize.lua @@ -499,12 +499,20 @@ function Cryptid.manipulate_table(card, ref_table, ref_value, args, tblkey) or Cryptid.base_values[card.config.center.key][i .. "consumeable"] end end - if args.big ~= nil then - ref_table[ref_value][i] = Cryptid.manipulate_value(num, args, args.big, i) - else - ref_table[ref_value][i] = Cryptid.manipulate_value(num, args, Cryptid.is_card_big(card), i) + local new_val = Cryptid.manipulate_value( + num, + args, + args.big or Cryptid.is_card_big(card), + i + ) + ref_table[ref_value][i] = new_val + + -- take double scale / scalae into account + if ref_value == "ability" and ref_table.ability.cry_scaling_info then + ref_table.ability.cry_scaling_info[i] = new_val end - elseif i ~= "immutable" and type(v) == "table" and Cryptid.misprintize_value_blacklist[i] ~= false then + + 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 Cryptid.manipulate_table(card, ref_table[ref_value], i, args) end end