--Arcarum XX - IL GIUDIZIO --Script by XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() --spsummon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(cid.spcon) e1:SetCost(cid.spcost) e1:SetTarget(cid.sptg) e1:SetOperation(cid.spop) c:RegisterEffect(e1) --wipe backrow local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PHASE+PHASE_STANDBY) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetCondition(cid.drycon) e2:SetTarget(cid.drytg) e2:SetOperation(cid.dryop) c:RegisterEffect(e2) --wipe field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id+200) e3:SetCondition(cid.wpcon) e3:SetCost(cid.wpcost) e3:SetTarget(cid.wptg) e3:SetOperation(cid.wpop) c:RegisterEffect(e3) --draw local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,3)) e4:SetCategory(CATEGORY_DRAW) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCode(EVENT_PHASE+PHASE_STANDBY) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1,id+300) e4:SetCondition(cid.drawcon) e4:SetTarget(cid.drawtg) e4:SetOperation(cid.drawop) c:RegisterEffect(e4) end --filters function cid.filter(c) return c:IsFaceup() and c:GetLevel()>=7 and c:IsType(TYPE_MONSTER) and c:IsSetCard(0x5477) end --spsummon self function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==1 end function cid.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end if Duel.GetCurrentPhase()==PHASE_STANDBY and Duel.GetTurnPlayer()==tp then e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN-RESET_TOFIELD,0,2,Duel.GetTurnCount()) else e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN-RESET_TOFIELD,0,1,0) end end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)~=0 then c:CompleteProcedure() end end --wipe backrow function cid.drycon(e,tp,eg,ep,ev,re,r,rp) local tid=e:GetHandler():GetFlagEffectLabel(id) return tid and tid~=Duel.GetTurnCount() and Duel.GetTurnPlayer()==tp end function cid.drytg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_SZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function cid.dryop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_SZONE,nil) Duel.Destroy(g,REASON_EFFECT) end --wipe field function cid.wpcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end function cid.wpcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsOnField() and e:GetHandler():IsReleasable() end Duel.Release(e:GetHandler(),REASON_COST) if Duel.GetCurrentPhase()==PHASE_STANDBY and Duel.GetTurnPlayer()~=tp then e:GetHandler():RegisterFlagEffect(id+100,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY+RESET_OPPO_TURN,0,2,Duel.GetTurnCount()) else e:GetHandler():RegisterFlagEffect(id+100,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY+RESET_OPPO_TURN,0,1,0) end end function cid.wptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0) end function cid.wpop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_MZONE,nil) Duel.SendtoGrave(g,REASON_EFFECT) end --draw function cid.drawcon(e,tp,eg,ep,ev,re,r,rp) local tid=e:GetHandler():GetFlagEffectLabel(id+100) local t=Duel.GetFieldGroupCount(tp,0,LOCATION_HAND) local s=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0) return tid and tid~=Duel.GetTurnCount() and Duel.GetTurnPlayer()~=tp and t>s end function cid.drawtg(e,tp,eg,ep,ev,re,r,rp,chk) local t=Duel.GetFieldGroupCount(tp,0,LOCATION_HAND) local s=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0) if chk==0 then return t>s and Duel.IsPlayerCanDraw(tp,t-s) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(t-s) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,t-s) end function cid.drawop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local t=Duel.GetFieldGroupCount(p,0,LOCATION_HAND) local s=Duel.GetFieldGroupCount(p,LOCATION_HAND,0) if t>s then Duel.Draw(p,t-s,REASON_EFFECT) end end