Advertisement
arcagamer

lelouch

Mar 16th, 2023
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.27 KB | None | 0 0
  1. --Hail To The King - Lelouch Le Britannia
  2. --2 Level 8 Spellcaster monsters
  3. --Once per turn: You can detach 1 material from this card; activate one of these effects(quick effect).
  4. --Target 1 face-up monster your opponent controls; take control of it until the end phase, but it cannot attack or activate its effects.
  5. --Target 1 face-up card your opponent controls; negate its effects until the end phase, then draw 1 card.
  6. --Target up to 3 cards in your opponent’s graveyard; banish them, and if you do,inflict 300 damage and draw 1 card for each card banished by this effect.
  7.  
  8. local s,id=GetID()
  9. function s.initial_effect(c)
  10.     --xyz summon
  11.     Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER),8,2)
  12.     c:EnableReviveLimit()
  13.     --activate one of three effects once per turn
  14.     local e1=Effect.CreateEffect(c)
  15.     e1:SetDescription(aux.Stringid(id,0))
  16.     e1:SetCategory(CATEGORY_CONTROL)
  17.     e1:SetType(EFFECT_TYPE_QUICK_O)
  18.     e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  19.     e1:SetCode(EVENT_FREE_CHAIN)
  20.     e1:SetRange(LOCATION_MZONE)
  21.     e1:SetCountLimit(1,id)
  22.     e1:SetCost(s.cost)
  23.     e1:SetTarget(s.target)
  24.     e1:SetOperation(s.operation)
  25.     c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT)
  26.     local e2=e1:Clone()
  27.     e2:SetDescription(aux.Stringid(id,1))
  28.     e2:SetCategory(CATEGORY_NEGATE)
  29.     e2:SetTarget(s.target2)
  30.     e2:SetOperation(s.operation2)
  31.     c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT)
  32.     local e3=e2:Clone()
  33.     e3:SetDescription(aux.Stringid(id,2))
  34.     e3:SetCategory(CATEGORY_NEGATE)
  35.     e3:SetTarget(s.target3)
  36.     e3:SetOperation(s.operation3)
  37.     c:RegisterEffect(e3,false,REGISTER_FLAG_DETACH_XMAT)
  38.     --special summon
  39.     local e4=Effect.CreateEffect(c)
  40.     e4:SetDescription(aux.Stringid(id,3))
  41.     e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
  42.     e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
  43.     e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
  44.     e4:SetCode(EVENT_TO_GRAVE)
  45.     e4:SetCountLimit(1,id+100)
  46.     e4:SetCondition(s.spcon)
  47.     e4:SetTarget(s.sptg)
  48.     e4:SetOperation(s.spop)
  49.     c:RegisterEffect(e4)
  50.  
  51. end
  52. s.listed_names={id}
  53. function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
  54.     if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
  55.     e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
  56. end
  57. function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
  58.     if chkc then return chkc:GetLocation()==LOCATION_MZONE and chkc:GetControler()~=tp and chkc:IsControlerCanBeChanged() end
  59.     if chk==0 then return Duel.IsExistingTarget(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,nil) end
  60.     Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
  61.     local g=Duel.SelectTarget(tp,Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,1,nil)
  62.     Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
  63. end
  64.  
  65. function s.operation(e,tp,eg,ep,ev,re,r,rp,chkc)
  66.     local c=e:GetHandler()
  67.     local tc=Duel.GetFirstTarget()
  68.     if tc:IsRelateToEffect(e) and Duel.GetControl(tc,tp,PHASE_END,1)~=0 then
  69.         local e1=Effect.CreateEffect(c)
  70.         local reset=RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END
  71.         e1:SetType(EFFECT_TYPE_SINGLE)
  72.         e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  73.         e1:SetReset(reset)
  74.         e1:SetValue(1)
  75.         tc:RegisterEffect(e1)
  76.         local e3=Effect.CreateEffect(c)
  77.         e3:SetType(EFFECT_TYPE_SINGLE)
  78.         e3:SetCode(EFFECT_CANNOT_ATTACK)
  79.         e3:SetReset(reset)
  80.         tc:RegisterEffect(e3)
  81.     end
  82. end
  83.  
  84. function s.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
  85.     if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and chkc:IsControler(1-tp) end
  86.     if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
  87.     Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
  88.     local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
  89.     Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
  90. end
  91.  
  92. function s.operation2(e,tp,eg,ep,ev,re,r,rp,chkc)
  93.     local c=e:GetHandler()
  94.     local tc=Duel.GetFirstTarget()
  95.     if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then
  96.         Duel.NegateRelatedChain(tc,RESET_TURN_SET)
  97.         local e2=Effect.CreateEffect(c)
  98.         e2:SetType(EFFECT_TYPE_SINGLE)
  99.         e2:SetCode(EFFECT_DISABLE)
  100.         e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
  101.         tc:RegisterEffect(e2)
  102.         local e3=Effect.CreateEffect(c)
  103.         e3:SetType(EFFECT_TYPE_SINGLE)
  104.         e3:SetCode(EFFECT_DISABLE_EFFECT)
  105.         e3:SetValue(RESET_TURN_SET)
  106.         e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
  107.         tc:RegisterEffect(e3)
  108.         Duel.Draw(tp,1,REASON_EFFECT)
  109.     end
  110. end
  111.  
  112. function s.rmfilter(c)
  113.     return c:IsAbleToRemove() and aux.SpElimFilter(c)
  114. end
  115.  
  116. function s.target3(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
  117.     if chkc then return chkc:IsLocation(LOCATION_GRAVE) and s.rmfilter(chkc) end
  118.     if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_GRAVE,1,nil) end
  119.     Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
  120.     local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_GRAVE,1,3,nil)
  121.     Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
  122. end
  123.  
  124. function s.operation3(e,tp,eg,ep,ev,re,r,rp,chkc)
  125.     local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
  126.     local sg=g:Filter(Card.IsRelateToEffect,nil,e)
  127.     local tamanho = #sg
  128.     Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)
  129.     Duel.Damage(1-tp,300*tamanho,REASON_EFFECT)
  130.     Duel.Draw(tp,1*tamanho,REASON_EFFECT)
  131. end
  132.  
  133. function s.spfilter(c,e,tp)
  134.     return c:IsType(TYPE_XYZ) and c:IsRace(RACE_SPELLCASTER) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
  135. end
  136.  
  137. function s.spcon(e,tp,eg,ep,ev,re,r,rp)
  138.     local c=e:GetHandler()
  139.     return c:IsPreviousControler(tp) and rp==1-tp and c:IsReason(REASON_DESTROY)
  140. end
  141. function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
  142.     if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end
  143.     if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
  144.         and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
  145.     Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
  146.     local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
  147.     Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
  148. end
  149.  
  150. function s.spop(e,tp,eg,ep,ev,re,r,rp)
  151.     if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
  152.     local c=e:GetHandler()
  153.     local tc=Duel.GetFirstTarget()
  154.     if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
  155.         if c:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
  156.             Duel.Overlay(tc,c)
  157.         end
  158.     end
  159.     Duel.SpecialSummonComplete()
  160. end
  161.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement