@@ -221,7 +221,7 @@ local potofjokes = {
221221 },
222222 name = " cry-Pot of Jokes" ,
223223 key = " pot_of_jokes" ,
224- config = { extra = { h_size = - 2 , h_mod = 1 } },
224+ config = { extra = { h_size = - 2 , h_mod = 1 }, immutable = { h_added = 0 , h_mod_max = 1000 } },
225225 pos = { x = 5 , y = 0 },
226226 rarity = 3 ,
227227 order = 104 ,
@@ -234,19 +234,38 @@ local potofjokes = {
234234 center .ability .extra .h_size < 0 and center .ability .extra .h_size
235235 or " +" .. math.min (1000 , center .ability .extra .h_size ),
236236 center .ability .extra .h_mod ,
237+ " +" .. center .ability .immutable .h_mod_max ,
237238 },
238239 }
239240 end ,
240241 calculate = function (self , card , context )
241242 if context .end_of_round and not context .individual and not context .repetition and not context .blueprint then
242- if to_big (card .ability .extra .h_size ) + to_big (card .ability .extra .h_mod ) >= to_big (1000 ) then
243- card .ability .extra .h_size = 1000
243+ if
244+ to_big (card .ability .extra .h_size ) + to_big (card .ability .extra .h_mod )
245+ >= to_big (card .ability .immutable .h_mod_max )
246+ then
247+ card .ability .extra .h_size = card .ability .immutable .h_mod_max
244248 card .ability .extra .h_mod = 0
249+
250+ -- Fallback for if Pot of Jokes comes into this calcuate function with large h_size
251+ if card .ability .immutable .h_added < card .ability .immutable .h_mod_max then
252+ local delta = card .ability .immutable .h_mod_max - card .ability .immutable .h_added
253+
254+ G .hand :change_size (delta )
255+
256+ card .ability .immutable .h_added = card .ability .immutable .h_mod_max
257+ end
245258 end
246259
247- G .hand :change_size (math.min (math.max (0 , 1000 - card .ability .extra .h_size ), card .ability .extra .h_mod ))
260+ local delta = math.min (
261+ math.max (0 , card .ability .immutable .h_mod_max - card .ability .extra .h_size ),
262+ card .ability .extra .h_mod
263+ )
264+
265+ G .hand :change_size (delta )
248266
249267 card .ability .extra .h_size = card .ability .extra .h_size + card .ability .extra .h_mod
268+ card .ability .immutable .h_added = card .ability .immutable .h_added + delta
250269
251270 return {
252271 message = localize ({ type = " variable" , key = " a_handsize" , vars = { card .ability .extra .h_mod } }),
@@ -256,10 +275,10 @@ local potofjokes = {
256275 end
257276 end ,
258277 add_to_deck = function (self , card , from_debuff )
259- G .hand :change_size (math.min (1000 , card .ability .extra .h_size ))
278+ G .hand :change_size (math.min (card . ability . immutable . h_mod_max , card .ability .extra .h_size ))
260279 end ,
261280 remove_from_deck = function (self , card , from_debuff )
262- G .hand :change_size (- 1 * math.min (1000 , card .ability .extra .h_size ))
281+ G .hand :change_size (- 1 * math.min (card . ability . immutable . h_mod_max , card .ability .extra .h_size ))
263282 end ,
264283 cry_credits = {
265284 idea = {
@@ -270,6 +289,7 @@ local potofjokes = {
270289 },
271290 code = {
272291 " Math" ,
292+ " BobJoe400" ,
273293 },
274294 },
275295 unlocked = false ,
0 commit comments