Commit b83a6137 authored by wind2009's avatar wind2009

format

parent 15b69c79
Pipeline #41382 canceled with stages
in 2 seconds
--竜剣士ウィンドユニコーンP --竜剣士ウィンドユニコーンP
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
-- pendulum -- pendulum
aux.EnablePendulumAttribute(c) aux.EnablePendulumAttribute(c)
-- pendulum effect, select one to activate -- pendulum effect, select one to activate
-- special summon self -- special summon self
-- destroy self to special summon level 5 or lower pendulum monster from pzone -- destroy self to special summon level 5 or lower pendulum monster from pzone
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0)) e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION) e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE) e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,id) e1:SetCountLimit(1,id)
e1:SetCondition(s.pencon) e1:SetCondition(s.pencon)
e1:SetTarget(s.pentg) e1:SetTarget(s.pentg)
e1:SetOperation(s.penop) e1:SetOperation(s.penop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
-- cannot be targeted or destroyed by opponent's card effects -- cannot be targeted or destroyed by opponent's card effects
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
e2:SetCondition(s.protcon) e2:SetCondition(s.protcon)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetValue(aux.tgoval) e2:SetValue(aux.tgoval)
c:RegisterEffect(e2) c:RegisterEffect(e2)
local e3=e2:Clone() local e3=e2:Clone()
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e3:SetValue(aux.indoval) e3:SetValue(aux.indoval)
c:RegisterEffect(e3) c:RegisterEffect(e3)
-- target 1 pendulum monster card you control and 1 card your opponent controls; return them to the hand -- target 1 pendulum monster card you control and 1 card your opponent controls; return them to the hand
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1)) e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_TOHAND) e4:SetCategory(CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN) e4:SetCode(EVENT_FREE_CHAIN)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetRange(LOCATION_MZONE) e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1,id+o) e4:SetCountLimit(1,id+o)
e4:SetTarget(s.thtg) e4:SetTarget(s.thtg)
e4:SetOperation(s.thop) e4:SetOperation(s.thop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
function s.pencon(e,tp,eg,ep,ev,re,r,rp) function s.pencon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldCard(tp,LOCATION_PZONE,0) and Duel.GetFieldCard(tp,LOCATION_PZONE,1) return Duel.GetFieldCard(tp,LOCATION_PZONE,0) and Duel.GetFieldCard(tp,LOCATION_PZONE,1)
end end
function s.penspfilter(c,e,tp) function s.penspfilter(c,e,tp)
return c:IsLevelBelow(5) and c:IsType(TYPE_PENDULUM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsLevelBelow(5) and c:IsType(TYPE_PENDULUM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
local b1=c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 local b1=c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
local b2=Duel.IsExistingMatchingCard(s.penspfilter,tp,LOCATION_PZONE,0,1,c,e,tp) local b2=Duel.IsExistingMatchingCard(s.penspfilter,tp,LOCATION_PZONE,0,1,c,e,tp)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if chk==0 then return b1 or b2 end if chk==0 then return b1 or b2 end
local op=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3)) local op=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3))
e:SetLabel(op) e:SetLabel(op)
if op==0 then if op==0 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON) e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
else else
e:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_PZONE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_PZONE)
end end
end end
function s.penop(e,tp,eg,ep,ev,re,r,rp) function s.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if e:GetLabel()==0 then if e:GetLabel()==0 then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
else else
if Duel.Destroy(c,REASON_EFFECT)>0 then if Duel.Destroy(c,REASON_EFFECT)>0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local sg=Duel.GetMatchingGroup(s.penspfilter,tp,LOCATION_PZONE,0,nil,e,tp) local sg=Duel.GetMatchingGroup(s.penspfilter,tp,LOCATION_PZONE,0,nil,e,tp)
if #sg==0 then return end if #sg==0 then return end
if #sg==1 then if #sg==1 then
...@@ -82,40 +82,40 @@ function s.penop(e,tp,eg,ep,ev,re,r,rp) ...@@ -82,40 +82,40 @@ function s.penop(e,tp,eg,ep,ev,re,r,rp)
return return
end end
if #sg>1 then if #sg>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=sg:Select(tp,1,1,nil) local g=sg:Select(tp,1,1,nil)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end end
end end
end end
end end
function s.protcon(e) function s.protcon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_PENDULUM) return e:GetHandler():IsSummonType(SUMMON_TYPE_PENDULUM)
end end
function s.thfilter(c,tp) function s.thfilter(c,tp)
return (c:GetOriginalType()&(TYPE_PENDULUM|TYPE_MONSTER)==TYPE_PENDULUM|TYPE_MONSTER) and c:IsFaceup() and c:IsControler(tp) return (c:GetOriginalType()&(TYPE_PENDULUM|TYPE_MONSTER)==TYPE_PENDULUM|TYPE_MONSTER) and c:IsFaceup() and c:IsControler(tp)
end end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
local g=Duel.GetMatchingGroup(aux.AND(Card.IsCanBeEffectTarget,Card.IsAbleToHand),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e) local g=Duel.GetMatchingGroup(aux.AND(Card.IsCanBeEffectTarget,Card.IsAbleToHand),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e)
if chk==0 then return g:CheckSubGroup(s.thcheck,2,2,tp) end if chk==0 then return g:CheckSubGroup(s.thcheck,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local sg=g:SelectSubGroup(tp,s.thcheck,false,2,2,tp) local sg=g:SelectSubGroup(tp,s.thcheck,false,2,2,tp)
Duel.SetTargetCard(sg) Duel.SetTargetCard(sg)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,2,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,2,0,0)
end end
function s.thcheck(g,tp) function s.thcheck(g,tp)
return g:IsExists(s.thfilter,1,nil,tp) return g:IsExists(s.thfilter,1,nil,tp)
and g:IsExists(aux.AND(Card.IsControler,Card.IsAbleToHand),1,nil,1-tp) and g:IsExists(aux.AND(Card.IsControler,Card.IsAbleToHand),1,nil,1-tp)
end end
function s.thop(e,tp,eg,ep,ev,re,r,rp) function s.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetTargetsRelateToChain() local g=Duel.GetTargetsRelateToChain()
if #g>0 then if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment