SethDragonheart5901

Call of the Shadow NOVA Script (Written by chatgpt)

Jun 30th, 2023 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. -- Call of the Shadow NOVA
  2. local s, id = GetID(19822)
  3.  
  4. function s.initial_effect(c)
  5. -- Activate
  6. local e1 = Effect.CreateEffect(c)
  7. e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  8. e1:SetType(EFFECT_TYPE_ACTIVATE)
  9. e1:SetCode(EVENT_FREE_CHAIN)
  10. e1:SetCountLimit(1, id)
  11. e1:SetTarget(s.activate)
  12. e1:SetOperation(s.activate)
  13. c:RegisterEffect(e1)
  14.  
  15. -- GY effect
  16. local e2 = Effect.CreateEffect(c)
  17. e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  18. e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  19. e2:SetCode(EVENT_PHASE + PHASE_END)
  20. e2:SetRange(LOCATION_GRAVE)
  21. e2:SetCountLimit(1, id+100)
  22. e2:SetCondition(s.gyCondition)
  23. e2:SetTarget(s.gyTarget)
  24. e2:SetOperation(s.gyOperation)
  25. c:RegisterEffect(e2)
  26. end
  27.  
  28. function s.filter(c)
  29. return c:IsSetCard(0x123) and c:IsAbleToHand()
  30. end
  31.  
  32. function s.activate(e, tp, eg, ep, ev, re, r, rp)
  33. if not e:GetHandler():IsRelateToEffect(e) then
  34. return
  35. end
  36.  
  37. local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil)
  38. if g:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  39. Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  40. local sg = g:Select(tp, 1, 1, nil)
  41. Duel.SendtoHand(sg, nil, REASON_EFFECT)
  42. Duel.ConfirmCards(1 - tp, sg)
  43. e:SetLabel(1) -- Set a flag to indicate the activation of the first effect
  44. end
  45. end
  46.  
  47. function s.gyCondition(e, tp, eg, ep, ev, re, r, rp)
  48. return Duel.GetTurnPlayer() ~= tp and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
  49. end
  50.  
  51. function s.gyTarget(e, tp, eg, ep, ev, re, r, rp, chk)
  52. if chk == 0 then
  53. return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  54. end
  55. Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  56. end
  57.  
  58. function s.gyOperation(e, tp, eg, ep, ev, re, r, rp)
  59. if not e:GetHandler():IsRelateToEffect(e) then
  60. return
  61. end
  62.  
  63. if e:GetLabel() == 1 then
  64. e:SetLabel(0) -- Reset the flag
  65. return
  66. end
  67.  
  68. local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil)
  69. if g:GetCount() > 0 then
  70. Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  71. local sg = g:Select(tp, 1, 1, nil)
  72. Duel.SendtoHand(sg, nil, REASON_EFFECT)
  73. Duel.ConfirmCards(1 - tp, sg)
  74. end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment