Commit 74f6f989 authored by wind2009's avatar wind2009

Merge branch 'master' from upstream

parents ac62a8ee 75a03ac8
...@@ -2,26 +2,22 @@ ...@@ -2,26 +2,22 @@
function c10131855.initial_effect(c) function c10131855.initial_effect(c)
--activate --activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(10131855,0))
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant(chain) --replace effect
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(10131855,1)) e2:SetDescription(aux.Stringid(10131855,1))
e2:SetCategory(CATEGORY_TOHAND) e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_ACTIVATE) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_CHAINING) e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN) e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetCondition(c10131855.condition) e2:SetCondition(c10131855.condition)
e2:SetTarget(c10131855.target) e2:SetTarget(c10131855.target)
e2:SetOperation(c10131855.operation) e2:SetOperation(c10131855.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetRange(LOCATION_SZONE)
c:RegisterEffect(e3)
end end
function c10131855.repop(e,tp,eg,ep,ev,re,r,rp) function c10131855.repop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
......
...@@ -5,8 +5,6 @@ function c3160805.initial_effect(c) ...@@ -5,8 +5,6 @@ function c3160805.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c3160805.target1)
e1:SetOperation(c3160805.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant --instant
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
...@@ -16,8 +14,8 @@ function c3160805.initial_effect(c) ...@@ -16,8 +14,8 @@ function c3160805.initial_effect(c)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetCost(c3160805.cost2) e2:SetCountLimit(1,3160805)
e2:SetTarget(c3160805.target2) e2:SetTarget(c3160805.target)
e2:SetOperation(c3160805.operation) e2:SetOperation(c3160805.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
...@@ -35,27 +33,23 @@ end ...@@ -35,27 +33,23 @@ end
function c3160805.thfilter2(c,lv) function c3160805.thfilter2(c,lv)
return c:IsLevel(lv) and c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToHand() return c:IsLevel(lv) and c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToHand()
end end
function c3160805.target1(e,tp,eg,ep,ev,re,r,rp,chk) function c3160805.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local b1=Duel.IsExistingMatchingCard(c3160805.tgfilter1,tp,LOCATION_HAND,0,1,nil,tp) local b1=Duel.IsExistingMatchingCard(c3160805.tgfilter1,tp,LOCATION_HAND,0,1,nil,tp)
local b2=Duel.IsExistingMatchingCard(c3160805.tgfilter2,tp,LOCATION_HAND,0,1,nil,tp) local b2=Duel.IsExistingMatchingCard(c3160805.tgfilter2,tp,LOCATION_HAND,0,1,nil,tp)
local op=2 if chk==0 then return b1 or b2 end
if Duel.GetFlagEffect(tp,3160805)==0 and (b1 or b2) and Duel.SelectYesNo(tp,aux.Stringid(3160805,1)) then local op=0
if b1 and b2 then if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(3160805,2),aux.Stringid(3160805,3)) op=Duel.SelectOption(tp,aux.Stringid(3160805,2),aux.Stringid(3160805,3))
elseif b1 then elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(3160805,2)) op=Duel.SelectOption(tp,aux.Stringid(3160805,2))
else else
op=Duel.SelectOption(tp,aux.Stringid(3160805,3))+1 op=Duel.SelectOption(tp,aux.Stringid(3160805,3))+1
end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.RegisterFlagEffect(tp,3160805,RESET_PHASE+PHASE_END,0,1)
end end
e:SetLabel(op) e:SetLabel(op)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end end
function c3160805.operation(e,tp,eg,ep,ev,re,r,rp) function c3160805.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==2 or not e:GetHandler():IsRelateToEffect(e) then return end
if e:GetLabel()==0 then if e:GetLabel()==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c3160805.tgfilter1,tp,LOCATION_HAND,0,1,1,nil,tp) local g=Duel.SelectMatchingCard(tp,c3160805.tgfilter1,tp,LOCATION_HAND,0,1,1,nil,tp)
...@@ -78,23 +72,3 @@ function c3160805.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -78,23 +72,3 @@ function c3160805.operation(e,tp,eg,ep,ev,re,r,rp)
end end
end end
end end
function c3160805.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,3160805)==0 end
Duel.RegisterFlagEffect(tp,3160805,RESET_PHASE+PHASE_END,0,1)
end
function c3160805.target2(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=Duel.IsExistingMatchingCard(c3160805.tgfilter1,tp,LOCATION_HAND,0,1,nil,tp)
local b2=Duel.IsExistingMatchingCard(c3160805.tgfilter2,tp,LOCATION_HAND,0,1,nil,tp)
if chk==0 then return b1 or b2 end
local op=0
if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(3160805,2),aux.Stringid(3160805,3))
elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(3160805,2))
else
op=Duel.SelectOption(tp,aux.Stringid(3160805,3))+1
end
e:SetLabel(op)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
...@@ -4,58 +4,30 @@ function c35011819.initial_effect(c) ...@@ -4,58 +4,30 @@ function c35011819.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c35011819.target1)
e1:SetOperation(c35011819.activate1)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant --draw
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(35011819,0)) e2:SetDescription(aux.Stringid(35011819,0))
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DRAW) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_CHAINING) e2:SetCode(EVENT_CHAINING)
e2:SetCondition(c35011819.condition2) e2:SetCondition(c35011819.condition)
e2:SetTarget(c35011819.target2) e2:SetTarget(c35011819.target)
e2:SetOperation(c35011819.activate2) e2:SetOperation(c35011819.activate)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c35011819.target1(e,tp,eg,ep,ev,re,r,rp,chk) function c35011819.condition(e,tp,eg,ep,ev,re,r,rp)
if chk==0 then return true end
e:SetLabel(0)
local ct=Duel.GetCurrentChain()
if ct==1 then return end
local ct=Duel.GetCurrentChain()
local te=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
local tc=te:GetHandler()
if te:GetCode()==EVENT_SUMMON_SUCCESS and te:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ct-1)
and Duel.IsPlayerCanDraw(tc:GetControler(),1) and Duel.SelectYesNo(tp,aux.Stringid(35011819,1)) then
e:SetLabel(1)
Duel.SetOperationInfo(0,CATEGORY_NEGATE,tc,1,0,0)
Duel.SetTargetPlayer(tc:GetControler())
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tc:GetControler(),1)
e:GetHandler():RegisterFlagEffect(0,RESET_CHAIN,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(35011819,2))
end
end
function c35011819.activate1(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()~=1 then return end
local c=e:GetHandler()
local ct=Duel.GetChainInfo(0,CHAININFO_CHAIN_COUNT)
Duel.NegateActivation(ct-1)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c35011819.condition2(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_MONSTER) and re:GetCode()==EVENT_SUMMON_SUCCESS and Duel.IsChainNegatable(ev) return re:IsActiveType(TYPE_MONSTER) and re:GetCode()==EVENT_SUMMON_SUCCESS and Duel.IsChainNegatable(ev)
end end
function c35011819.target2(e,tp,eg,ep,ev,re,r,rp,chk) function c35011819.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(rp,1) end if chk==0 then return Duel.IsPlayerCanDraw(rp,1) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
Duel.SetTargetPlayer(rp) Duel.SetTargetPlayer(rp)
Duel.SetTargetParam(1) Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,rp,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,rp,1)
end end
function c35011819.activate2(e,tp,eg,ep,ev,re,r,rp) function c35011819.activate(e,tp,eg,ep,ev,re,r,rp)
if not Duel.NegateActivation(ev) then return end if not Duel.NegateActivation(ev) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT) Duel.Draw(p,d,REASON_EFFECT)
......
...@@ -5,10 +5,8 @@ function c35419032.initial_effect(c) ...@@ -5,10 +5,8 @@ function c35419032.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c35419032.target1)
e1:SetOperation(c35419032.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant(chain) --to hand
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(35419032,0)) e2:SetDescription(aux.Stringid(35419032,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
...@@ -16,9 +14,9 @@ function c35419032.initial_effect(c) ...@@ -16,9 +14,9 @@ function c35419032.initial_effect(c)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetLabel(1) e2:SetCountLimit(1)
e2:SetCost(c35419032.cost2) e2:SetCost(c35419032.cost)
e2:SetTarget(c35419032.target2) e2:SetTarget(c35419032.target)
e2:SetOperation(c35419032.operation) e2:SetOperation(c35419032.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
...@@ -28,36 +26,7 @@ end ...@@ -28,36 +26,7 @@ end
function c35419032.afilter(c) function c35419032.afilter(c)
return c:IsSetCard(0xa) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() return c:IsSetCard(0xa) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end end
function c35419032.target1(e,tp,eg,ep,ev,re,r,rp,chk) function c35419032.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if Duel.IsExistingMatchingCard(c35419032.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(c35419032.afilter,tp,LOCATION_DECK,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(35419032,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,c35419032.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
if g:GetFirst():IsLocation(LOCATION_HAND) then
Duel.ConfirmCards(1-tp,g)
end
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e:SetLabel(1)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
e:GetHandler():RegisterFlagEffect(35419032,RESET_PHASE+PHASE_END,0,1)
else
e:SetCategory(0)
e:SetLabel(0)
end
end
function c35419032.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c35419032.afilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c35419032.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35419032.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(c35419032.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,c35419032.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,c35419032.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
...@@ -66,9 +35,15 @@ function c35419032.cost2(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -66,9 +35,15 @@ function c35419032.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
end end
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
end end
function c35419032.target2(e,tp,eg,ep,ev,re,r,rp,chk) function c35419032.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(35419032)==0 if chk==0 then return Duel.IsExistingMatchingCard(c35419032.afilter,tp,LOCATION_DECK,0,1,nil) end
and Duel.IsExistingMatchingCard(c35419032.afilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
e:GetHandler():RegisterFlagEffect(35419032,RESET_PHASE+PHASE_END,0,1) end
function c35419032.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c35419032.afilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end end
...@@ -29,31 +29,17 @@ function c36730805.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -29,31 +29,17 @@ function c36730805.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c36730805.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) local g=Duel.SelectMatchingCard(tp,c36730805.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst() local tc=g:GetFirst()
if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then if tc then
local e1=Effect.CreateEffect(e:GetHandler()) if Duel.GetCurrentChain()==1 then
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) local e2=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetLabelObject(tc) e2:SetCode(EVENT_CHAIN_END)
e1:SetOperation(c36730805.sumop) e2:SetOperation(c36730805.limitop)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e2,tp)
local e2=Effect.CreateEffect(e:GetHandler()) end
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
e2:SetCode(EVENT_CHAIN_END)
e2:SetLabelObject(e1)
e2:SetOperation(c36730805.cedop)
Duel.RegisterEffect(e2,tp)
end end
Duel.SpecialSummonComplete()
end end
function c36730805.sumop(e,tp,eg,ep,ev,re,r,rp) function c36730805.limitop(e,tp,eg,ep,ev,re,r,rp)
if eg:IsContains(e:GetLabelObject()) then Duel.SetChainLimitTillChainEnd(aux.FALSE)
e:SetLabel(1)
e:Reset()
else e:SetLabel(0) end
end
function c36730805.cedop(e,tp,eg,ep,ev,re,r,rp)
if Duel.CheckEvent(EVENT_SPSUMMON_SUCCESS) and e:GetLabelObject():GetLabel()==1 then
Duel.SetChainLimitTillChainEnd(aux.FALSE)
end
e:Reset()
end end
...@@ -36,13 +36,7 @@ function c41659072.initial_effect(c) ...@@ -36,13 +36,7 @@ function c41659072.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c41659072.syncheck(g) function c41659072.syncheck(g)
local sg=g:Clone() return aux.SameValueCheck(g,Card.GetAttribute)
local attr=ATTRIBUTE_ALL
for c in aux.Next(sg) do
attr=attr&c:GetAttribute()
if attr==0 then break end
end
return attr~=0
end end
function c41659072.sumlimit(e,se,sp,st) function c41659072.sumlimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_SYNCHRO)~=SUMMON_TYPE_SYNCHRO or not se return bit.band(st,SUMMON_TYPE_SYNCHRO)~=SUMMON_TYPE_SYNCHRO or not se
......
...@@ -6,8 +6,6 @@ function c48680970.initial_effect(c) ...@@ -6,8 +6,6 @@ function c48680970.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c48680970.target1)
e1:SetOperation(c48680970.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant --instant
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
...@@ -15,8 +13,8 @@ function c48680970.initial_effect(c) ...@@ -15,8 +13,8 @@ function c48680970.initial_effect(c)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetCost(c48680970.cost2) e2:SetCountLimit(1,48680970)
e2:SetTarget(c48680970.target2) e2:SetTarget(c48680970.target)
e2:SetOperation(c48680970.operation) e2:SetOperation(c48680970.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--immune effect --immune effect
...@@ -44,34 +42,29 @@ end ...@@ -44,34 +42,29 @@ end
function c48680970.filter2(c) function c48680970.filter2(c)
return c:IsCode(2314238,63391643) and c:IsAbleToHand() return c:IsCode(2314238,63391643) and c:IsAbleToHand()
end end
function c48680970.target1(e,tp,eg,ep,ev,re,r,rp,chk) function c48680970.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c48680970.filter1,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(c48680970.filter1,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp)
local b2=Duel.IsExistingMatchingCard(c48680970.filter2,tp,LOCATION_DECK,0,1,nil) local b2=Duel.IsExistingMatchingCard(c48680970.filter2,tp,LOCATION_DECK,0,1,nil)
local op=2 if chk==0 then return b1 or b2 end
e:SetCategory(0) local op=0
if Duel.GetFlagEffect(tp,48680970)==0 and (b1 or b2) and Duel.SelectYesNo(tp,aux.Stringid(48680970,0)) then if b1 and b2 then
if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(48680970,1),aux.Stringid(48680970,2))
op=Duel.SelectOption(tp,aux.Stringid(48680970,1),aux.Stringid(48680970,2)) elseif b1 then
elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(48680970,1))
op=Duel.SelectOption(tp,aux.Stringid(48680970,1)) else
else op=Duel.SelectOption(tp,aux.Stringid(48680970,2))+1
op=Duel.SelectOption(tp,aux.Stringid(48680970,2))+1
end
if op==0 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
else
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
Duel.RegisterFlagEffect(tp,48680970,RESET_PHASE+PHASE_END,0,1)
end end
e:SetLabel(op) e:SetLabel(op)
if op==0 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
else
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
end end
function c48680970.operation(e,tp,eg,ep,ev,re,r,rp) function c48680970.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==2 or not e:GetHandler():IsRelateToEffect(e) then return end
if e:GetLabel()==0 then if e:GetLabel()==0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
...@@ -88,32 +81,6 @@ function c48680970.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -88,32 +81,6 @@ function c48680970.operation(e,tp,eg,ep,ev,re,r,rp)
end end
end end
end end
function c48680970.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,48680970)==0 end
Duel.RegisterFlagEffect(tp,48680970,RESET_PHASE+PHASE_END,0,1)
end
function c48680970.target2(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c48680970.filter1,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp)
local b2=Duel.IsExistingMatchingCard(c48680970.filter2,tp,LOCATION_DECK,0,1,nil)
if chk==0 then return b1 or b2 end
local op=0
if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(48680970,1),aux.Stringid(48680970,2))
elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(48680970,1))
else
op=Duel.SelectOption(tp,aux.Stringid(48680970,2))+1
end
e:SetLabel(op)
if op==0 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
else
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
end
function c48680970.etarget(e,c) function c48680970.etarget(e,c)
return c:IsCode(46986414) return c:IsCode(46986414)
end end
......
...@@ -5,77 +5,76 @@ function c53670497.initial_effect(c) ...@@ -5,77 +5,76 @@ function c53670497.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c53670497.target1)
e1:SetOperation(c53670497.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant --to grave
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(53670497,1)) e2:SetDescription(aux.Stringid(53670497,0))
e2:SetCategory(CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetLabel(1) e2:SetCountLimit(1)
e2:SetTarget(c53670497.target2) e2:SetCondition(c53670497.condition1)
e2:SetOperation(c53670497.activate) e2:SetTarget(c53670497.target1)
e2:SetOperation(c53670497.activate1)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--spsummmon --return grave
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(53670497,2)) e3:SetDescription(aux.Stringid(53670497,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_TO_GRAVE) e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c53670497.spcon) e3:SetCode(EVENT_FREE_CHAIN)
e3:SetTarget(c53670497.sptg) e3:SetCountLimit(1)
e3:SetOperation(c53670497.spop) e3:SetCondition(c53670497.condition2)
e3:SetTarget(c53670497.target2)
e3:SetOperation(c53670497.activate2)
c:RegisterEffect(e3) c:RegisterEffect(e3)
--spsummmon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(53670497,2))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(c53670497.spcon)
e4:SetTarget(c53670497.sptg)
e4:SetOperation(c53670497.spop)
c:RegisterEffect(e4)
end
function c53670497.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsTurnPlayer(1-tp)
end end
function c53670497.filter1(c) function c53670497.filter1(c)
return c:IsSetCard(0x69) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() return c:IsSetCard(0x69) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
end end
function c53670497.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c53670497.filter1,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c53670497.activate1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c53670497.filter1,tp,LOCATION_DECK,0,1,1,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
end
function c53670497.condition2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsTurnPlayer(tp)
end
function c53670497.filter2(c) function c53670497.filter2(c)
return c:IsFaceup() and c:IsSetCard(0x69) and c:IsType(TYPE_MONSTER) return c:IsFaceup() and c:IsSetCard(0x69) and c:IsType(TYPE_MONSTER)
end end
function c53670497.target1(e,tp,eg,ep,ev,re,r,rp,chk) function c53670497.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c53670497.filter2(chkc) end
e:SetLabel(0) if chk==0 then return Duel.IsExistingTarget(c53670497.filter2,tp,LOCATION_REMOVED,0,1,nil) end
local turnp=Duel.GetTurnPlayer() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(53670497,3))
if ((turnp~=tp and Duel.IsExistingMatchingCard(c53670497.filter1,tp,LOCATION_DECK,0,1,nil)) local g=Duel.SelectTarget(tp,c53670497.filter2,tp,LOCATION_REMOVED,0,1,1,nil)
or (turnp==tp and Duel.IsExistingMatchingCard(c53670497.filter2,tp,LOCATION_REMOVED,0,1,nil))) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0)
and Duel.SelectYesNo(tp,aux.Stringid(53670497,0)) then
if turnp==tp then
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_REMOVED)
else
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
e:SetLabel(1)
e:GetHandler():RegisterFlagEffect(53670497,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
end
function c53670497.target2(e,tp,eg,ep,ev,re,r,rp,chk)
local turnp=Duel.GetTurnPlayer()
if chk==0 then return e:GetHandler():GetFlagEffect(53670497)==0
and ((turnp~=tp and Duel.IsExistingMatchingCard(c53670497.filter1,tp,LOCATION_DECK,0,1,nil))
or (turnp==tp and Duel.IsExistingMatchingCard(c53670497.filter2,tp,LOCATION_REMOVED,0,1,nil))) end
if turnp==tp then
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_REMOVED)
else
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
e:GetHandler():RegisterFlagEffect(53670497,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end end
function c53670497.activate(e,tp,eg,ep,ev,re,r,rp) function c53670497.activate2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local tc=Duel.GetFirstTarget()
if e:GetLabel()~=1 or not c:IsRelateToEffect(e) then return end if tc:IsRelateToChain() then
local turnp=Duel.GetTurnPlayer() Duel.SendtoGrave(tc,REASON_EFFECT+REASON_RETURN)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
if turnp~=tp then
local g=Duel.SelectMatchingCard(tp,c53670497.filter1,tp,LOCATION_DECK,0,1,1,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
else
local g=Duel.SelectMatchingCard(tp,c53670497.filter2,tp,LOCATION_REMOVED,0,1,1,nil)
Duel.SendtoGrave(g,REASON_EFFECT+REASON_RETURN)
end end
end end
function c53670497.spcon(e,tp,eg,ep,ev,re,r,rp) function c53670497.spcon(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -5,10 +5,8 @@ function c53936268.initial_effect(c) ...@@ -5,10 +5,8 @@ function c53936268.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c53936268.target1)
e1:SetOperation(c53936268.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant(chain) --to hand
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(53936268,0)) e2:SetDescription(aux.Stringid(53936268,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
...@@ -16,8 +14,9 @@ function c53936268.initial_effect(c) ...@@ -16,8 +14,9 @@ function c53936268.initial_effect(c)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetCountLimit(1)
e2:SetCost(c53936268.cost) e2:SetCost(c53936268.cost)
e2:SetTarget(c53936268.target2) e2:SetTarget(c53936268.target)
e2:SetOperation(c53936268.operation) e2:SetOperation(c53936268.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
...@@ -27,30 +26,6 @@ end ...@@ -27,30 +26,6 @@ end
function c53936268.thfilter(c) function c53936268.thfilter(c)
return c:IsSetCard(0x103) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() return c:IsSetCard(0x103) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end end
function c53936268.target1(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if c53936268.cost(e,tp,eg,ep,ev,re,r,rp,0)
and Duel.IsExistingMatchingCard(c53936268.thfilter,tp,LOCATION_DECK,0,1,nil)
and Duel.SelectYesNo(tp,94) then
c53936268.cost(e,tp,eg,ep,ev,re,r,rp,1)
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
c:RegisterFlagEffect(53936268,RESET_PHASE+PHASE_END,0,1)
c:RegisterFlagEffect(0,RESET_CHAIN,EFFECT_FLAG_CLIENT_HINT,1,0,65)
else
e:SetCategory(0)
end
end
function c53936268.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():GetFlagEffect(53936268)==0 or not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c53936268.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c53936268.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c53936268.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c53936268.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler()) end if chk==0 then return Duel.IsExistingMatchingCard(c53936268.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
...@@ -60,9 +35,16 @@ function c53936268.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -60,9 +35,16 @@ function c53936268.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end end
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
end end
function c53936268.target2(e,tp,eg,ep,ev,re,r,rp,chk) function c53936268.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(53936268)==0 if chk==0 then return Duel.IsExistingMatchingCard(c53936268.thfilter,tp,LOCATION_DECK,0,1,nil) end
and Duel.IsExistingMatchingCard(c53936268.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
e:GetHandler():RegisterFlagEffect(53936268,RESET_PHASE+PHASE_END,0,1)
end end
function c53936268.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c53936268.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
...@@ -41,27 +41,28 @@ function c64276752.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -41,27 +41,28 @@ function c64276752.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then if c:IsFaceup() and c:IsRelateToEffect(e) then
local atk=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,c):GetSum(Card.GetBaseAttack) local atk=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,c):GetSum(Card.GetBaseAttack)
local e1=Effect.CreateEffect(c) if atk>0 then
e1:SetType(EFFECT_TYPE_SINGLE) local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1) e1:SetValue(atk)
local mg=c:GetOverlayGroup() c:RegisterEffect(e1)
if mg:IsExists(c64276752.mgfilter,1,nil) and atk>0 then local mg=c:GetOverlayGroup()
local g=Duel.GetMatchingGroup(aux.NegateMonsterFilter,tp,LOCATION_MZONE,LOCATION_MZONE,c) if mg:IsExists(c64276752.mgfilter,1,nil) then
if #g>0 then Duel.BreakEffect() end local g=Duel.GetMatchingGroup(aux.NegateMonsterFilter,tp,LOCATION_MZONE,LOCATION_MZONE,c)
for tc in aux.Next(g) do for tc in aux.Next(g) do
local e1=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE) e2:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1) tc:RegisterEffect(e2)
local e2=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT) e3:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+RESETS_STANDARD) e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2) tc:RegisterEffect(e3)
end
end end
end end
end end
......
...@@ -5,19 +5,17 @@ function c6733059.initial_effect(c) ...@@ -5,19 +5,17 @@ function c6733059.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetCost(c6733059.cost1)
e1:SetOperation(c6733059.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant(chain) --destroy
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(6733059,1)) e2:SetDescription(aux.Stringid(6733059,1))
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetCategory(CATEGORY_DESTROY) e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e2:SetCost(c6733059.cost2) e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetCost(c6733059.cost)
e2:SetOperation(c6733059.operation) e2:SetOperation(c6733059.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
...@@ -27,34 +25,7 @@ end ...@@ -27,34 +25,7 @@ end
function c6733059.tfilter(c,lv) function c6733059.tfilter(c,lv)
return c:IsFaceup() and c:IsLevelBelow(lv) return c:IsFaceup() and c:IsLevelBelow(lv)
end end
function c6733059.cost1(e,tp,eg,ep,ev,re,r,rp,chk) function c6733059.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(0)
local cg=Duel.GetMatchingGroup(c6733059.cfilter,tp,LOCATION_GRAVE,0,nil)
local tg=Duel.GetMatchingGroup(c6733059.tfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,cg:GetCount())
if tg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(6733059,0)) then
local lvt={}
local tc=tg:GetFirst()
while tc do
local tlv=tc:GetLevel()
lvt[tlv]=tlv
tc=tg:GetNext()
end
local pc=1
for i=1,12 do
if lvt[i] then lvt[i]=nil lvt[pc]=i pc=pc+1 end
end
lvt[pc]=nil
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(6733059,2))
local lv=Duel.AnnounceNumber(tp,table.unpack(lvt))
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=cg:Select(tp,lv,lv,nil)
Duel.Remove(rg,POS_FACEUP,REASON_COST)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,1,0,0)
Duel.SetTargetParam(lv)
end
end
function c6733059.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local cg=Duel.GetMatchingGroup(c6733059.cfilter,tp,LOCATION_GRAVE,0,nil) local cg=Duel.GetMatchingGroup(c6733059.cfilter,tp,LOCATION_GRAVE,0,nil)
local tg=Duel.GetMatchingGroup(c6733059.tfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,cg:GetCount()) local tg=Duel.GetMatchingGroup(c6733059.tfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,cg:GetCount())
......
...@@ -49,7 +49,7 @@ function c76075139.splimit(e,se,sp,st) ...@@ -49,7 +49,7 @@ function c76075139.splimit(e,se,sp,st)
end end
function c76075139.hspfilter(c,tp,sc) function c76075139.hspfilter(c,tp,sc)
local seq=c:GetSequence() local seq=c:GetSequence()
return (seq==1 or seq==3) and not c:IsFusionType(TYPE_FUSION) and c:IsLevelAbove(5) and c:IsSetCard(0x17d) return (seq==1 or seq==3 or seq>4) and not c:IsFusionType(TYPE_FUSION) and c:IsLevelAbove(5) and c:IsSetCard(0x17d)
and c:IsControler(tp) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0 and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL) and c:IsControler(tp) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0 and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL)
end end
function c76075139.hspcon(e,c) function c76075139.hspcon(e,c)
......
...@@ -4,75 +4,34 @@ function c92408984.initial_effect(c) ...@@ -4,75 +4,34 @@ function c92408984.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c92408984.cost1)
e1:SetTarget(c92408984.target1)
e1:SetOperation(c92408984.operation1)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant(chain) --negate
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(92408984,0)) e2:SetDescription(aux.Stringid(92408984,0))
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_CHAINING) e2:SetCode(EVENT_CHAINING)
e2:SetCondition(c92408984.condition2) e2:SetCondition(c92408984.condition)
e2:SetCost(c92408984.cost2) e2:SetCost(c92408984.cost)
e2:SetTarget(c92408984.target2) e2:SetTarget(c92408984.target)
e2:SetOperation(c92408984.operation2) e2:SetOperation(c92408984.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c92408984.cfilter(c) function c92408984.cfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsRace(RACE_DRAGON) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsRace(RACE_DRAGON)
end end
function c92408984.cost1(e,tp,eg,ep,ev,re,r,rp,chk) function c92408984.condition(e,tp,eg,ep,ev,re,r,rp)
if chk==0 then return true end
e:SetLabel(0)
local ct=Duel.GetCurrentChain()
if ct==1 then return end
local pe=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
if not pe:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end
if not pe:IsHasType(EFFECT_TYPE_ACTIVATE) or not pe:IsActiveType(TYPE_TRAP) then return false end
local tg=Duel.GetChainInfo(ct-1,CHAININFO_TARGET_CARDS)
if not tg or not tg:IsExists(c92408984.cfilter,1,nil) then return false end
if not Duel.IsChainNegatable(ct-1) then return false end
if not Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) then return end
if Duel.SelectYesNo(tp,aux.Stringid(92408984,1)) then
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
e:SetLabel(1)
end
end
function c92408984.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetLabel()~=1 then return end
local ct=Duel.GetCurrentChain()
local te=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
local tc=te:GetHandler()
Duel.SetOperationInfo(0,CATEGORY_DISABLE,tc,1,0,0)
if tc:IsDestructable() then
Duel.SetTargetCard(tc)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0)
end
end
function c92408984.operation1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()~=1 then return end
local ct=Duel.GetChainInfo(0,CHAININFO_CHAIN_COUNT)
local tc=Duel.GetFirstTarget()
if Duel.NegateEffect(ct-1) and tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c92408984.condition2(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end
if not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_TRAP) then return false end if not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_TRAP) then return false end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if not tg or not tg:IsExists(c92408984.cfilter,1,nil) then return false end if not tg or not tg:IsExists(c92408984.cfilter,1,nil) then return false end
return Duel.IsChainNegatable(ev) return Duel.IsChainNegatable(ev)
end end
function c92408984.cost2(e,tp,eg,ep,ev,re,r,rp,chk) function c92408984.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end end
function c92408984.target2(e,tp,eg,ep,ev,re,r,rp,chk) function c92408984.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
if eg:GetFirst():IsLocation(LOCATION_ONFIELD) then if eg:GetFirst():IsLocation(LOCATION_ONFIELD) then
...@@ -80,7 +39,7 @@ function c92408984.target2(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -80,7 +39,7 @@ function c92408984.target2(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end end
end end
function c92408984.operation2(e,tp,eg,ep,ev,re,r,rp) function c92408984.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT) Duel.Destroy(eg,REASON_EFFECT)
......
...@@ -4,20 +4,7 @@ function c93016201.initial_effect(c) ...@@ -4,20 +4,7 @@ function c93016201.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c93016201.cost1)
e1:SetTarget(c93016201.target1)
e1:SetOperation(c93016201.activate1)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--Activate(timing)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(93016201,0))
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_SPSUMMON)
e2:SetCondition(c93016201.condition2)
e2:SetCost(c93016201.cost2)
e2:SetTarget(c93016201.target2)
e2:SetOperation(c93016201.activate2)
c:RegisterEffect(e2)
--instant --instant
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(93016201,0)) e3:SetDescription(aux.Stringid(93016201,0))
...@@ -25,7 +12,7 @@ function c93016201.initial_effect(c) ...@@ -25,7 +12,7 @@ function c93016201.initial_effect(c)
e3:SetRange(LOCATION_SZONE) e3:SetRange(LOCATION_SZONE)
e3:SetProperty(EFFECT_FLAG_BOTH_SIDE) e3:SetProperty(EFFECT_FLAG_BOTH_SIDE)
e3:SetCode(EVENT_SPSUMMON) e3:SetCode(EVENT_SPSUMMON)
e3:SetCondition(c93016201.condition2) e3:SetCondition(aux.NegateSummonCondition)
e3:SetCost(c93016201.cost2) e3:SetCost(c93016201.cost2)
e3:SetTarget(c93016201.target2) e3:SetTarget(c93016201.target2)
e3:SetOperation(c93016201.activate2) e3:SetOperation(c93016201.activate2)
...@@ -43,44 +30,6 @@ function c93016201.initial_effect(c) ...@@ -43,44 +30,6 @@ function c93016201.initial_effect(c)
e4:SetOperation(c93016201.activate3) e4:SetOperation(c93016201.activate3)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
function c93016201.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(0)
if not Duel.CheckLPCost(tp,800) then return end
local ct=Duel.GetCurrentChain()
if ct==1 then return end
local pe=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
if not pe:IsHasCategory(CATEGORY_SPECIAL_SUMMON) then return end
if not Duel.IsChainDisablable(ct-1) then return end
if Duel.SelectYesNo(tp,aux.Stringid(93016201,1)) then
Duel.PayLPCost(tp,800)
e:SetLabel(1)
end
end
function c93016201.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetLabel()~=1 then return end
local ct=Duel.GetCurrentChain()
local te=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
local tc=te:GetHandler()
Duel.SetOperationInfo(0,CATEGORY_DISABLE,tc,1,0,0)
if tc:IsRelateToEffect(te) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0)
end
end
function c93016201.activate1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()~=1 then return end
local ct=Duel.GetChainInfo(0,CHAININFO_CHAIN_COUNT)
local te=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
local tc=te:GetHandler()
if Duel.NegateEffect(ct-1) and tc:IsRelateToEffect(te) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c93016201.condition2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c93016201.cost2(e,tp,eg,ep,ev,re,r,rp,chk) function c93016201.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,800) end if chk==0 then return Duel.CheckLPCost(tp,800) end
Duel.PayLPCost(tp,800) Duel.PayLPCost(tp,800)
......
...@@ -7,67 +7,38 @@ function c99064191.initial_effect(c) ...@@ -7,67 +7,38 @@ function c99064191.initial_effect(c)
e1:SetTarget(c99064191.target1) e1:SetTarget(c99064191.target1)
e1:SetOperation(c99064191.activate1) e1:SetOperation(c99064191.activate1)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant(chain) --negate
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(99064191,0)) e2:SetDescription(aux.Stringid(99064191,0))
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_CHAINING) e2:SetCode(EVENT_CHAINING)
e2:SetCondition(c99064191.condition2) e2:SetCountLimit(1)
e2:SetCost(c99064191.cost2) e2:SetCondition(c99064191.condition)
e2:SetTarget(c99064191.target2) e2:SetCost(c99064191.cost)
e2:SetOperation(c99064191.activate2) e2:SetTarget(c99064191.target)
e2:SetOperation(c99064191.activate)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c99064191.cfilter(c) function c99064191.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) return c:IsFaceup() and c:IsType(TYPE_XYZ)
end end
function c99064191.target1(e,tp,eg,ep,ev,re,r,rp,chk) function c99064191.condition(e,tp,eg,ep,ev,re,r,rp)
if chk==0 then return true end
e:SetLabel(0)
local ct=Duel.GetCurrentChain()
if ct==1 or not Duel.IsExistingMatchingCard(c99064191.cfilter,tp,LOCATION_MZONE,0,1,nil)
or not Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) then return false end
local pe=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
local tc=pe:GetHandler()
if pe:IsActiveType(TYPE_EFFECT) and tc:IsLevelAbove(5)
and Duel.IsChainDisablable(ct-1) and Duel.SelectYesNo(tp,aux.Stringid(99064191,1)) then
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,tc,1,0,0)
if tc:IsRelateToEffect(pe) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0)
end
e:SetLabel(1)
e:GetHandler():RegisterFlagEffect(99064191,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
end
function c99064191.activate1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()~=1 or not c:IsRelateToEffect(e) then return end
local ct=Duel.GetChainInfo(0,CHAININFO_CHAIN_COUNT)
local te=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT)
local tc=te:GetHandler()
if Duel.NegateEffect(ct-1) and tc:IsRelateToEffect(te) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c99064191.condition2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c99064191.cfilter,tp,LOCATION_MZONE,0,1,nil) return Duel.IsExistingMatchingCard(c99064191.cfilter,tp,LOCATION_MZONE,0,1,nil)
and re:IsActiveType(TYPE_EFFECT) and re:GetHandler():IsLevelAbove(5) and Duel.IsChainDisablable(ev) and re:IsActiveType(TYPE_EFFECT) and re:GetHandler():IsLevelAbove(5) and Duel.IsChainDisablable(ev)
end end
function c99064191.cost2(e,tp,eg,ep,ev,re,r,rp,chk) function c99064191.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end end
function c99064191.target2(e,tp,eg,ep,ev,re,r,rp,chk) function c99064191.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(99064191)==0 end if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end end
e:GetHandler():RegisterFlagEffect(99064191,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end end
function c99064191.activate2(e,tp,eg,ep,ev,re,r,rp) function c99064191.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT) Duel.Destroy(eg,REASON_EFFECT)
end end
......
...@@ -334,40 +334,40 @@ function Auxiliary.EnableUnionAttribute(c,filter) ...@@ -334,40 +334,40 @@ function Auxiliary.EnableUnionAttribute(c,filter)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
function Auxiliary.UnionEquipFilter(filter) function Auxiliary.UnionEquipFilter(filter)
return function(c,tp) return function(c,tp)
local ct1,ct2=c:GetUnionCount() local ct1,ct2=c:GetUnionCount()
return c:IsFaceup() and ct2==0 and c:IsControler(tp) and filter(c) return c:IsFaceup() and ct2==0 and c:IsControler(tp) and filter(c)
end end
end end
function Auxiliary.UnionEquipLimit(filter) function Auxiliary.UnionEquipLimit(filter)
return function(e,c) return function(e,c)
return (c:IsControler(e:GetHandlerPlayer()) and filter(c)) or e:GetHandler():GetEquipTarget()==c return (c:IsControler(e:GetHandlerPlayer()) and filter(c)) or e:GetHandler():GetEquipTarget()==c
end end
end end
function Auxiliary.UnionEquipTarget(equip_filter) function Auxiliary.UnionEquipTarget(equip_filter)
return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc) return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler() local c=e:GetHandler()
if chkc then return chkc:IsLocation(LOCATION_MZONE) and equip_filter(chkc,tp) end if chkc then return chkc:IsLocation(LOCATION_MZONE) and equip_filter(chkc,tp) end
if chk==0 then return c:GetFlagEffect(FLAG_ID_UNION)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 if chk==0 then return c:GetFlagEffect(FLAG_ID_UNION)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(equip_filter,tp,LOCATION_MZONE,0,1,c,tp) end and Duel.IsExistingTarget(equip_filter,tp,LOCATION_MZONE,0,1,c,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,equip_filter,tp,LOCATION_MZONE,0,1,1,c,tp) local g=Duel.SelectTarget(tp,equip_filter,tp,LOCATION_MZONE,0,1,1,c,tp)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
c:RegisterFlagEffect(FLAG_ID_UNION,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1) c:RegisterFlagEffect(FLAG_ID_UNION,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end end
end end
function Auxiliary.UnionEquipOperation(equip_filter) function Auxiliary.UnionEquipOperation(equip_filter)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
if not tc:IsRelateToEffect(e) or not equip_filter(tc,tp) then if not tc:IsRelateToEffect(e) or not equip_filter(tc,tp) then
Duel.SendtoGrave(c,REASON_RULE) Duel.SendtoGrave(c,REASON_RULE)
return return
end end
if not Duel.Equip(tp,c,tc,false) then return end if not Duel.Equip(tp,c,tc,false) then return end
Auxiliary.SetUnionState(c) Auxiliary.SetUnionState(c)
end end
end end
function Auxiliary.UnionUnequipTarget(e,tp,eg,ep,ev,re,r,rp,chk) function Auxiliary.UnionUnequipTarget(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
...@@ -913,14 +913,14 @@ function Auxiliary.DrytronSpSummonTarget(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -913,14 +913,14 @@ function Auxiliary.DrytronSpSummonTarget(e,tp,eg,ep,ev,re,r,rp,chk)
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 Auxiliary.DrytronSpSummonOperation(func) function Auxiliary.DrytronSpSummonOperation(func)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,true,POS_FACEUP_DEFENSE)~=0 then if Duel.SpecialSummon(c,0,tp,tp,false,true,POS_FACEUP_DEFENSE)~=0 then
c:CompleteProcedure() c:CompleteProcedure()
func(e,tp) func(e,tp)
end end
end end
end end
---The `nolimit` parameter for Special Summon effects of Drytron cards ---The `nolimit` parameter for Special Summon effects of Drytron cards
---@param c Card ---@param c Card
...@@ -1477,3 +1477,18 @@ function Auxiliary.EPDestroyOperation(e,tp,eg,ep,ev,re,r,rp) ...@@ -1477,3 +1477,18 @@ function Auxiliary.EPDestroyOperation(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tc,REASON_EFFECT,LOCATION_GRAVE) Duel.Destroy(tc,REASON_EFFECT,LOCATION_GRAVE)
end end
end end
--
function Auxiliary.SameValueFilter(f,value)
return function(c)
return f(c)&value==0
end
end
---Check if all cards in g have the same Attribute/Race
---@param g Group
---@param f function
---@return boolean
function Auxiliary.SameValueCheck(g,f)
local tc=g:GetFirst()
local filter=Auxiliary.SameValueFilter(f,f(tc))
return not g:IsExists(filter,1,tc)
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