Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. --Protector of Exodia 210545404
  2. function c210545404.initial_effect(c)
  3. --xyz summon
  4. aux.AddXyzProcedure(c,nil,1,2,c210545404.ovfilter,aux.Stringid(210545404,0),2,c210545404.xyzop)
  5. c:EnableReviveLimit()
  6. --cannot be target
  7. local e1=Effect.CreateEffect(c)
  8. e1:SetType(EFFECT_TYPE_SINGLE)
  9. e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  10. e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  11. e1:SetRange(LOCATION_MZONE)
  12. e1:SetValue(1)
  13. c:RegisterEffect(e1)
  14. --cannot remove
  15. local e2=Effect.CreateEffect(c)
  16. e2:SetType(EFFECT_TYPE_FIELD)
  17. e2:SetCode(EFFECT_CANNOT_REMOVE)
  18. e2:SetRange(LOCATION_MZONE)
  19. e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  20. e2:SetTargetRange(1,1)
  21. c:RegisterEffect(e2)
  22. --atkup
  23. local e3=Effect.CreateEffect(c)
  24. e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_ATKCHANGE)
  25. e3:SetType(EFFECT_TYPE_IGNITION)
  26. e3:SetRange(LOCATION_MZONE)
  27. e3:SetCondition(c210545404.thcon)
  28. e3:SetCost(c210545404.cost)
  29. e3:SetTarget(c210545404.tdtg)
  30. e3:SetOperation(c210545404.tdop)
  31. c:RegisterEffect(e3)
  32. --spsummon
  33. local e4=Effect.CreateEffect(c)
  34. e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
  35. e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
  36. e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
  37. e4:SetCode(EVENT_TO_GRAVE)
  38. e4:SetCondition(c210545404.spcon)
  39. e4:SetTarget(c210545404.sptg)
  40. e4:SetOperation(c210545404.spop)
  41. c:RegisterEffect(e4)
  42.  
  43. end
  44. function c210545404.cfilter(c)
  45. return (c:IsSetCard(0x40) and c:IsType(TYPE_MONSTER)) or c:IsSetCard(0xde) and c:IsAbleToGraveAsCost()
  46. end
  47. function c210545404.ovfilter(c)
  48. return c:IsFaceup() and c:IsSetCard(0x40)
  49. end
  50. function c210545404.xyzop(e,tp,chk)
  51. if chk==0 then return Duel.IsExistingMatchingCard(c210545404.cfilter,tp,LOCATION_HAND,0,1,nil) end
  52. Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
  53. local tc=Duel.GetMatchingGroup(c210545404.cfilter,tp,LOCATION_HAND,0,nil):SelectUnselect(Group.CreateGroup(),tp,aux.ProcCancellable,aux.ProcCancellable)
  54. if tc then
  55. Duel.SendtoGrave(tc,REASON_COST)
  56. e:GetHandler():RegisterFlagEffect(210545404,RESET_EVENT+0xfe0000+RESET_PHASE+PHASE_END,0,1)
  57. return true
  58. else return false end
  59. end
  60. function c210545404.thcon(e,tp,eg,ep,ev,re,r,rp)
  61. return e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard,1,nil,0x40)
  62. end
  63. function c210545404.cost(e,tp,eg,ep,ev,re,r,rp,chk)
  64. if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
  65. e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
  66. end
  67. function c210545404.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
  68. if chk==0 then return true end
  69. Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,PLAYER_ALL,LOCATION_REMOVED)
  70. end
  71. function c210545404.tdop(e,tp,eg,ep,ev,re,r,rp)
  72. local c=e:GetHandler()
  73. local g=Duel.GetFieldGroup(tp,LOCATION_REMOVED,LOCATION_REMOVED)
  74. Duel.SendtoGrave(g,REASON_EFFECT+REASON_RETURN)
  75. if c:IsFaceup() and c:IsRelateToEffect(e) then
  76. local e1=Effect.CreateEffect(c)
  77. e1:SetType(EFFECT_TYPE_SINGLE)
  78. e1:SetCode(EFFECT_UPDATE_ATTACK)
  79. e1:SetReset(RESET_EVENT+0x1ff0000)
  80. e1:SetValue(g:GetCount()*100)
  81. c:RegisterEffect(e1)
  82. end
  83. end
  84. function c210545404.spcon(e,tp,eg,ep,ev,re,r,rp)
  85. local c=e:GetHandler()
  86. return c:GetPreviousControler()==tp and rp==1-tp and c:IsReason(REASON_DESTROY)
  87. end
  88. function c210545404.spfilter(c,e,tp)
  89. return c:IsSetCard(0xde) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
  90. end
  91. function c210545404.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
  92. if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
  93. and Duel.IsExistingMatchingCard(c210545404.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
  94. Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
  95. end
  96. function c210545404.spop(e,tp,eg,ep,ev,re,r,rp)
  97. if Duel.GetLocationCountFromEx(tp)<=0 then return end
  98. Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
  99. local g=Duel.SelectMatchingCard(tp,c210545404.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
  100. if g:GetCount()>0 then
  101. Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
  102. end
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement