Advertisement
Guest User

Untitled

a guest
Feb 7th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. function c900000389.initial_effect(c)
  2. --Activate
  3. local e1=Effect.CreateEffect(c)
  4. e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  5. e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  6. e1:SetType(EFFECT_TYPE_ACTIVATE)
  7. e1:SetCode(EVENT_FREE_CHAIN)
  8. e1:SetTarget(c900000389.target)
  9. e1:SetOperation(c900000389.activate)
  10. c:RegisterEffect(e1)
  11. end
  12. function c900000389.filter(c,e,tp)
  13. return c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
  14. end
  15. function c900000389.xyzfilter(c,mg)
  16. return c:IsXyzSummonable(mg,2,2)
  17. end
  18. function c900000389.mfilter1(c,mg,exg)
  19. return mg:IsExists(c900000389.mfilter2,1,c,c,exg)
  20. end
  21. function c900000389.mfilter2(c,mc,exg)
  22. return exg:IsExists(Card.IsXyzSummonable,1,nil,Group.FromCards(c,mc))
  23. end
  24. function c900000389.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
  25. if chkc then return false end
  26. local mg=Duel.GetMatchingGroup(c900000389.filter,tp,LOCATION_GRAVE,0,nil,e,tp)
  27. local exg=Duel.GetMatchingGroup(c900000389.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
  28. if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2)
  29. and not Duel.IsPlayerAffectedByEffect(tp,59822133)
  30. and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
  31. and exg:GetCount()>0 end
  32. Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
  33. local sg1=mg:FilterSelect(tp,c900000389.mfilter1,1,1,nil,mg,exg)
  34. local tc1=sg1:GetFirst()
  35. Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
  36. local sg2=mg:FilterSelect(tp,c900000389.mfilter2,1,1,tc1,tc1,exg)
  37. sg1:Merge(sg2)
  38. Duel.SetTargetCard(sg1)
  39. Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0)
  40. end
  41. function c900000389.filter2(c,e,tp)
  42. return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
  43. end
  44. function c900000389.activate(e,tp,eg,ep,ev,re,r,rp)
  45. if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
  46. if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
  47. local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(c900000389.filter2,nil,e,tp)
  48. if g:GetCount()<2 then return end
  49. Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
  50. Duel.BreakEffect()
  51. local xyzg=Duel.GetMatchingGroup(c900000389.xyzfilter,tp,LOCATION_EXTRA,0,nil,g)
  52. if xyzg:GetCount()>0 then
  53. Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
  54. local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
  55. Duel.XyzSummon(tp,xyz,g)
  56. end
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement