Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Protector of Exodia 210545404
- function c210545404.initial_effect(c)
- --xyz summon
- aux.AddXyzProcedure(c,nil,1,2,c210545404.ovfilter,aux.Stringid(210545404,0),2,c210545404.xyzop)
- c:EnableReviveLimit()
- --cannot be target
- local e1=Effect.CreateEffect(c)
- e1:SetType(EFFECT_TYPE_SINGLE)
- e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
- e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
- e1:SetRange(LOCATION_MZONE)
- e1:SetValue(1)
- c:RegisterEffect(e1)
- --cannot remove
- local e2=Effect.CreateEffect(c)
- e2:SetType(EFFECT_TYPE_FIELD)
- e2:SetCode(EFFECT_CANNOT_REMOVE)
- e2:SetRange(LOCATION_MZONE)
- e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
- e2:SetTargetRange(1,1)
- c:RegisterEffect(e2)
- --atkup
- local e3=Effect.CreateEffect(c)
- e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_ATKCHANGE)
- e3:SetType(EFFECT_TYPE_IGNITION)
- e3:SetRange(LOCATION_MZONE)
- e3:SetCondition(c210545404.thcon)
- e3:SetCost(c210545404.cost)
- e3:SetTarget(c210545404.tdtg)
- e3:SetOperation(c210545404.tdop)
- c:RegisterEffect(e3)
- --spsummon
- local e4=Effect.CreateEffect(c)
- e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
- e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
- e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
- e4:SetCode(EVENT_TO_GRAVE)
- e4:SetCondition(c210545404.spcon)
- e4:SetTarget(c210545404.sptg)
- e4:SetOperation(c210545404.spop)
- c:RegisterEffect(e4)
- end
- function c210545404.cfilter(c)
- return (c:IsSetCard(0x40) and c:IsType(TYPE_MONSTER)) or c:IsSetCard(0xde) and c:IsAbleToGraveAsCost()
- end
- function c210545404.ovfilter(c)
- return c:IsFaceup() and c:IsSetCard(0x40)
- end
- function c210545404.xyzop(e,tp,chk)
- if chk==0 then return Duel.IsExistingMatchingCard(c210545404.cfilter,tp,LOCATION_HAND,0,1,nil) end
- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
- local tc=Duel.GetMatchingGroup(c210545404.cfilter,tp,LOCATION_HAND,0,nil):SelectUnselect(Group.CreateGroup(),tp,aux.ProcCancellable,aux.ProcCancellable)
- if tc then
- Duel.SendtoGrave(tc,REASON_COST)
- e:GetHandler():RegisterFlagEffect(210545404,RESET_EVENT+0xfe0000+RESET_PHASE+PHASE_END,0,1)
- return true
- else return false end
- end
- function c210545404.thcon(e,tp,eg,ep,ev,re,r,rp)
- return e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard,1,nil,0x40)
- end
- function c210545404.cost(e,tp,eg,ep,ev,re,r,rp,chk)
- if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
- e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
- end
- function c210545404.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
- if chk==0 then return true end
- Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,PLAYER_ALL,LOCATION_REMOVED)
- end
- function c210545404.tdop(e,tp,eg,ep,ev,re,r,rp)
- local c=e:GetHandler()
- local g=Duel.GetFieldGroup(tp,LOCATION_REMOVED,LOCATION_REMOVED)
- Duel.SendtoGrave(g,REASON_EFFECT+REASON_RETURN)
- if c:IsFaceup() and c:IsRelateToEffect(e) then
- local e1=Effect.CreateEffect(c)
- e1:SetType(EFFECT_TYPE_SINGLE)
- e1:SetCode(EFFECT_UPDATE_ATTACK)
- e1:SetReset(RESET_EVENT+0x1ff0000)
- e1:SetValue(g:GetCount()*100)
- c:RegisterEffect(e1)
- end
- end
- function c210545404.spcon(e,tp,eg,ep,ev,re,r,rp)
- local c=e:GetHandler()
- return c:GetPreviousControler()==tp and rp==1-tp and c:IsReason(REASON_DESTROY)
- end
- function c210545404.spfilter(c,e,tp)
- return c:IsSetCard(0xde) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
- end
- function c210545404.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
- if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
- and Duel.IsExistingMatchingCard(c210545404.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
- Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
- end
- function c210545404.spop(e,tp,eg,ep,ev,re,r,rp)
- if Duel.GetLocationCountFromEx(tp)<=0 then return end
- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
- local g=Duel.SelectMatchingCard(tp,c210545404.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
- if g:GetCount()>0 then
- Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement