Commit fc164207 authored by mercury233's avatar mercury233

fix

parent 729a8685
...@@ -10,6 +10,8 @@ function s.initial_effect(c) ...@@ -10,6 +10,8 @@ function s.initial_effect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_TO_GRAVE) e1:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,id) e1:SetCountLimit(1,id)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(s.condition)
e1:SetCost(s.spcost) e1:SetCost(s.spcost)
e1:SetTarget(s.target) e1:SetTarget(s.target)
e1:SetOperation(s.operation) e1:SetOperation(s.operation)
...@@ -19,6 +21,9 @@ end ...@@ -19,6 +21,9 @@ end
function s.counterfilter(c) function s.counterfilter(c)
return not c:IsSummonLocation(LOCATION_EXTRA) return not c:IsSummonLocation(LOCATION_EXTRA)
end end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND+LOCATION_ONFIELD)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
...@@ -34,15 +39,18 @@ function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) ...@@ -34,15 +39,18 @@ function s.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_EXTRA) return c:IsLocation(LOCATION_EXTRA)
end end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk) function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>=3
and not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.IsPlayerCanSpecialSummonMonster(tp,100200336,0,TYPES_TOKEN_MONSTER,0,0,1,RACE_PLANT,ATTRIBUTE_WIND,POS_FACEUP_DEFENSE) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,3,0,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,3,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,3,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,3,0,0)
end end
function s.operation(e,tp,eg,ep,ev,re,r,rp) function s.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<3 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<3
if not Duel.IsPlayerCanSpecialSummonMonster(tp,15341822,0,TYPES_TOKEN_MONSTER,0,0,1,RACE_PLANT,ATTRIBUTE_WIND,POS_FACEUP_DEFENSE) then return end or Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,100200336,0,TYPES_TOKEN_MONSTER,0,0,1,RACE_PLANT,ATTRIBUTE_WIND,POS_FACEUP_DEFENSE) then return end
for i=1,3 do for i=1,3 do
local token=Duel.CreateToken(tp,15341822) local token=Duel.CreateToken(tp,100200336)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end end
Duel.SpecialSummonComplete() Duel.SpecialSummonComplete()
......
...@@ -32,7 +32,7 @@ function s.spcon(e,c) ...@@ -32,7 +32,7 @@ function s.spcon(e,c)
if c==nil then return true end if c==nil then return true end
local tp=c:GetControler() local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
end end
function s.thfilter(c) function s.thfilter(c)
return aux.IsCodeListed(c,70902743) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() return aux.IsCodeListed(c,70902743) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
......
...@@ -46,7 +46,7 @@ function Auxiliary.SelectFromOptions(tp,...) ...@@ -46,7 +46,7 @@ function Auxiliary.SelectFromOptions(tp,...)
return opvals[select+1] return opvals[select+1]
end end
function s.costfilter(c) function s.costfilter(c)
return c:IsSetCard(0x119) and c:IsDiscardable() and c:IsAbleToGraveAsCost() return c:IsSetCard(0x119) and c:IsDiscardable()
end end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end
......
...@@ -90,6 +90,7 @@ function s.dlvop(e,tp,eg,ep,ev,re,r,rp) ...@@ -90,6 +90,7 @@ function s.dlvop(e,tp,eg,ep,ev,re,r,rp)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0) e1:SetTargetRange(1,0)
e1:SetTarget(aux.TargetBoolFunction(aux.NOT(Card.IsAttribute),ATTRIBUTE_FIRE)) e1:SetTarget(aux.TargetBoolFunction(aux.NOT(Card.IsAttribute),ATTRIBUTE_FIRE))
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and c:IsRelateToEffect(e) if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and c:IsRelateToEffect(e)
......
...@@ -87,7 +87,7 @@ function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -87,7 +87,7 @@ function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end end
function s.desop(e,tp,eg,ep,ev,re,r,rp) function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT) Duel.Destroy(tc,REASON_EFFECT)
end end
end end
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
--coded by Lyris --coded by Lyris
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
aux.AddCodeList(c,96305350)
c:EnableReviveLimit() c:EnableReviveLimit()
--material --material
aux.AddXyzProcedure(c,nil,3,2) aux.AddXyzProcedure(c,nil,3,2)
...@@ -17,7 +18,6 @@ function s.initial_effect(c) ...@@ -17,7 +18,6 @@ function s.initial_effect(c)
e1:SetOperation(s.thop) e1:SetOperation(s.thop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--todeck --todeck
aux.AddCodeList(c,96305350)
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1)) e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON) e2:SetCategory(CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON)
......
...@@ -36,8 +36,8 @@ end ...@@ -36,8 +36,8 @@ end
function s.condition(e,c) function s.condition(e,c)
if c==nil then return true end if c==nil then return true end
local tp=c:GetControler() local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_GRAVE,0)>24 return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_GRAVE,0)>=25
end end
function s.atkcon(e) function s.atkcon(e)
return Duel.GetFieldGroupCount(tp,0,LOCATION_GRAVE)>24 return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),0,LOCATION_GRAVE)>=25
end end
...@@ -25,7 +25,7 @@ function s.initial_effect(c) ...@@ -25,7 +25,7 @@ function s.initial_effect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_BE_MATERIAL) e3:SetCode(EVENT_BE_MATERIAL)
e3:SetCountLimit(1,id+o) e3:SetCountLimit(1,id+o)
e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCondition(s.spcon) e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg) e3:SetTarget(s.sptg)
e3:SetOperation(s.spop) e3:SetOperation(s.spop)
......
...@@ -12,8 +12,9 @@ function s.initial_effect(c) ...@@ -12,8 +12,9 @@ function s.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=e1:Clone() local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e2:SetValue(1)
c:RegisterEffect(e2) c:RegisterEffect(e2)
local e3=e1:Clone() local e3=e2:Clone()
e3:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e3:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
c:RegisterEffect(e3) c:RegisterEffect(e3)
--cannot tribute --cannot tribute
...@@ -50,7 +51,7 @@ function s.initial_effect(c) ...@@ -50,7 +51,7 @@ function s.initial_effect(c)
c:RegisterEffect(e7) c:RegisterEffect(e7)
end end
function s.mlimit(e,c,st) function s.mlimit(e,c,st)
return st==SUMMON_TYPE_FUSION or st==SUMMON_TYPE_SYNCHRO or st==SUMMON_TYPE_XYZ return st==SUMMON_TYPE_FUSION
end end
function s.spcon(e,tp,eg,ep,ev,re,r,rp) function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return r==REASON_LINK and e:GetHandler():IsLocation(LOCATION_GRAVE) return r==REASON_LINK and e:GetHandler():IsLocation(LOCATION_GRAVE)
......
...@@ -53,7 +53,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -53,7 +53,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp)
if bc:IsRelateToBattle() and bc:IsFaceup() then if bc:IsRelateToBattle() and bc:IsFaceup() then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK) e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0) e1:SetValue(0)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
bc:RegisterEffect(e1) bc:RegisterEffect(e1)
......
...@@ -16,7 +16,8 @@ function s.initial_effect(c) ...@@ -16,7 +16,8 @@ function s.initial_effect(c)
end end
function s.filter(c,tp) function s.filter(c,tp)
return c:IsType(TYPE_MONSTER) and c:IsPreviousControler(tp) and not c:IsReason(REASON_DESTROY) return c:IsType(TYPE_MONSTER) and c:IsPreviousControler(tp) and not c:IsReason(REASON_DESTROY)
and c:GetReasonEffect():IsActiveType(TYPE_MONSTER) and c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT) and c:GetReasonEffect():IsActiveType(TYPE_MONSTER)
and c:GetReasonPlayer()==1-tp
end end
function s.condition(e,tp,eg,ep,ev,re,r,rp) function s.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
......
...@@ -39,7 +39,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -39,7 +39,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if not (c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if not (c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPES_EFFECT_TRAP_MONSTER,3000,3000,10,RACE_CYBERSE,ATTRIBUTE_DARK)) then return end and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPES_EFFECT_TRAP_MONSTER,3000,3000,10,RACE_CYBERSE,ATTRIBUTE_DARK)) then return end
c:AddMonsterAttribute(c,TYPE_EFFECT+TYPE_TRAP) c:AddMonsterAttribute(TYPE_EFFECT+TYPE_TRAP)
if Duel.SpecialSummonStep(c,SUMMON_VALUE_SELF,tp,tp,true,false,POS_FACEUP) then if Duel.SpecialSummonStep(c,SUMMON_VALUE_SELF,tp,tp,true,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......
...@@ -81,13 +81,13 @@ function s.spfilter2(c,tp) ...@@ -81,13 +81,13 @@ function s.spfilter2(c,tp)
return c:IsSetCard(0x10f2,0x2073,0x2017,0x1046) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() return c:IsSetCard(0x10f2,0x2073,0x2017,0x1046) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
end end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_EXTRA,0,1,nil,tp) end if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end end
function s.spop(e,tp,eg,ep,ev,re,r,rp) function s.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,tp) local g=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,1,nil,tp)
local gc=g:GetFirst() local gc=g:GetFirst()
if gc and Duel.SendtoGrave(gc,REASON_EFFECT)~=0 and gc:IsLocation(LOCATION_GRAVE) then if gc and Duel.SendtoGrave(gc,REASON_EFFECT)~=0 and gc:IsLocation(LOCATION_GRAVE) then
local c=e:GetHandler() local c=e:GetHandler()
......
--Gold Pride - Star Leon
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,23512906)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--atk up
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,id)
e1:SetCondition(s.atkcon)
e1:SetTarget(s.atktg)
e1:SetOperation(s.atkop)
c:RegisterEffect(e1)
--sp summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.tdcon)
e2:SetTarget(s.tdtg)
e2:SetOperation(s.tdop)
c:RegisterEffect(e2)
end
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2
end
function s.atkfilter(c)
return c:IsFaceup() and c:GetBaseAttack()>0
end
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.atkfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,s.atkfilter,tp,0,LOCATION_MZONE,1,1,nil)
e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
local atk=tc:GetBaseAttack()
if c:IsRelateToEffect(e) and c:IsFaceup()
and tc:IsFaceup() and tc:IsRelateToEffect(e) and atk>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
if Duel.GetLP(tp)<Duel.GetLP(1-tp) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
Duel.BreakEffect()
Duel.Destroy(tc,REASON_EFFECT)
end
end
end
function s.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)>0
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_DECK)
end
function s.spfilter(c,e,tp)
return c:IsCode(23512906) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsExtraDeckMonster()
and Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_EFFECT)~=0 and c:IsLocation(LOCATION_EXTRA)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE+LOCATION_DECK,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
--Gold Pride - Nytro Blaster
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,59900655)
--link summon
aux.AddLinkProcedure(c,s.mfilter,2,2,s.lcheck)
c:EnableReviveLimit()
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,id)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(s.destg)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,2))
e2:SetCategory(CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.tdcon)
e2:SetTarget(s.tdtg)
e2:SetOperation(s.tdop)
c:RegisterEffect(e2)
end
function s.mfilter(c)
return c:IsLevelAbove(0) and c:IsLinkSetCard(0x192)
end
function s.lcheck(g,lc)
return g:GetClassCount(Card.GetLevel)==g:GetCount()
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function s.desfilter(c,tp,seq)
local sseq=c:GetSequence()
if c:IsControler(tp) then
return sseq==5 and seq==3 or sseq==6 and seq==1
end
if c:IsLocation(LOCATION_SZONE) then
return sseq<5 and sseq==seq
end
if sseq<5 then
return math.abs(sseq-seq)==1
end
if sseq>=5 then
return sseq==5 and seq==1 or sseq==6 and seq==3
end
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
local cg=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,tc,tp,tc:GetSequence())
if Duel.Destroy(tc,REASON_EFFECT)~=0 and Duel.GetLP(tp)<Duel.GetLP(1-tp) and #cg>0
and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.BreakEffect()
Duel.Destroy(cg,REASON_EFFECT)
end
end
end
function s.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)>0
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_DECK)
end
function s.spfilter(c,e,tp)
return c:IsCode(59900655) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsExtraDeckMonster()
and Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_EFFECT)~=0 and c:IsLocation(LOCATION_EXTRA)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE+LOCATION_DECK,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
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