local g=Duel.GetMatchingGroup(function(c)return c:IsOriginalCodeRule(46173679) and c:GetActivateEffect()end,0,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,nil)
for tc in aux.Next(g) do
local le={tc:GetActivateEffect()}
for _,v in pairs(le) do
if v:GetRange()&0x10a~=0 and not SNNM.IsInTable(v,s.OAe) then
local le={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_SUMMON)}
for _,v in pairs(le) do
if v:GetOwner()==e:GetOwner() then
local tg=v:GetTarget() or aux.TRUE
if tg(v,tc,tp,SUMMON_TYPE_ADVANCE,POS_FACEUP,tp,e) then v:SetTarget(s.chtg(tg,tc)) end
end
end
if not (tc:IsAbleToHand() or tc:IsSummonable(true,nil,1) or c:IsMSetable(true,nil,1)) or not Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,tc,REASON_EFFECT) or not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end
if Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_EFFECT+REASON_DISCARD,tc)==0 then return end
if not tc:IsLocation(LOCATION_HAND) then Duel.SendtoHand(tc,nil,REASON_EFFECT) else
local s1=tc:IsSummonable(true,nil,1)
local s2=tc:IsMSetable(true,nil,1)
if (s1 and s2 and Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) or not s2 then