--created & coded by Swag local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) c:EnableReviveLimit() aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x412),4,2,nil,nil,99) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_ADD_ATTRIBUTE) e1:SetRange(LOCATION_MZONE) e1:SetValue(ATTRIBUTE_DARK) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_ADD_RACE) e2:SetRange(LOCATION_MZONE) e2:SetValue(RACE_WARRIOR) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(s.stcon) e3:SetTarget(s.sttg) e3:SetOperation(s.stop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCost(s.drcost) e4:SetTarget(s.drtg) e4:SetOperation(s.drop) c:RegisterEffect(e4) end function s.sparkfilter(c) return c:IsCode(id-8) end function s.filter(c,e,tp) if c:IsType(TYPE_MONSTER) then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 else return c:IsSSetable(true) and (c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) end end function s.stcon(e,tp) return Duel.IsExistingMatchingCard(s.sparkfilter,tp,LOCATION_GRAVE,0,1,nil) end function s.sttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp) if g:GetFirst():IsType(TYPE_MONSTER) then Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) else Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end end function s.stop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end if tc:IsType(TYPE_MONSTER) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) elseif (tc:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then Duel.SSet(tp,tc) Duel.ConfirmCards(1-tp,tc) end end function s.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,2,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,2,2,REASON_COST) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.olfilter(c,typ) return c:IsCanOverlay() and c:IsType(typ) end function s.drop(e,tp,eg,ep,ev,re,r,rp) if Duel.Draw(tp,1,REASON_EFFECT)==0 then return end local dc=Duel.GetOperatedGroup():GetFirst() Duel.ConfirmCards(1-tp,dc) Duel.ShuffleHand(tp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.olfilter),tp,0,LOCATION_GRAVE,nil,dc:GetType()&0x7) if #g>0 and c:IsRelateToEffect(e) and Duel.SelectEffectYesNo(tp,c) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local sg=g:Select(tp,1,1,nil) Duel.Overlay(c,sg) end end