--Philia, Amministrale della Luce --created by ZEN, coded by ZEN & Lyris local cid,id=GetID() function cid.initial_effect(c) --spproc local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e1:SetCondition(cid.spcon) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetCost(cid.descost) e2:SetTarget(cid.destg) e2:SetOperation(cid.desop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:Desc(2) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_TO_GRAVE) e3:SetCategory(CATEGORY_DESTROY) e3:SetCountLimit(1,id+200) e3:SetCondition(cid.des2con) e3:SetTarget(cid.des2tg) e3:SetOperation(cid.des2op) c:RegisterEffect(e3) end function cid.cfilter(c) return c:IsSetCard(0xd7c) and c:IsFaceup() and c:GetSequence()<5 end function cid.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cid.cfilter,tp,LOCATION_SZONE,0,1,nil) end function cid.filter(c) return not c:IsLocation(LOCATION_MZONE) or c:IsFaceup() end function cid.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and cid.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,cid.filter,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function cid.costfilter(c) return c:IsSetCard(0xd7c) and c:IsFaceup() and c:IsAbleToGraveAsCost() and c:GetSequence()<5 end function cid.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.costfilter,tp,LOCATION_SZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cid.costfilter,tp,LOCATION_SZONE,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_COST) end end function cid.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToChain() then Duel.Destroy(tc,REASON_EFFECT) end end function cid.des2con(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_COST) and e:GetHandler():IsPreviousLocation(LOCATION_SZONE) and e:GetHandler():GetPreviousSequence()<5 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0xd7c) end function cid.des2tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function cid.des2op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToChain() then Duel.Destroy(tc,REASON_EFFECT) end end