--Arcane Surpassment function c249000699.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCost(c249000699.cost) e1:SetTarget(c249000699.target) e1:SetOperation(c249000699.activate) c:RegisterEffect(e1) --code local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_SETCODE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_GRAVE+LOCATION_REMOVED) e2:SetValue(0x1E6) c:RegisterEffect(e2) end function c249000699.costfilter(c) return c:IsSetCard(0x1E6) and c:IsAbleToRemoveAsCost() and c:IsType(TYPE_MONSTER) end function c249000699.costfilter2(c,e) return c:IsSetCard(0x1E6) and c:IsType(TYPE_MONSTER) and not c:IsPublic() end function c249000699.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return (Duel.IsExistingMatchingCard(c249000699.costfilter,tp,LOCATION_GRAVE,0,1,nil) or Duel.IsExistingMatchingCard(c249000699.costfilter2,tp,LOCATION_HAND,0,1,c)) end local option if Duel.IsExistingMatchingCard(c249000699.costfilter2,tp,LOCATION_HAND,0,1,c) then option=0 end if Duel.IsExistingMatchingCard(c249000699.costfilter,tp,LOCATION_GRAVE,0,1,nil) then option=1 end if Duel.IsExistingMatchingCard(c249000699.costfilter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsExistingMatchingCard(c249000699.costfilter2,tp,LOCATION_HAND,0,1,c) then option=Duel.SelectOption(tp,526,1102) end if option==0 then g=Duel.SelectMatchingCard(tp,c249000699.costfilter2,tp,LOCATION_HAND,0,1,1,c) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end if option==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c249000699.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end end function c249000699.tfilter(c,att,race,e,tp) return c:IsSetCard(0x1E7) and c:IsAttribute(att) and c:IsRace(race) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function c249000699.filter(c,e,tp) return c:IsFaceup() and c:IsSetCard(0x1E6) and Duel.IsExistingMatchingCard(c249000699.tfilter,tp,LOCATION_EXTRA,0,1,nil,c:GetOriginalAttribute(),c:GetOriginalRace(),e,tp) and Duel.GetLocationCountFromEx(tp,tp,c)>0 end function c249000699.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c:IsFaceup() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingTarget(c249000699.filter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,c249000699.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) e:SetLabel(g:GetFirst():GetAttribute()) end function c249000699.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local att=tc:GetOriginalAttribute() local race=tc:GetOriginalRace() if Duel.SendtoGrave(tc,REASON_EFFECT)==0 then return end if Duel.GetLocationCountFromEx(tp)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,c249000698.tfilter,tp,LOCATION_EXTRA,0,1,1,nil,att,race,e,tp) if sg:GetCount()>0 then Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,true,true,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(c249000699.efilter) sg:GetFirst():RegisterEffect(e1,true) sg:GetFirst():CompleteProcedure() end end function c249000699.efilter(e,te) return te:IsActiveType(TYPE_TRAP) end