Advertisement
Yamian

c999999994.lua (YGOPRO-Mirror Force)

Apr 24th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. --Mirror Force
  2. --COPYRIGHT by YAMI AN
  3. function c999999994.initial_effect(c)
  4.     --Activate
  5.     local e1=Effect.CreateEffect(c)
  6.     e1:SetCategory(CATEGORY_DESTROY)
  7.     e1:SetType(EFFECT_TYPE_ACTIVATE)
  8.     e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  9.     e1:SetCondition(c999999994.condition)
  10.     e1:SetTarget(c999999994.target)
  11.     e1:SetOperation(c999999994.activate)
  12.     c:RegisterEffect(e1)
  13. end
  14. function c999999994.condition(e,tp,eg,ep,ev,re,r,rp)
  15.     return tp~=Duel.GetTurnPlayer()
  16. end
  17. function c999999994.filter(c)
  18.     return c:IsAttackPos() and c:IsDestructable()
  19. end
  20. function c999999994.target(e,tp,eg,ep,ev,re,r,rp,chk)
  21.     if chk==0 then
  22.         return Duel.IsExistingMatchingCard(c999999994.filter,tp,0,LOCATION_MZONE,1,nil)
  23.     end
  24.     local g=Duel.GetMatchingGroup(c999999994.filter,tp,0,LOCATION_MZONE,nil)
  25.     Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
  26. end
  27. function c999999994.activate(e,tp,eg,ep,ev,re,r,rp)
  28.     local bc=Duel.GetAttacker()
  29.     for i=0,4 do
  30.         local tc=Duel.GetFieldCard(1-tp,LOCATION_MZONE,i)
  31.         if  tc and tc:IsAttackPos() and tc:IsFaceup() then
  32.             local atk=tc:GetAttack()
  33.             if atk<bc:GetAttack() then
  34.                 Duel.Damage(1-tp,bc:GetAttack()-atk,REASON_BATTLE)
  35.             end
  36.             if atk>bc:GetAttack() then
  37.                 Duel.Damage(1-tp,atk-bc:GetAttack(),REASON_BATTLE)
  38.             end
  39.         end
  40.     end
  41.     local g=Duel.GetMatchingGroup(c999999994.filter,tp,0,LOCATION_MZONE,nil)
  42.     if g:GetCount()>0 then
  43.         Duel.Destroy(g,REASON_EFFECT)
  44.     end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement