--created by Ace, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(0) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetCost(s.cost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,id) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetCondition(s.con) e3:SetTarget(s.tg) e3:SetOperation(s.op) c:RegisterEffect(e3) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() end Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD) end function s.filter(c) return c:IsCode(21208154) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil):GetFirst() if Duel.SendtoHand(tc,nil,REASON_EFFECT)==0 or not tc:IsLocation(LOCATION_HAND) then return end Duel.ConfirmCards(1-tp,tc) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_LIMIT_SUMMON_PROC) e1:SetCondition(s.ttcon) e1:SetOperation(s.ttop) e1:SetValue(SUMMON_TYPE_ADVANCE) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END-RESET_TOFIELD) tc:RegisterEffect(e1,true) end function s.ttcon(e,c,minc) if c==nil then return true end return minc<=2 and Duel.CheckTribute(c,2) end function s.ttop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectTribute(tp,c,2,2) c:SetMaterial(g) Duel.Release(g,REASON_SUMMON+REASON_MATERIAL) end function s.con(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(function(c) return c:IsCode(21208154) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) end,1,nil) and rp==1-tp end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)==0 then return end c:CompleteProcedure() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(0,1) e1:SetValue(aux.TargetBoolFunction(Effect.IsActiveType,TYPE_MONSTER)) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end