Skip to content

Commit 5ebf1a5

Browse files
Dagger Fixes
-Fixed a crash with monkey dagger (Maybe the other ones too but the only crash I noticed was with monkey dagger) -Fixed Monkey Dagger, Unjust Dagger, and Pirate Dagger not giving chips/mult if there was no valid target to destroy when forcetriggered -Fixed Monkey Dagger, Unjust Dagger, and Pirate Dagger destroying things they are not supposed to destroy (eternals etc) when forcetriggered -Fixed Monkey Dagger, Unjust Dagger, and Pirate Dagger scaling incorrectly
1 parent 055aa21 commit 5ebf1a5

File tree

1 file changed

+168
-116
lines changed

1 file changed

+168
-116
lines changed

items/misc_joker.lua

Lines changed: 168 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -2927,7 +2927,8 @@ local unjust_dagger = {
29272927
end
29282928
if
29292929
context.setting_blind
2930-
and not (context.blueprint_card or self).getting_sliced
2930+
and not card.getting_sliced
2931+
and not context.blueprint
29312932
and my_pos
29322933
and G.jokers.cards[my_pos - 1]
29332934
and not SMODS.is_eternal(G.jokers.cards[my_pos - 1])
@@ -2942,8 +2943,6 @@ local unjust_dagger = {
29422943
G.E_MANAGER:add_event(Event({
29432944
func = function()
29442945
G.GAME.joker_buffer = 0
2945-
card.ability.extra.x_mult =
2946-
lenient_bignum(to_big(card.ability.extra.x_mult) + sliced_card.sell_cost * 0.2)
29472946
card:juice_up(0.8, 0.8)
29482947
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
29492948
play_sound("slice1", 0.96 + math.random() * 0.08)
@@ -2953,43 +2952,64 @@ local unjust_dagger = {
29532952
SMODS.scale_card(card, {
29542953
ref_table = card.ability.extra,
29552954
ref_value = "x_mult",
2956-
scalar_table = {
2957-
sell_cost = sliced_card.sell_cost * 0.2,
2958-
},
2955+
scalar_table = sliced_card,
29592956
scalar_value = "sell_cost",
2960-
message_key = "a_xmult",
2961-
message_colour = G.C.RED,
2957+
operation = function(ref_table, ref_value, initial, scaling)
2958+
ref_table[ref_value] = initial + 0.2 * scaling
2959+
end,
2960+
scaling_message = {
2961+
message = localize({
2962+
type = "variable",
2963+
key = "a_xmult",
2964+
vars = { card.ability.extra.x_mult + 0.2 * sliced_card.sell_cost },
2965+
}),
2966+
colour = G.C.MULT,
2967+
no_juice = true,
2968+
},
29622969
})
29632970
return nil, true
29642971
end
2965-
if context.forcetrigger and my_pos and G.jokers.cards[my_pos - 1] then
2966-
local sliced_card = G.jokers.cards[my_pos - 1]
2967-
sliced_card.getting_sliced = true
2968-
if sliced_card.config.center.rarity == "cry_exotic" then
2969-
check_for_unlock({ type = "what_have_you_done" })
2972+
if context.forcetrigger then
2973+
if
2974+
my_pos
2975+
and G.jokers.cards[my_pos - 1]
2976+
and not SMODS.is_eternal(G.jokers.cards[my_pos - 1])
2977+
and not G.jokers.cards[my_pos - 1].getting_sliced
2978+
then
2979+
local sliced_card = G.jokers.cards[my_pos - 1]
2980+
sliced_card.getting_sliced = true
2981+
if sliced_card.config.center.rarity == "cry_exotic" then
2982+
check_for_unlock({ type = "what_have_you_done" })
2983+
end
2984+
G.GAME.joker_buffer = G.GAME.joker_buffer - 1
2985+
G.E_MANAGER:add_event(Event({
2986+
func = function()
2987+
G.GAME.joker_buffer = 0
2988+
card:juice_up(0.8, 0.8)
2989+
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
2990+
play_sound("slice1", 0.96 + math.random() * 0.08)
2991+
return true
2992+
end,
2993+
}))
2994+
SMODS.scale_card(card, {
2995+
ref_table = card.ability.extra,
2996+
ref_value = "x_mult",
2997+
scalar_table = sliced_card,
2998+
scalar_value = "sell_cost",
2999+
operation = function(ref_table, ref_value, initial, scaling)
3000+
ref_table[ref_value] = initial + 0.2 * scaling
3001+
end,
3002+
scaling_message = {
3003+
message = localize({
3004+
type = "variable",
3005+
key = "a_xmult",
3006+
vars = { card.ability.extra.x_mult + 0.2 * sliced_card.sell_cost },
3007+
}),
3008+
colour = G.C.MULT,
3009+
no_juice = true,
3010+
},
3011+
})
29703012
end
2971-
G.GAME.joker_buffer = G.GAME.joker_buffer - 1
2972-
G.E_MANAGER:add_event(Event({
2973-
func = function()
2974-
G.GAME.joker_buffer = 0
2975-
card.ability.extra.x_mult =
2976-
lenient_bignum(to_big(card.ability.extra.x_mult) + sliced_card.sell_cost * 0.2)
2977-
card:juice_up(0.8, 0.8)
2978-
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
2979-
play_sound("slice1", 0.96 + math.random() * 0.08)
2980-
return true
2981-
end,
2982-
}))
2983-
SMODS.scale_card(card, {
2984-
ref_table = card.ability.extra,
2985-
ref_value = "x_mult",
2986-
scalar_table = {
2987-
sell_cost = sliced_card.sell_cost * 0.2,
2988-
},
2989-
scalar_value = "sell_cost",
2990-
message_key = "a_xmult",
2991-
message_colour = G.C.RED,
2992-
})
29933013
return {
29943014
Xmult_mod = lenient_bignum(card.ability.extra.x_mult),
29953015
}
@@ -3048,7 +3068,8 @@ local monkey_dagger = {
30483068
end
30493069
if
30503070
context.setting_blind
3051-
and not (context.blueprint_card or self).getting_sliced
3071+
and not card.getting_sliced
3072+
and not context.blueprint
30523073
and my_pos
30533074
and G.jokers.cards[my_pos - 1]
30543075
and not SMODS.is_eternal(G.jokers.cards[my_pos - 1])
@@ -3063,67 +3084,73 @@ local monkey_dagger = {
30633084
G.E_MANAGER:add_event(Event({
30643085
func = function()
30653086
G.GAME.joker_buffer = 0
3066-
card.ability.extra.chips =
3067-
lenient_bignum(to_big(card.ability.extra.chips) + sliced_card.sell_cost * 10)
30683087
card:juice_up(0.8, 0.8)
30693088
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
30703089
play_sound("slice1", 0.96 + math.random() * 0.08)
30713090
return true
30723091
end,
30733092
}))
3074-
local msg = SMODS.scale_card(card, {
3093+
SMODS.scale_card(card, {
30753094
ref_table = card.ability.extra,
3076-
ref_value = "x_mult",
3077-
scalar_table = {
3078-
sell_cost = sliced_card.sell_cost * 10,
3079-
},
3095+
ref_value = "chips",
3096+
scalar_table = sliced_card,
30803097
scalar_value = "sell_cost",
3081-
})
3082-
if not msg or type(msg) == "string" then
3083-
card_eval_status_text(card, "extra", nil, nil, nil, {
3084-
message = msg or localize({
3098+
operation = function(ref_table, ref_value, initial, scaling)
3099+
ref_table[ref_value] = initial + 10 * scaling
3100+
end,
3101+
scaling_message = {
3102+
message = localize({
30853103
type = "variable",
30863104
key = "a_chips",
3087-
vars = {
3088-
number_format(
3089-
lenient_bignum(to_big(card.ability.extra.chips) + 10 * sliced_card.sell_cost)
3090-
),
3091-
},
3105+
vars = { card.ability.extra.chips + 10 * sliced_card.sell_cost },
30923106
}),
30933107
colour = G.C.CHIPS,
30943108
no_juice = true,
3095-
})
3096-
end
3109+
},
3110+
})
30973111
return nil, true
30983112
end
3099-
if context.forcetrigger and my_pos and G.jokers.cards[my_pos - 1] then
3100-
local sliced_card = G.jokers.cards[my_pos - 1]
3101-
sliced_card.getting_sliced = true
3102-
if sliced_card.config.center.rarity == "cry_exotic" then
3103-
check_for_unlock({ type = "what_have_you_done" })
3113+
if context.forcetrigger then
3114+
if
3115+
my_pos
3116+
and G.jokers.cards[my_pos - 1]
3117+
and not SMODS.is_eternal(G.jokers.cards[my_pos - 1])
3118+
and not G.jokers.cards[my_pos - 1].getting_sliced
3119+
then
3120+
local sliced_card = G.jokers.cards[my_pos - 1]
3121+
sliced_card.getting_sliced = true
3122+
if sliced_card.config.center.rarity == "cry_exotic" then
3123+
check_for_unlock({ type = "what_have_you_done" })
3124+
end
3125+
G.GAME.joker_buffer = G.GAME.joker_buffer - 1
3126+
G.E_MANAGER:add_event(Event({
3127+
func = function()
3128+
G.GAME.joker_buffer = 0
3129+
card:juice_up(0.8, 0.8)
3130+
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
3131+
play_sound("slice1", 0.96 + math.random() * 0.08)
3132+
return true
3133+
end,
3134+
}))
3135+
SMODS.scale_card(card, {
3136+
ref_table = card.ability.extra,
3137+
ref_value = "chips",
3138+
scalar_table = sliced_card,
3139+
scalar_value = "sell_cost",
3140+
operation = function(ref_table, ref_value, initial, scaling)
3141+
ref_table[ref_value] = initial + 10 * scaling
3142+
end,
3143+
scaling_message = {
3144+
message = localize({
3145+
type = "variable",
3146+
key = "a_chips",
3147+
vars = { card.ability.extra.chips + 10 * sliced_card.sell_cost },
3148+
}),
3149+
colour = G.C.CHIPS,
3150+
no_juice = true,
3151+
},
3152+
})
31043153
end
3105-
G.GAME.joker_buffer = G.GAME.joker_buffer - 1
3106-
G.E_MANAGER:add_event(Event({
3107-
func = function()
3108-
G.GAME.joker_buffer = 0
3109-
card.ability.extra.chips =
3110-
lenient_bignum(to_big(card.ability.extra.chips) + sliced_card.sell_cost * 10)
3111-
card:juice_up(0.8, 0.8)
3112-
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
3113-
play_sound("slice1", 0.96 + math.random() * 0.08)
3114-
return true
3115-
end,
3116-
}))
3117-
SMODS.scale_card(card, {
3118-
ref_table = card.ability.extra,
3119-
ref_value = "chips",
3120-
scalar_table = {
3121-
sell_cost = sliced_card.sell_cost * 10,
3122-
},
3123-
scalar_value = "sell_cost",
3124-
message_key = "a_chips",
3125-
message_colour = G.C.BLUE,
3126-
})
31273154
return {
31283155
chip_mod = lenient_bignum(card.ability.extra.chips),
31293156
}
@@ -3182,7 +3209,8 @@ local pirate_dagger = {
31823209
end
31833210
if
31843211
context.setting_blind
3185-
and not (context.blueprint_card or self).getting_sliced
3212+
and not card.getting_sliced
3213+
and not context.blueprint
31863214
and my_pos
31873215
and G.jokers.cards[my_pos + 1]
31883216
and not SMODS.is_eternal(G.jokers.cards[my_pos + 1])
@@ -3197,8 +3225,6 @@ local pirate_dagger = {
31973225
G.E_MANAGER:add_event(Event({
31983226
func = function()
31993227
G.GAME.joker_buffer = 0
3200-
card.ability.extra.x_chips =
3201-
lenient_bignum(to_big(card.ability.extra.x_chips) + sliced_card.sell_cost * 0.25)
32023228
card:juice_up(0.8, 0.8)
32033229
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
32043230
play_sound("slice1", 0.96 + math.random() * 0.08)
@@ -3208,45 +3234,71 @@ local pirate_dagger = {
32083234
SMODS.scale_card(card, {
32093235
ref_table = card.ability.extra,
32103236
ref_value = "x_chips",
3211-
scalar_table = {
3212-
sell_cost = sliced_card.sell_cost * 0.25,
3213-
},
3237+
scalar_table = sliced_card,
32143238
scalar_value = "sell_cost",
3215-
message_key = "a_xchips",
3216-
message_colour = G.C.BLUE,
3239+
operation = function(ref_table, ref_value, initial, scaling)
3240+
ref_table[ref_value] = initial + 0.25 * scaling
3241+
end,
3242+
scaling_message = {
3243+
message = localize({
3244+
type = "variable",
3245+
key = "a_xchips",
3246+
vars = { card.ability.extra.x_chips + 0.25 * sliced_card.sell_cost },
3247+
}),
3248+
colour = G.C.CHIPS,
3249+
no_juice = true,
3250+
},
32173251
})
32183252
return nil, true
32193253
end
3220-
if context.forcetrigger and my_pos and G.jokers.cards[my_pos + 1] then
3221-
local sliced_card = G.jokers.cards[my_pos + 1]
3222-
sliced_card.getting_sliced = true
3223-
if sliced_card.config.center.rarity == "cry_exotic" then
3224-
check_for_unlock({ type = "what_have_you_done" })
3254+
if context.forcetrigger then
3255+
if
3256+
my_pos
3257+
and G.jokers.cards[my_pos + 1]
3258+
and not SMODS.is_eternal(G.jokers.cards[my_pos + 1])
3259+
and not G.jokers.cards[my_pos + 1].getting_sliced
3260+
then
3261+
local sliced_card = G.jokers.cards[my_pos + 1]
3262+
sliced_card.getting_sliced = true
3263+
if sliced_card.config.center.rarity == "cry_exotic" then
3264+
check_for_unlock({ type = "what_have_you_done" })
3265+
end
3266+
G.GAME.joker_buffer = G.GAME.joker_buffer - 1
3267+
G.E_MANAGER:add_event(Event({
3268+
func = function()
3269+
G.GAME.joker_buffer = 0
3270+
card:juice_up(0.8, 0.8)
3271+
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
3272+
play_sound("slice1", 0.96 + math.random() * 0.08)
3273+
return true
3274+
end,
3275+
}))
3276+
SMODS.scale_card(card, {
3277+
ref_table = card.ability.extra,
3278+
ref_value = "x_chips",
3279+
scalar_table = sliced_card,
3280+
scalar_value = "sell_cost",
3281+
operation = function(ref_table, ref_value, initial, scaling)
3282+
ref_table[ref_value] = initial + 0.25 * scaling
3283+
end,
3284+
scaling_message = {
3285+
message = localize({
3286+
type = "variable",
3287+
key = "a_xchips",
3288+
vars = { card.ability.extra.x_chips + 0.25 * sliced_card.sell_cost },
3289+
}),
3290+
colour = G.C.CHIPS,
3291+
no_juice = true,
3292+
},
3293+
})
32253294
end
3226-
G.GAME.joker_buffer = G.GAME.joker_buffer - 1
3227-
G.E_MANAGER:add_event(Event({
3228-
func = function()
3229-
G.GAME.joker_buffer = 0
3230-
card.ability.extra.x_chips =
3231-
lenient_bignum(to_big(card.ability.extra.x_chips) + sliced_card.sell_cost * 0.25)
3232-
card:juice_up(0.8, 0.8)
3233-
sliced_card:start_dissolve({ HEX("57ecab") }, nil, 1.6)
3234-
play_sound("slice1", 0.96 + math.random() * 0.08)
3235-
return true
3236-
end,
3237-
}))
3238-
SMODS.scale_card(card, {
3239-
ref_table = card.ability.extra,
3240-
ref_value = "x_chips",
3241-
scalar_table = {
3242-
sell_cost = sliced_card.sell_cost * 0.25,
3243-
},
3244-
scalar_value = "sell_cost",
3245-
message_key = "a_xchips",
3246-
message_colour = G.C.BLUE,
3247-
})
32483295
return {
32493296
Xchip_mod = lenient_bignum(card.ability.extra.x_chips),
3297+
message = localize({
3298+
type = "variable",
3299+
key = "a_xchips",
3300+
vars = { number_format(card.ability.extra.x_chips) },
3301+
}),
32503302
}
32513303
end
32523304
end,

0 commit comments

Comments
 (0)