Skip to content

Commit a63450d

Browse files
Merge pull request #512 from bobjoe400/Big-Num-support
i'TS A MI more Mairo
2 parents f72ba9e + 39c83c4 commit a63450d

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

Cryptid.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"priority": 114,
1010
"badge_colour": "708b91",
1111
"badge_text_colour": "FFFFFF",
12-
"version": "0.5.5a~dev",
12+
"version": "0.5.5a~dev2",
1313
"dependencies": [
1414
"Talisman (>=2.0.9)",
1515
"Steamodded (>=1.0.0~BETA-0314c)"

items/misc_joker.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ local potofjokes = {
289289
},
290290
code = {
291291
"Math",
292+
"BobJoe400",
292293
},
293294
},
294295
unlocked = false,
@@ -8007,7 +8008,7 @@ local miscitems = {
80078008
lebaron_james,
80088009
huntingseason,
80098010
--cat_owl,
8010-
eyeofhagane,
8011+
--eyeofhagane, (apparently this wasn't screened)
80118012
}
80128013
return {
80138014
name = "Misc. Jokers",

lib/misprintize.lua

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ function Cryptid.calculate_misprint(initial, min, max)
1919
end
2020

2121
function Cryptid.misprintize_tbl(name, ref_tbl, ref_value, clear, override, stack, big)
22+
local prob_max = 1e69 -- funny number
23+
2224
if name and ref_tbl and ref_value then
25+
-- print('Current joker: '..name)
26+
2327
tbl = Cryptid.deep_copy(ref_tbl[ref_value])
2428
for k, v in pairs(tbl) do
29+
-- print('\tCurrent key: '..k)
2530
if (type(tbl[k]) ~= "table") or is_number(tbl[k]) then
2631
if
2732
is_number(tbl[k])
@@ -48,26 +53,45 @@ function Cryptid.misprintize_tbl(name, ref_tbl, ref_value, clear, override, stac
4853
local min = override and override.min or G.GAME.modifiers.cry_misprint_min
4954
local max = override and override.max or G.GAME.modifiers.cry_misprint_max
5055

56+
if (k == "cry_prob"
57+
-- Hack for vanilla jokers that use the extra field to describe their odds
58+
or ((name == "j_8_ball"
59+
or name == "j_business"
60+
or name == "j_space"
61+
or name == "j_hallucination")
62+
and k == "extra"))
63+
and (to_big(initial) > to_big(prob_max)
64+
or to_big(min) > to_big(prob_max)
65+
or to_big(max) > to_big(prob_max))
66+
then
67+
initial = Cryptid.base_values[name][k] * prob_max
68+
min = 1
69+
max = 1
70+
end
71+
5172
tbl[k] = Cryptid.sanity_check(
5273
clear and Cryptid.base_values[name][k]
5374
or cry_format(Cryptid.calculate_misprint(initial, min, max), "%.2g"),
5475
big
5576
)
5677
end
57-
elseif not (k == "immutable") then
78+
elseif
79+
not (k == "immutable")
80+
and not (k == "colour")
81+
then
5882
for _k, _v in pairs(tbl[k]) do
83+
-- print('\t\tCurrent key: '.._k)
5984
if
6085
is_number(tbl[k][_k])
6186
and not (_k == "id")
62-
and not (k == "colour")
6387
and not (_k == "suit_nominal")
6488
and not (_k == "base_nominal")
6589
and not (_k == "face_nominal")
6690
and not (_k == "qty")
67-
and not (k == "x_mult" and v == 1 and not tbl[k].override_x_mult_check)
91+
and not (_k == "x_mult" and v == 1 and not tbl[k].override_x_mult_check)
6892
and not (_k == "selected_d6_face")
69-
and not (k == "d_size")
70-
and not (k == "h_size")
93+
and not (_k == "d_size")
94+
and not (_k == "h_size")
7195
then --Refer to above
7296
if not Cryptid.base_values[name] then
7397
Cryptid.base_values[name] = {}
@@ -82,6 +106,17 @@ function Cryptid.misprintize_tbl(name, ref_tbl, ref_value, clear, override, stac
82106
local initial = (stack and tbl[k][_k] or Cryptid.base_values[name][k][_k])
83107
local min = override and override.min or G.GAME.modifiers.cry_misprint_min
84108
local max = override and override.max or G.GAME.modifiers.cry_misprint_max
109+
110+
if (_k == "odds")
111+
and (to_big(initial) > to_big(prob_max)
112+
or to_big(min) > to_big(prob_max)
113+
or to_big(max) > to_big(prob_max))
114+
then
115+
print('\t\t\t got "odds"')
116+
initial = Cryptid.base_values[name][k][_k] * prob_max
117+
min = 1
118+
max = 1
119+
end
85120

86121
tbl[k][_k] = Cryptid.sanity_check(
87122
clear and Cryptid.base_values[name][k][_k]

0 commit comments

Comments
 (0)