Skip to content

Commit 72bb963

Browse files
RNJoker bugfixes
-Fixed RNJoker triggering an incorrect amount of times with"playing card added" context -Removed "Suit", "Rank", and "Face" conditions from playing card added context -These are incompatible with some ways of adding playing cards and led to crashes or other issues
1 parent 0267ddb commit 72bb963

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

items/misc_joker.lua

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,6 +4227,9 @@ local rnjoker = {
42274227
if valid_context then
42284228
local cond_passed = false
42294229
local times_passed = 1
4230+
if (j_context == "playing_card_added" and context.cards and context.cards[1]) then
4231+
times_passed = #context.cards
4232+
end
42304233
if j.cond then
42314234
if j.cond == "buy_common" then
42324235
if
@@ -4375,16 +4378,39 @@ local rnjoker = {
43754378
cond_passed = true
43764379
end
43774380
elseif j.cond == "odds" then
4378-
if
4379-
SMODS.pseudorandom_probability(
4380-
card,
4381-
"rnj",
4382-
1,
4383-
card and card.ability.extra.cond_value or 0,
4384-
"RNJoker"
4385-
)
4386-
then
4387-
cond_passed = true
4381+
if (j_context == "playing_card_added" and context.cards and context.cards[1]) then
4382+
for i = 1, #context.cards do
4383+
if
4384+
SMODS.pseudorandom_probability(
4385+
card,
4386+
"rnj",
4387+
1,
4388+
card and card.ability.extra.cond_value or 0,
4389+
"RNJoker"
4390+
)
4391+
then
4392+
4393+
else
4394+
times_passed = math.max(0, times_passed - 1)
4395+
end
4396+
end
4397+
if times_passed == 0 then
4398+
cond_passed = false
4399+
else
4400+
cond_passed = true
4401+
end
4402+
else
4403+
if
4404+
SMODS.pseudorandom_probability(
4405+
card,
4406+
"rnj",
4407+
1,
4408+
card and card.ability.extra.cond_value or 0,
4409+
"RNJoker"
4410+
)
4411+
then
4412+
cond_passed = true
4413+
end
43884414
end
43894415
end
43904416
else
@@ -5038,12 +5064,7 @@ local rnjoker = {
50385064
"odds",
50395065
}
50405066
elseif context == "playing_card_added" then
5041-
conds = {
5042-
"suit",
5043-
"rank",
5044-
"face",
5045-
"odds",
5046-
}
5067+
conds = { "odds" }
50475068
elseif context == "setting_blind" then
50485069
conds = {
50495070
"boss",

0 commit comments

Comments
 (0)