Refactored clean_hand

This commit is contained in:
Connor Mills
2025-03-23 18:59:54 -07:00
parent b648b7c289
commit 6fa23989cd
2 changed files with 13 additions and 15 deletions

View File

@@ -4,22 +4,10 @@
local orig_get_X_same = get_X_same
function get_X_same(num, hand)
local clean_hand = {}
for _, v in pairs(hand) do
if v.get_id then
table.insert(clean_hand, v)
end
end
return orig_get_X_same(num, clean_hand)
return orig_get_X_same(num, clean_hand(hand))
end
local orig_get_highest = get_highest
function get_highest(hand)
local clean_hand = {}
for _, v in pairs(hand) do
if v.get_nominal then
table.insert(clean_hand, v)
end
end
return orig_get_highest(clean_hand)
return orig_get_highest(clean_hand(hand))
end

View File

@@ -39,3 +39,13 @@ end
function DV.PRE.enabled()
return G.SETTINGS.DV.preview_score or G.SETTINGS.DV.preview_dollars
end
function clean_hand(hand)
local clean_hand = {}
for _, v in pairs(hand) do
if v.get_id then -- Should work for all functions even if they don't use get_id because get_id is a meta function and the broken cards don't have meta values
table.insert(clean_hand, v)
end
end
return clean_hand
end