local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(cXXXXXXXX.adval)
c:RegisterEffect(e1)
function cXXXXXXXX.adval(e,c)
local g=Duel.GetMatchingGroup(cXXXXXXXX.filter,0,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()==0 then
return 0
else
local tg,val=g:GetMaxGroup(Card.GetAttack)
return val
end
end
function cXXXXXXXX.filter(c)
return c:IsFaceup() and c:GetCode()~=XXXXXXXX
end
Here you go, should work