Advertisement
arcagamer

Magia criativa

Mar 23rd, 2023
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.99 KB | None | 0 0
  1. Here is a possible code for your request:
  2.  
  3. ```lua
  4. -- edopro card script for a spell card with an effect
  5. local s,id,o=GetID()
  6. function s.initial_effect(c)
  7.     -- activate only if opponent controls no "titan" monsters
  8.     local e1=Effect.CreateEffect(c)
  9.     e1:SetType(EFFECT_TYPE_ACTIVATE)
  10.     e1:SetCode(EVENT_FREE_CHAIN)
  11.     e1:SetCondition(s.condition)
  12.     e1:SetTarget(s.target)
  13.     e1:SetOperation(s.activate)
  14.     c:RegisterEffect(e1)
  15. end
  16. s.listed_names={o}
  17. s.listed_series={0x123} -- change this to the setcode of "lightning" cards
  18. function s.condition(e,tp,eg,ep,ev,re,r,rp)
  19.     return not Duel.IsExistingMatchingCard(aux.FilterFaceupFunction(Card.IsSetCard,0x456),tp,0,LOCATION_MZONE,1,nil) -- change this to the setcode of "titan" monsters
  20. end
  21. function s.filter(c)
  22.     return c:IsSetCard(0x123) and c:IsAbleToHand() -- change this to the setcode of "lightning" cards
  23. end
  24. function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
  25.     if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end
  26.     Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
  27. end
  28. function s.activate(e,tp,eg,ep,ev,re,r,rp)
  29.     -- add 1 "lightning" card from deck to hand
  30.     Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
  31.     local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil)
  32.     if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then
  33.         Duel.ConfirmCards(1-tp,g)
  34.         -- banish 1 facedown card your opponent controls if you added "lightning-Maria"
  35.         local tc=g:GetFirst()
  36.         if tc:IsCode(o) and Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then -- change this to the text for asking to banish a facedown card
  37.             Duel.BreakEffect()
  38.             Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
  39.             local sg=Duel.SelectMatchingCard(tp,Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,1,nil)
  40.             Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)
  41.         end
  42.     end
  43. end
  44.  
  45. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement