Skip to content

Commit 15a239d

Browse files
committed
style: better return flags lookup in calculate_individual_effect
1 parent 4f12250 commit 15a239d

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

src/utils.lua

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,39 +1378,35 @@ SMODS.calculate_individual_effect = function(effect, scored_card, key, amount, f
13781378
end
13791379

13801380
local key_return_flags = {
1381-
'prevent_debuff',
1382-
'add_to_hand',
1383-
'remove_from_hand',
1384-
'stay_flipped',
1385-
'prevent_stay_flipped',
1386-
'prevent_trigger'
1381+
prevent_debuff = true,
1382+
add_to_hand = true,
1383+
remove_from_hand = true,
1384+
stay_flipped = true,
1385+
prevent_stay_flipped = true,
1386+
prevent_trigger = true,
13871387
}
13881388

1389-
for _, flag in ipairs(key_return_flags) do
1390-
if key == flag then
1391-
return key
1392-
end
1389+
if key_return_flags[key] then
1390+
return key
13931391
end
13941392

13951393
local amount_return_flags = {
1396-
'remove',
1397-
'debuff_text',
1398-
'cards_to_draw',
1399-
'numerator',
1400-
'denominator',
1401-
'no_destroy',
1402-
'replace_scoring_name',
1403-
'replace_display_name',
1404-
'replace_poker_hands',
1405-
'modify',
1406-
'shop_create_flags',
1407-
'booster_create_flags'
1394+
remove = true,
1395+
debuff_text = true,
1396+
cards_to_draw = true,
1397+
numerator = true,
1398+
denominator = true,
1399+
no_destroy = true,
1400+
replace_scoring_name = true,
1401+
replace_display_name = true,
1402+
replace_poker_hands = true,
1403+
modify = true,
1404+
shop_create_flags = true,
1405+
booster_create_flags = true
14081406
}
14091407

1410-
for _, flag in ipairs(amount_return_flags) do
1411-
if key == flag then
1412-
return { [key] = amount }
1413-
end
1408+
if amount_return_flags[key] then
1409+
return { [key] = amount }
14141410
end
14151411

14161412
if key == 'debuff' then

version.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return "1.0.0~BETA-1527b-STEAMODDED"
1+
return "1.0.0~BETA-1527c-STEAMODDED"

0 commit comments

Comments
 (0)