Commit 1a395486 authored by DailyShana's avatar DailyShana

fix swap control

parent 667e2194
...@@ -13,13 +13,18 @@ function c13532663.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -13,13 +13,18 @@ function c13532663.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_CONTROL,nil,0,0,0) Duel.SetOperationInfo(0,CATEGORY_CONTROL,nil,0,0,0)
end end
function c13532663.filter(c)
local tp=c:GetControler()
return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end
function c13532663.operation(e,tp,eg,ep,ev,re,r,rp) function c13532663.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsStatus(STATUS_BATTLE_DESTROYED) or not c:IsRelateToEffect(e) or not c:IsAbleToChangeControler() if c:IsStatus(STATUS_BATTLE_DESTROYED) or not c:IsRelateToEffect(e)
or not Duel.IsExistingMatchingCard(Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,nil) then or not c:IsAbleToChangeControler() or Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)<=0
or not Duel.IsExistingMatchingCard(c13532663.filter,tp,0,LOCATION_MZONE,1,nil) then
return return
end end
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONTROL) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONTROL)
local g=Duel.SelectMatchingCard(1-tp,Card.IsAbleToChangeControler,1-tp,LOCATION_MZONE,0,1,1,nil) local g=Duel.SelectMatchingCard(1-tp,c13532663.filter,1-tp,LOCATION_MZONE,0,1,1,nil)
Duel.SwapControl(c,g:GetFirst(),0,0) Duel.SwapControl(c,g:GetFirst(),0,0)
end end
...@@ -10,7 +10,9 @@ function c15305240.initial_effect(c) ...@@ -10,7 +10,9 @@ function c15305240.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c15305240.filter(c) function c15305240.filter(c)
local tp=c:GetControler()
return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsAbleToChangeControler() return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsAbleToChangeControler()
and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c15305240.target(e,tp,eg,ep,ev,re,r,rp,chk) function c15305240.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c15305240.filter,tp,LOCATION_MZONE,0,1,nil) if chk==0 then return Duel.IsExistingMatchingCard(c15305240.filter,tp,LOCATION_MZONE,0,1,nil)
......
...@@ -43,14 +43,20 @@ function c15308295.initial_effect(c) ...@@ -43,14 +43,20 @@ function c15308295.initial_effect(c)
c:RegisterEffect(e5) c:RegisterEffect(e5)
end end
function c15308295.ctfilter(c) function c15308295.ctfilter(c)
local tp=c:GetControler()
return c:IsFaceup() and c:IsSetCard(0x10ec) and c:IsType(TYPE_PENDULUM) and c:IsAbleToChangeControler() return c:IsFaceup() and c:IsSetCard(0x10ec) and c:IsType(TYPE_PENDULUM) and c:IsAbleToChangeControler()
and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end
function c15308295.ctfilter2(c)
local tp=c:GetControler()
return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c15308295.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c15308295.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,nil) if chk==0 then return Duel.IsExistingTarget(c15308295.ctfilter2,tp,0,LOCATION_MZONE,1,nil)
and Duel.IsExistingTarget(c15308295.ctfilter,tp,LOCATION_MZONE,0,1,nil) end and Duel.IsExistingTarget(c15308295.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g1=Duel.SelectTarget(tp,Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,1,nil) local g1=Duel.SelectTarget(tp,c15308295.ctfilter2,tp,0,LOCATION_MZONE,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g2=Duel.SelectTarget(tp,c15308295.ctfilter,tp,LOCATION_MZONE,0,1,1,nil) local g2=Duel.SelectTarget(tp,c15308295.ctfilter,tp,LOCATION_MZONE,0,1,1,nil)
g1:Merge(g2) g1:Merge(g2)
......
...@@ -18,7 +18,9 @@ function c30426226.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -18,7 +18,9 @@ function c30426226.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g1=g:Filter(Card.IsControler,nil,tp) local g1=g:Filter(Card.IsControler,nil,tp)
local g2=g:Filter(Card.IsControler,nil,1-tp) local g2=g:Filter(Card.IsControler,nil,1-tp)
if chk==0 then return g1:GetCount()==g2:GetCount() if chk==0 then return g1:GetCount()==g2:GetCount()
and g:FilterCount(c30426226.filter,nil)==0 end and g:FilterCount(c30426226.filter,nil)==0
and Duel.GetMZoneCount(tp,g1,tp,LOCATION_REASON_CONTROL)>=g2:GetCount()
and Duel.GetMZoneCount(1-tp,g2,1-tp,LOCATION_REASON_CONTROL)>=g1:GetCount() end
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,g:GetCount(),0,0)
end end
function c30426226.activate(e,tp,eg,ep,ev,re,r,rp) function c30426226.activate(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -12,7 +12,8 @@ function c3056267.initial_effect(c) ...@@ -12,7 +12,8 @@ function c3056267.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c3056267.swapfilter(c) function c3056267.swapfilter(c)
return c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c3056267.condition(e) function c3056267.condition(e)
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
...@@ -21,7 +22,8 @@ end ...@@ -21,7 +22,8 @@ end
function c3056267.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c3056267.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
if chk==0 then return true end if chk==0 then return true end
if Duel.IsExistingTarget(c3056267.swapfilter,tp,0,LOCATION_MZONE,1,nil) then if Duel.GetMZoneCount(tp,e:GetHandler(),tp,LOCATION_REASON_CONTROL)>0
and Duel.IsExistingTarget(c3056267.swapfilter,tp,0,LOCATION_MZONE,1,nil) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local mon=Duel.SelectTarget(tp,c3056267.swapfilter,tp,0,LOCATION_MZONE,1,1,nil) local mon=Duel.SelectTarget(tp,c3056267.swapfilter,tp,0,LOCATION_MZONE,1,1,nil)
mon:AddCard(e:GetHandler()) mon:AddCard(e:GetHandler())
......
...@@ -20,10 +20,13 @@ function c36331074.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -20,10 +20,13 @@ function c36331074.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SendtoDeck(g,nil,1,REASON_COST) Duel.SendtoDeck(g,nil,1,REASON_COST)
end end
function c36331074.filter1(c) function c36331074.filter1(c)
return c:IsFaceup() and c:IsSetCard(0x10) and c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsFaceup() and c:IsSetCard(0x10)
and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c36331074.filter2(c) function c36331074.filter2(c)
return c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c36331074.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c36331074.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
......
...@@ -17,8 +17,8 @@ end ...@@ -17,8 +17,8 @@ end
function c43452193.target(e,tp,eg,ep,ev,re,r,rp,chk) function c43452193.target(e,tp,eg,ep,ev,re,r,rp,chk)
local a=Duel.GetAttacker() local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget() local at=Duel.GetAttackTarget()
if chk==0 then return a:IsOnField() and a:IsAbleToChangeControler() if chk==0 then return a:IsOnField() and a:IsAbleToChangeControler() and Duel.GetMZoneCount(1-tp,a,1-tp,LOCATION_REASON_CONTROL)>0
and at:IsOnField() and at:IsAbleToChangeControler() end and at:IsOnField() and at:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,at,tp,LOCATION_REASON_CONTROL)>0 end
local g=Group.FromCards(a,at) local g=Group.FromCards(a,at)
Duel.SetTargetCard(g) Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,2,0,0) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,2,0,0)
......
...@@ -18,10 +18,13 @@ function c52430902.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -18,10 +18,13 @@ function c52430902.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.PayLPCost(tp,1000) Duel.PayLPCost(tp,1000)
end end
function c52430902.filter1(c) function c52430902.filter1(c)
return c:IsFaceup() and c:IsRace(RACE_PSYCHO) and c:GetCode()~=52430902 and c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsFaceup() and c:IsRace(RACE_PSYCHO) and c:GetCode()~=52430902
and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c52430902.filter2(c) function c52430902.filter2(c)
return c:IsFaceup() and c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsFaceup() and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c52430902.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c52430902.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
......
...@@ -12,10 +12,12 @@ function c57384901.initial_effect(c) ...@@ -12,10 +12,12 @@ function c57384901.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c57384901.filter1(c) function c57384901.filter1(c)
return c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c57384901.filter2(c) function c57384901.filter2(c)
return c:GetCounter(0x100e)>0 and c:IsAbleToChangeControler() local tp=c:GetControler()
return c:GetCounter(0x100e)>0 and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c57384901.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c57384901.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
......
...@@ -12,7 +12,9 @@ function c66604523.initial_effect(c) ...@@ -12,7 +12,9 @@ function c66604523.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c66604523.filter(c) function c66604523.filter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsFaceup() and c:IsType(TYPE_XYZ)
and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c66604523.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c66604523.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
......
...@@ -36,10 +36,13 @@ function c6917479.ctcost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -36,10 +36,13 @@ function c6917479.ctcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.PayLPCost(tp,1000) Duel.PayLPCost(tp,1000)
end end
function c6917479.ctfilter1(c) function c6917479.ctfilter1(c)
return c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c6917479.ctfilter2(c) function c6917479.ctfilter2(c)
local tp=c:GetControler()
return c:IsFaceup() and c:IsSetCard(0x8e) and c:IsAbleToChangeControler() return c:IsFaceup() and c:IsSetCard(0x8e) and c:IsAbleToChangeControler()
and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c6917479.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c6917479.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
......
...@@ -12,10 +12,13 @@ function c76641981.initial_effect(c) ...@@ -12,10 +12,13 @@ function c76641981.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c76641981.filter1(c) function c76641981.filter1(c)
return c:IsFaceup() and c:IsSetCard(0x27) and c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsFaceup() and c:IsSetCard(0x27)
and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c76641981.filter2(c) function c76641981.filter2(c)
return c:IsAbleToChangeControler() local tp=c:GetControler()
return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0
end end
function c76641981.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c76641981.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false 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