Advertisement
shadowx320

17690501.lua

May 5th, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. --Odd Eyes Raging Light Dragon
  2. function c17690501.initial_effect(c)
  3. --xyz summon
  4. aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_DRAGON),7,2)
  5. c:EnableReviveLimit()
  6. --pendulum summon
  7. aux.EnablePendulumAttribute(c,false)
  8. --pendulum set
  9. local e1=Effect.CreateEffect(c)
  10. e1:SetDescription(aux.Stringid(17690501,0))
  11. e1:SetType(EFFECT_TYPE_IGNITION)
  12. e1:SetRange(LOCATION_PZONE)
  13. e1:SetCountLimit(1)
  14. e1:SetTarget(c17690501.pctg)
  15. e1:SetOperation(c17690501.pcop)
  16. c:RegisterEffect(e1)
  17. --summon success
  18. local e2=Effect.CreateEffect(c)
  19. e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
  20. e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  21. e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  22. e2:SetCondition(c17690501.regcon)
  23. e2:SetOperation(c17690501.regop)
  24. c:RegisterEffect(e2)
  25. local e3=Effect.CreateEffect(c)
  26. e3:SetType(EFFECT_TYPE_SINGLE)
  27. e3:SetCode(EFFECT_MATERIAL_CHECK)
  28. e3:SetValue(c17690501.valcheck)
  29. e3:SetLabelObject(e2)
  30. c:RegisterEffect(e3)
  31. --extra attack
  32. local e4=Effect.CreateEffect(c)
  33. e4:SetType(EFFECT_TYPE_SINGLE)
  34. e4:SetCode(EFFECT_EXTRA_ATTACK)
  35. e4:SetValue(1)
  36. e4:SetCondition(c17690501.effcon)
  37. c:RegisterEffect(e4)
  38. --destroy
  39. local e5=Effect.CreateEffect(c)
  40. e5:SetDescription(aux.Stringid(17690501,1))
  41. e5:SetCategory(CATEGORY_RECOVER)
  42. e5:SetProperty(EFFECT_FLAG2_XMDETACH)
  43. e5:SetType(EFFECT_TYPE_IGNITION)
  44. e5:SetRange(LOCATION_MZONE)
  45. e5:SetCountLimit(1)
  46. e5:SetCondition(c17690501.effcon)
  47. e5:SetCost(c17690501.descost)
  48. e5:SetTarget(c17690501.destg)
  49. e5:SetOperation(c17690501.desop)
  50. c:RegisterEffect(e5)
  51. --pendulum
  52. local e6=Effect.CreateEffect(c)
  53. e6:SetDescription(aux.Stringid(17690501,2))
  54. e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
  55. e6:SetCode(EVENT_DESTROYED)
  56. e6:SetProperty(EFFECT_FLAG_DELAY)
  57. e6:SetCondition(c17690501.pencon)
  58. e6:SetTarget(c17690501.pentg)
  59. e6:SetOperation(c17690501.penop)
  60. c:RegisterEffect(e6)
  61. end
  62. c17690501.pendulum_level=7
  63. function c17690501.pcfilter(c)
  64. return c:IsType(TYPE_PENDULUM) and not c:IsForbidden()
  65. end
  66. function c17690501.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
  67. local seq=e:GetHandler():GetSequence()
  68. if chk==0 then return Duel.CheckLocation(tp,LOCATION_SZONE,13-seq)
  69. and Duel.IsExistingMatchingCard(c17690501.pcfilter,tp,LOCATION_DECK,0,1,nil) end
  70. end
  71. function c17690501.pcop(e,tp,eg,ep,ev,re,r,rp)
  72. if not e:GetHandler():IsRelateToEffect(e) then return end
  73. local seq=e:GetHandler():GetSequence()
  74. if not Duel.CheckLocation(tp,LOCATION_SZONE,13-seq) then return end
  75. Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
  76. local g=Duel.SelectMatchingCard(tp,c17690501.pcfilter,tp,LOCATION_DECK,0,1,1,nil)
  77. if g:GetCount()>0 then
  78. Duel.MoveToField(g:GetFirst(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
  79. end
  80. end
  81. function c17690501.regcon(e,tp,eg,ep,ev,re,r,rp)
  82. return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ and e:GetLabel()==1
  83. end
  84. function c17690501.regop(e,tp,eg,ep,ev,re,r,rp)
  85. local c=e:GetHandler()
  86. c:RegisterFlagEffect(17690501,RESET_EVENT+0x1fe0000,0,1)
  87. c:RegisterFlagEffect(0,RESET_EVENT+0x1fe0000,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(17690501,3))
  88. end
  89. function c17690501.effcon(e)
  90. return e:GetHandler():GetFlagEffect(17690501)>0
  91. end
  92. function c17690501.descost(e,tp,eg,ep,ev,re,r,rp,chk)
  93. if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
  94. e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
  95. end
  96. function c17690501.destg(e,tp,eg,ep,ev,re,r,rp,chk)
  97. if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end
  98. local sg=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD)
  99. Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,sg:GetCount(),0,0)
  100. end
  101. function c17690501.desop(e,tp,eg,ep,ev,re,r,rp)
  102. local c=e:GetHandler()
  103. local sg=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD)
  104. local ct=Duel.Destroy(sg,REASON_EFFECT)
  105. if ct>0 and c:IsFaceup() and c:IsRelateToEffect(e) then
  106. local e1=Effect.CreateEffect(c)
  107. e1:SetType(EFFECT_TYPE_SINGLE)
  108. e1:SetCode(EFFECT_UPDATE_ATTACK)
  109. e1:SetValue(ct*100)
  110. e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
  111. c:RegisterEffect(e1)
  112. end
  113. end
  114. function c17690501.valcheck(e,c)
  115. local g=c:GetMaterial()
  116. if g:IsExists(Card.IsType,1,nil,TYPE_XYZ) then
  117. e:GetLabelObject():SetLabel(1)
  118. else
  119. e:GetLabelObject():SetLabel(0)
  120. end
  121. end
  122. function c17690501.pencon(e,tp,eg,ep,ev,re,r,rp)
  123. local c=e:GetHandler()
  124. return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
  125. end
  126. function c17690501.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
  127. if chk==0 then return Duel.CheckLocation(tp,LOCATION_SZONE,6) or Duel.CheckLocation(tp,LOCATION_SZONE,7) end
  128. end
  129. function c17690501.penop(e,tp,eg,ep,ev,re,r,rp)
  130. if not Duel.CheckLocation(tp,LOCATION_SZONE,6) and not Duel.CheckLocation(tp,LOCATION_SZONE,7) then return false end
  131. local c=e:GetHandler()
  132. if c:IsRelateToEffect(e) then
  133. Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
  134. end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement