@@ -19,9 +19,14 @@ function Cryptid.calculate_misprint(initial, min, max)
1919end
2020
2121function 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