Advertisement
Yamian

c999999997.lua (YGOPRO-Eye of Illusion)

Apr 10th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. --Eye of Illusion
  2. --COPYRIGHT by YAMI AN
  3. function c999999997.initial_effect(c)
  4.     --Activate
  5.     local e1=Effect.CreateEffect(c)
  6.     e1:SetCategory(CATEGORY_CONTROL)
  7.     e1:SetType(EFFECT_TYPE_ACTIVATE)
  8.     e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  9.     e1:SetCode(EVENT_FREE_CHAIN)
  10.     e1:SetCondition(c999999997.condition)
  11.     e1:SetTarget(c999999997.target)
  12.     e1:SetOperation(c999999997.activate)
  13.     c:RegisterEffect(e1)
  14. end
  15. function c999999997.cfilter(c)
  16.     return c:IsFaceup() and c:IsType(TYPE_MONSTER)
  17. end
  18. function c999999997.condition(e,tp,eg,ep,ev,re,r,rp)
  19.     return Duel.IsExistingMatchingCard(c999999997.cfilter,tp,LOCATION_MZONE,0,1,nil)
  20. end
  21. function c999999997.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
  22.     if chkc then
  23.         return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsControlerCanBeChanged()
  24.     end
  25.     if chk==0 then
  26.         return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,nil)
  27.     end
  28.     Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
  29.     local g=Duel.SelectTarget(tp,Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,1,nil)
  30.     Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
  31. end
  32. function c999999997.activate(e,tp,eg,ep,ev,re,r,rp)
  33.     local tc=Duel.GetFirstTarget()
  34.     if tc and tc:IsRelateToEffect(e) then
  35.         Duel.GetControl(tc,tp,PHASE_END,0)
  36.     end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement