Commit b75f1ffd authored by DailyShana's avatar DailyShana

update special summoning to specific zone

for monster determined to summon before chain solving,
check zone is non empty before summoning to avoid sent to grave;
for selecting monster to summon in chain solving,
check location count before selecting
parent 37ac21d4
...@@ -26,10 +26,8 @@ function c15627227.initial_effect(c) ...@@ -26,10 +26,8 @@ function c15627227.initial_effect(c)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c15627227.spfilter1(c,e,tp) function c15627227.spfilter1(c,e,tp)
if c:IsFaceup() and c:IsType(TYPE_LINK) then return c:IsFaceup() and c:IsType(TYPE_LINK)
local zone=c:GetLinkedZone(tp) and Duel.IsExistingMatchingCard(c15627227.spfilter2,tp,LOCATION_HAND,0,1,nil,e,tp,c:GetLinkedZone(tp))
return zone~=0 and Duel.IsExistingMatchingCard(c15627227.spfilter2,tp,LOCATION_HAND,0,1,nil,e,tp,zone)
else return false end
end end
function c15627227.spfilter2(c,e,tp,zone) function c15627227.spfilter2(c,e,tp,zone)
return c:IsSetCard(0x102) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) return c:IsSetCard(0x102) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)
...@@ -47,7 +45,7 @@ function c15627227.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -47,7 +45,7 @@ function c15627227.spop(e,tp,eg,ep,ev,re,r,rp)
local lc=Duel.GetFirstTarget() local lc=Duel.GetFirstTarget()
if lc:IsRelateToEffect(e) and lc:IsFaceup() then if lc:IsRelateToEffect(e) and lc:IsFaceup() then
local zone=lc:GetLinkedZone(tp) local zone=lc:GetLinkedZone(tp)
if zone==0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,c15627227.spfilter2,tp,LOCATION_HAND,0,1,1,nil,e,tp,zone):GetFirst() local tc=Duel.SelectMatchingCard(tp,c15627227.spfilter2,tp,LOCATION_HAND,0,1,1,nil,e,tp,zone):GetFirst()
if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) then if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) then
......
...@@ -20,8 +20,8 @@ function c28174796.spcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -20,8 +20,8 @@ function c28174796.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c28174796.cfilter,tp,LOCATION_MZONE,0,2,nil) return Duel.IsExistingMatchingCard(c28174796.cfilter,tp,LOCATION_MZONE,0,2,nil)
end end
function c28174796.spfilter(c,e,tp,ec) function c28174796.spfilter(c,e,tp,ec)
local zone=bit.band(c:GetLinkedZone(tp),0x1f) local zone=c:GetLinkedZone(tp)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER) and c:IsType(TYPE_LINK) and zone>0 and ec:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER) and c:IsType(TYPE_LINK) and ec:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)
end end
function c28174796.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c28174796.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler() local c=e:GetHandler()
...@@ -34,16 +34,15 @@ end ...@@ -34,16 +34,15 @@ end
function c28174796.spop(e,tp,eg,ep,ev,re,r,rp) function c28174796.spop(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 c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then local zone=tc:GetLinkedZone(tp)
local zone=bit.band(tc:GetLinkedZone(tp),0x1f) if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and zone&0x1f~=0
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone)>0 then and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone)>0 then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetReset(RESET_EVENT+RESETS_REDIRECT)
e1:SetValue(LOCATION_REMOVED) e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1,true) c:RegisterEffect(e1,true)
end
end end
end end
...@@ -42,14 +42,13 @@ function c40216089.spfilter1(c,e,tp,zone) ...@@ -42,14 +42,13 @@ function c40216089.spfilter1(c,e,tp,zone)
return c:IsRace(RACE_MACHINE) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) return c:IsRace(RACE_MACHINE) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)
end end
function c40216089.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) function c40216089.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x1f) local zone=e:GetHandler():GetLinkedZone(tp)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.IsExistingMatchingCard(c40216089.spfilter1,tp,LOCATION_HAND,0,1,nil,e,tp,zone) end
and Duel.IsExistingMatchingCard(c40216089.spfilter1,tp,LOCATION_HAND,0,1,nil,e,tp,zone) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end end
function c40216089.spop1(e,tp,eg,ep,ev,re,r,rp) function c40216089.spop1(e,tp,eg,ep,ev,re,r,rp)
local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x1f) local zone=e:GetHandler():GetLinkedZone(tp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or zone<=0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c40216089.spfilter1,tp,LOCATION_HAND,0,1,1,nil,e,tp,zone) local g=Duel.SelectMatchingCard(tp,c40216089.spfilter1,tp,LOCATION_HAND,0,1,1,nil,e,tp,zone)
if g:GetCount()>0 then if g:GetCount()>0 then
......
...@@ -24,14 +24,14 @@ function c45462149.filter(c,e,tp,zone) ...@@ -24,14 +24,14 @@ function c45462149.filter(c,e,tp,zone)
end end
function c45462149.target(e,tp,eg,ep,ev,re,r,rp,chk) function c45462149.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local zone=e:GetHandler():GetLinkedZone(tp)&0x1f local zone=e:GetHandler():GetLinkedZone(tp)
return zone~=0 and Duel.IsExistingMatchingCard(c45462149.filter,tp,LOCATION_HAND,0,1,nil,e,tp,zone) return Duel.IsExistingMatchingCard(c45462149.filter,tp,LOCATION_HAND,0,1,nil,e,tp,zone)
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end end
function c45462149.operation(e,tp,eg,ep,ev,re,r,rp) function c45462149.operation(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetHandler():GetLinkedZone(tp)&0x1f local zone=e:GetHandler():GetLinkedZone(tp)
if zone~=0 then if Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c45462149.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,zone) local g=Duel.SelectMatchingCard(tp,c45462149.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,zone)
if g:GetCount()>0 then if g:GetCount()>0 then
......
...@@ -68,7 +68,7 @@ end ...@@ -68,7 +68,7 @@ end
function c4709881.spop1(e,tp,eg,ep,ev,re,r,rp) function c4709881.spop1(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetHandler():GetLinkedZone(tp) local zone=e:GetHandler():GetLinkedZone(tp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then if tc:IsRelateToEffect(e) and zone&0x1f~=0 then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone)
end end
end end
......
...@@ -54,6 +54,7 @@ function c56003780.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -54,6 +54,7 @@ function c56003780.spop(e,tp,eg,ep,ev,re,r,rp)
zone=bit.bor(zone,tc:GetLinkedZone(tp)) zone=bit.bor(zone,tc:GetLinkedZone(tp))
end end
zone=bit.band(zone,0x1f) zone=bit.band(zone,0x1f)
if zone==0 then return end
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP,zone) Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP,zone)
end end
end end
...@@ -32,8 +32,7 @@ end ...@@ -32,8 +32,7 @@ end
function c66015185.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c66015185.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local zone=e:GetHandler():GetLinkedZone(tp) local zone=e:GetHandler():GetLinkedZone(tp)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c66015185.filter(chkc,e,tp,zone) end if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c66015185.filter(chkc,e,tp,zone) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.IsExistingTarget(c66015185.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,zone) end
and Duel.IsExistingTarget(c66015185.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,zone) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c66015185.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) local g=Duel.SelectTarget(tp,c66015185.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
...@@ -42,7 +41,7 @@ function c66015185.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -42,7 +41,7 @@ function c66015185.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local zone=c:GetLinkedZone(tp) local zone=c:GetLinkedZone(tp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) then if tc:IsRelateToEffect(e) and zone&0x1f~=0 and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE) e1:SetCode(EFFECT_DISABLE)
......
...@@ -67,19 +67,17 @@ end ...@@ -67,19 +67,17 @@ end
function c71278040.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) function c71278040.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
if eg:GetCount()~=1 then return false end if eg:GetCount()~=1 then return false end
local tc=eg:GetFirst() local tc=eg:GetFirst()
local zone=bit.band(tc:GetLinkedZone(tp),0x1f) local zone=tc:GetLinkedZone(tp)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0 if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end
Duel.SetTargetCard(tc) Duel.SetTargetCard(tc)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end end
function c71278040.spop1(e,tp,eg,ep,ev,re,r,rp) function c71278040.spop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) then local tc=Duel.GetFirstTarget()
local tc=Duel.GetFirstTarget() local zone=tc:GetLinkedZone(tp)
if not tc:IsRelateToEffect(e) then return end if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and zone&0x1f~=0 then
local zone=bit.band(tc:GetLinkedZone(tp),0x1f)
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone) Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone)
end end
end end
......
...@@ -45,7 +45,7 @@ function c76685519.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -45,7 +45,7 @@ function c76685519.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local zone=c:GetLinkedZone(tp) local zone=c:GetLinkedZone(tp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone)~=0 then if tc:IsRelateToEffect(e) and zone&0x1f~=0 and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone)~=0 then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetCode(EFFECT_CANNOT_ATTACK)
......
...@@ -38,13 +38,12 @@ function c86148577.spfilter(c,e,tp,zone) ...@@ -38,13 +38,12 @@ function c86148577.spfilter(c,e,tp,zone)
end end
function c86148577.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c86148577.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local zone=aux.GetMultiLinkedZone(tp) local zone=aux.GetMultiLinkedZone(tp)
if chk==0 then return zone~=0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.IsExistingMatchingCard(c86148577.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp,zone) end
and Duel.IsExistingMatchingCard(c86148577.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp,zone) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end end
function c86148577.spop(e,tp,eg,ep,ev,re,r,rp) function c86148577.spop(e,tp,eg,ep,ev,re,r,rp)
local zone=aux.GetMultiLinkedZone(tp) local zone=aux.GetMultiLinkedZone(tp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or zone==0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c86148577.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp,zone) local g=Duel.SelectMatchingCard(tp,c86148577.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp,zone)
if g:GetCount()>0 then if g:GetCount()>0 then
......
...@@ -43,10 +43,9 @@ function c86926989.filter(c,e,tp,zone) ...@@ -43,10 +43,9 @@ function c86926989.filter(c,e,tp,zone)
return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)
end end
function c86926989.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c86926989.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local zone=e:GetHandler():GetLinkedZone(tp)&0x1f local zone=e:GetHandler():GetLinkedZone(tp)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c86926989.filter(chkc,e,tp,zone) end if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c86926989.filter(chkc,e,tp,zone) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.IsExistingTarget(c86926989.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp,zone) end
and Duel.IsExistingTarget(c86926989.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp,zone) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c86926989.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp,zone) local g=Duel.SelectTarget(tp,c86926989.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp,zone)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
...@@ -54,8 +53,8 @@ end ...@@ -54,8 +53,8 @@ end
function c86926989.operation(e,tp,eg,ep,ev,re,r,rp) function c86926989.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
local zone=c:GetLinkedZone(tp)&0x1f local zone=c:GetLinkedZone(tp)
if tc and tc:IsRelateToEffect(e) and zone~=0 then if tc:IsRelateToEffect(e) and zone&0x1f~=0 then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone)
end end
end end
...@@ -47,7 +47,7 @@ end ...@@ -47,7 +47,7 @@ end
function c96380700.spop(e,tp,eg,ep,ev,re,r,rp) function c96380700.spop(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetHandler():GetLinkedZone(tp) local zone=e:GetHandler():GetLinkedZone(tp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then if tc:IsRelateToEffect(e) and zone&0x1f~=0 then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone)
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