arcagamer

link edopro card testing needed

Mar 8th, 2023
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.39 KB | None | 0 0
  1. --Link
  2. local s,id=GetID()
  3. function s.initial_effect(c)
  4.     --atk up
  5.     local e1=Effect.CreateEffect(c)
  6.     e1:SetType(EFFECT_TYPE_SINGLE)
  7.     e1:SetCode(EFFECT_UPDATE_ATTACK)
  8.     e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  9.     e1:SetRange(LOCATION_MZONE)
  10.     e1:SetValue(s.atkval)
  11.     c:RegisterEffect(e1)
  12.     --equip
  13.     local e2=Effect.CreateEffect(c)
  14.     e2:SetDescription(aux.Stringid(id,0))
  15.     e2:SetCategory(CATEGORY_EQUIP)
  16.     e2:SetType(EFFECT_TYPE_IGNITION)
  17.     e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_NO_TURN_RESET)
  18.     e2:SetRange(LOCATION_MZONE)
  19.     e2:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) --to prevent using the effect more than once per turn
  20.     e2:SetTarget(s.eqtg) --the function that checks if the effect can be activated
  21.     e2:SetOperation(s.eqop) --the function that performs the effect
  22.     c:RegisterEffect(e2)   
  23. end
  24.  
  25. function s.atkval(e,c) --the function that calculates the ATK gain
  26.     return c:GetEquipCount()*300
  27. end
  28.  
  29. function s.filter(c) --the filter for valid targets to equip
  30.     return c:IsFaceup() and c:IsControler(1-e:GetHandlerPlayer())
  31. end
  32.  
  33. function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) --the target function for the equip effect
  34.     if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end --if there is a previous target, check if it is valid
  35.     if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 --check if there is a free Spell/Trap Zone to equip to
  36.         and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end --check if there is a valid target to equip from the opponent's field
  37.     Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) --prompt the player to select a target
  38.     local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) --select one target from the opponent's field
  39.     Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) --declare that this effect will equip a card
  40. end
  41.  
  42. function s.eqlimit(e,c) --the function that limits what can be equipped by this effect (only Link itself in this case)
  43.     return e:GetOwner()==c
  44. end
  45.  
  46. function s.eqop(e,tp,eg,ep,ev,re,r,rp)  --the operation function for the equip effect  
  47.     local c=e:GetHandler()  --get Link itself as a local variable c
  48.     if not c:IsRelateToEffect(e) or c:IsFacedown() then return end  --if Link is not on the field or face-down when resolving the effect, do nothing   
  49.     local tc=Duel.GetFirstTarget()  --get the first (and only) target as a local variable tc   
  50.     if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(1-tp) then    --if the target still exists and meets all conditions      
  51.         if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end  --if there is no free Spell/Trap Zone to equip to, do nothing      
  52.         Duel.Equip(tp,tc,c,false,true,true,true,e:GetHandler())     --equip tc to Link without triggering other effects    
  53.         local atk=tc:GetTextAttack()/2  --get half of tc's original ATK as a local variable atk    
  54.         if atk<0 then atk=0 end     --if atk is negative (for some reason), set it to zero     
  55.         local e3=Effect.CreateEffect(c)--create an Equip Effect that gives Link extra ATK equal to half of tc's original ATK       
  56.          e3:SetType(EFFECT_TYPE_EQUIP)--set its type as Equip Effect       
  57.          e3:SetCode(EFFECT_UPDATE_ATTACK)--set its code as updating ATK    
  58.          e3:SetValue(atk)--set its value as atk    
  59.          e3:SetReset(RESET_EVENT+RESETS_STANDARD)--reset it when it leaves the field or changes control    
  60.          tc:RegisterEffect(e3)--register it on tc              
  61.     end
  62.     Duel.EquipComplete()    --complete equipping process   
  63. end
Advertisement
Add Comment
Please, Sign In to add comment