--created by Walrus, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddOrigEvoluteType(c) aux.AddEvoluteProc(c,nil,8,s.mfilter,2,function(c,tp,g) return g:IsExists(Card.IsSetCard,1,nil,0xc97) end) c:SetUniqueOnField(1,0,id) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.tgcon) e1:SetValue(s.efilter) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DISABLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,LOCATION_MZONE+LOCATION_GRAVE) e2:SetTarget(s.disable) c:RegisterEffect(e2) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,id+100) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCost(s.cost) e4:SetTarget(s.tg) e4:SetOperation(s.op) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_PHASE+PHASE_STANDBY) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1,id+200) e5:SetCondition(function(e,tp) return Duel.GetTurnPlayer()==tp end) e5:SetCost(s.dcost) e5:SetOperation(s.regop) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e6:SetCode(EVENT_LEAVE_FIELD) e6:SetCountLimit(1,id+300) e6:SetCategory(CATEGORY_SPECIAL_SUMMON) e6:SetCondition(s.con) e6:SetTarget(s.acttg) e6:SetOperation(s.actop) c:RegisterEffect(e6) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_REMOVE) e3:SetCountLimit(1,id) e3:SetCategory(CATEGORY_TODECK) e3:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return re and re:GetHandler():IsSetCard(0xc97) and e:GetHandler():IsReason(REASON_EFFECT) end) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end function s.mfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_FIEND) end function s.tgfilter(c) return c:IsFaceup() and c:IsSetCard(0x3c97) end function s.tgcon(e) return Duel.IsExistingMatchingCard(s.tgfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.efilter(e,re) return e:GetOwnerPlayer()~=re:GetOwnerPlayer() end function s.disable(e,c) return (c:IsType(TYPE_EFFECT) or bit.band(c:GetOriginalType(),TYPE_EFFECT)==TYPE_EFFECT) and c:IsType(TYPE_EVOLUTE) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanRemoveEC(tp,2,REASON_COST) end c:RemoveEC(tp,2,REASON_COST) end function s.filter(c) return c:IsSetCard(0xac97) and c:IsSSetable() and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and s.cfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil):GetFirst() if tc:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,tc,1,0,0) end end function s.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SSet(tp,tc) end end function s.dcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Damage(tp,2000,REASON_COST) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e2:SetTargetRange(LOCATION_SZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0xac97)) e2:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e2,tp) end function s.con(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_EVOLUTE) and r&REASON_EFFECT+REASON_BATTLE~=0 and (r&REASON_BATTLE~=0 or rp~=tp) end function s.filter1(c,ft) if (c:GetType()&TYPE_EQUIP+TYPE_CONTINUOUS~=0 or c:IsHasEffect(EFFECT_REMAIN_FIELD)) and ft<=0 then return false end return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:CheckActivateEffect(false,false,false) and c:IsSetCard(0xac97) end function s.acttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_DECK,0,1,nil,Duel.GetLocationCount(tp,LOCATION_SZONE)) end end function s.actop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) Duel.Hint(HINT_SELECTMSG,tp,566) local sg=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_DECK,0,1,1,nil,ft) local tc=sg:GetFirst() if not tc then return end Duel.BreakEffect() local tpe=tc:GetType() local te=tc:GetActivateEffect() local tg=te:GetTarget() local co=te:GetCost() local op=te:GetOperation() e:SetCategory(te:GetCategory()) e:SetProperty(te:GetProperty()) Duel.ClearTargetCard() if ft<=0 then Duel.ConfirmCards(1-tp,tc) end Duel.MoveToField(tc,tp,tp,tc:IsType(TYPE_FIELD) and LOCATION_FZONE or LOCATION_SZONE,POS_FACEUP,true) tc:CancelToGrave(tpe&TYPE_FIELD~=0) tc:CreateEffectRelation(te) if co then co(te,tp,eg,ep,ev,re,r,rp,1) end if tg then tg(te,tp,eg,ep,ev,re,r,rp,1) end Duel.BreakEffect() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if g then for etc in aux.Next(g) do etc:CreateEffectRelation(te) end end if op then op(te,tp,eg,ep,ev,re,r,rp) end tc:ReleaseEffectRelation(te) if g then for etc in aux.Next(g) do etc:ReleaseEffectRelation(te) end end if not tc:IsOnField() then Duel.SendtoGrave(tc,REASON_RULE) end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Damage(tp,1000,REASON_EFFECT) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.BreakEffect() Duel.SendtoDeck(c,nil,0,REASON_EFFECT) end end