Commit 44d6dd42 authored by DailyShana's avatar DailyShana

use Duel.CheckChainTarget for effect changing target

parent 216c4754
...@@ -17,9 +17,7 @@ function c1498130.tgcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -17,9 +17,7 @@ function c1498130.tgcon(e,tp,eg,ep,ev,re,r,rp)
local tc=g:GetFirst() local tc=g:GetFirst()
local c=e:GetHandler() local c=e:GetHandler()
if tc==c or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsLocation(LOCATION_MZONE) or not tc:IsSetCard(0x3d) then return false end if tc==c or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsLocation(LOCATION_MZONE) or not tc:IsSetCard(0x3d) then return false end
local tf=re:GetTarget() return Duel.CheckChainTarget(ev,c)
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true)
return tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c)
end end
function c1498130.tgop(e,tp,eg,ep,ev,re,r,rp) function c1498130.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
...@@ -19,16 +19,14 @@ function c17653779.tgcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -19,16 +19,14 @@ function c17653779.tgcon(e,tp,eg,ep,ev,re,r,rp)
e:SetLabelObject(tc) e:SetLabelObject(tc)
return tc:IsLocation(LOCATION_MZONE) return tc:IsLocation(LOCATION_MZONE)
end end
function c17653779.filter(c,re,rp,tf,ceg,cep,cev,cre,cr,crp) function c17653779.filter(c,ct)
return tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) return Duel.CheckChainTarget(ct,c)
end end
function c17653779.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c17653779.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tf=re:GetTarget() if chkc then return chkc~=e:GetLabelObject() and chkc:IsLocation(LOCATION_MZONE) and c17653779.filter(chkc,ev) end
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true) if chk==0 then return Duel.IsExistingTarget(c17653779.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetLabelObject(),ev) end
if chkc then return chkc~=e:GetLabelObject() and chkc:IsLocation(LOCATION_MZONE) and tf(re,rp,ceg,cep,cev,cre,cr,crp,0,chkc) end
if chk==0 then return Duel.IsExistingTarget(c17653779.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c17653779.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp) Duel.SelectTarget(tp,c17653779.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,e:GetLabelObject(),ev)
end end
function c17653779.tgop(e,tp,eg,ep,ev,re,r,rp) function c17653779.tgop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
......
...@@ -28,8 +28,8 @@ function c21501505.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -28,8 +28,8 @@ function c21501505.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end end
function c21501505.filter(c,re,rp,tf,ceg,cep,cev,cre,cr,crp) function c21501505.filter(c,ct)
return tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) return Duel.CheckChainTarget(ct,c)
end end
function c21501505.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c21501505.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ct=ev local ct=ev
...@@ -37,13 +37,10 @@ function c21501505.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -37,13 +37,10 @@ function c21501505.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if label then if label then
if ev==bit.rshift(label,16) then ct=bit.band(label,0xffff) end if ev==bit.rshift(label,16) then ct=bit.band(label,0xffff) end
end end
local ce,cp=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER) if chkc then return chkc:IsOnField() and c21501505.filter(chkc,ct) end
local tf=ce:GetTarget() if chk==0 then return Duel.IsExistingTarget(c21501505.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetLabelObject(),ct) end
local ceg,cep,cev,cre,cr,crp=Duel.GetChainEvent(ct)
if chkc then return chkc:IsOnField() and c21501505.filter(chkc,ce,cp,tf,ceg,cep,cev,cre,cr,crp) end
if chk==0 then return Duel.IsExistingTarget(c21501505.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetLabelObject(),ce,cp,tf,ceg,cep,cev,cre,cr,crp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c21501505.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetLabelObject(),ce,cp,tf,ceg,cep,cev,cre,cr,crp) Duel.SelectTarget(tp,c21501505.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetLabelObject(),ct)
local val=ct+bit.lshift(ev+1,16) local val=ct+bit.lshift(ev+1,16)
if label then if label then
Duel.SetFlagEffectLabel(0,21501505,val) Duel.SetFlagEffectLabel(0,21501505,val)
......
...@@ -19,16 +19,14 @@ function c58607704.tgcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -19,16 +19,14 @@ function c58607704.tgcon(e,tp,eg,ep,ev,re,r,rp)
e:SetLabelObject(tc) e:SetLabelObject(tc)
return tc:IsOnField() and tc:IsType(TYPE_SPELL+TYPE_TRAP) return tc:IsOnField() and tc:IsType(TYPE_SPELL+TYPE_TRAP)
end end
function c58607704.filter(c,re,rp,tf,ceg,cep,cev,cre,cr,crp) function c58607704.filter(c,ct)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) return c:IsType(TYPE_SPELL+TYPE_TRAP) and Duel.CheckChainTarget(ct,c)
end end
function c58607704.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c58607704.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tf=re:GetTarget() if chkc then return chkc~=e:GetLabelObject() and chkc:IsOnField() and c58607704.filter(chkc,ev) end
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true) if chk==0 then return Duel.IsExistingTarget(c58607704.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetLabelObject(),ev) end
if chkc then return chkc~=e:GetLabelObject() and chkc:IsOnField() and chkc:IsType(TYPE_SPELL+TYPE_TRAP) and tf(re,rp,ceg,cep,cev,cre,cr,crp,0,chkc) end
if chk==0 then return Duel.IsExistingTarget(c58607704.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c58607704.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp) Duel.SelectTarget(tp,c58607704.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetLabelObject(),ev)
end end
function c58607704.tgop(e,tp,eg,ep,ev,re,r,rp) function c58607704.tgop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
......
...@@ -45,16 +45,12 @@ function c59170782.tgcon1(e,tp,eg,ep,ev,re,r,rp) ...@@ -45,16 +45,12 @@ function c59170782.tgcon1(e,tp,eg,ep,ev,re,r,rp)
local tc=g:GetFirst() local tc=g:GetFirst()
local c=e:GetHandler() local c=e:GetHandler()
if tc==c or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsLocation(LOCATION_MZONE) or not tc:IsSetCard(0x74) then return false end if tc==c or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsLocation(LOCATION_MZONE) or not tc:IsSetCard(0x74) then return false end
local tf=re:GetTarget() return Duel.CheckChainTarget(ev,c)
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true)
return tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c)
end end
function c59170782.tgop1(e,tp,eg,ep,ev,re,r,rp) function c59170782.tgop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) then if c:IsRelateToEffect(e) then
local tf=re:GetTarget() if Duel.CheckChainTarget(ev,c) then
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true)
if tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) then
local g=Group.CreateGroup() local g=Group.CreateGroup()
g:AddCard(c) g:AddCard(c)
Duel.ChangeTargetCard(ev,g) Duel.ChangeTargetCard(ev,g)
......
...@@ -49,16 +49,14 @@ function c59560625.condition2(e,tp,eg,ep,ev,re,r,rp) ...@@ -49,16 +49,14 @@ function c59560625.condition2(e,tp,eg,ep,ev,re,r,rp)
e:SetLabelObject(tc) e:SetLabelObject(tc)
return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE) return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE)
end end
function c59560625.filter2(c,re,rp,tf,ceg,cep,cev,cre,cr,crp) function c59560625.filter2(c,ct)
return tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) return Duel.CheckChainTarget(ct,c)
end end
function c59560625.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c59560625.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tf=re:GetTarget() if chkc then return chkc~=e:GetLabelObject() and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c59560625.filter2(chkc,ev) end
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true) if chk==0 then return Duel.IsExistingTarget(c59560625.filter2,tp,LOCATION_MZONE,0,1,e:GetLabelObject(),ev) end
if chkc then return chkc~=e:GetLabelObject() and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and tf(re,rp,ceg,cep,cev,cre,cr,crp,0,chkc) end
if chk==0 then return Duel.IsExistingTarget(c59560625.filter2,tp,LOCATION_MZONE,0,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c59560625.filter2,tp,LOCATION_MZONE,0,1,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp) Duel.SelectTarget(tp,c59560625.filter2,tp,LOCATION_MZONE,0,1,1,e:GetLabelObject(),ev)
end end
function c59560625.activate2(e,tp,eg,ep,ev,re,r,rp) function c59560625.activate2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
......
...@@ -18,20 +18,18 @@ function c61656650.efcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -18,20 +18,18 @@ function c61656650.efcon(e,tp,eg,ep,ev,re,r,rp)
local ex,dg=Duel.GetOperationInfo(0,CATEGORY_DESTROY) local ex,dg=Duel.GetOperationInfo(0,CATEGORY_DESTROY)
return tc:IsControler(tp) and dg and dg:GetCount()==1 and dg:GetFirst()==tc and tc:IsType(TYPE_MONSTER) return tc:IsControler(tp) and dg and dg:GetCount()==1 and dg:GetFirst()==tc and tc:IsType(TYPE_MONSTER)
end end
function c61656650.filter(c,re,rp,tf) function c61656650.filter(c,ct)
return tf(re,rp,nil,nil,nil,nil,nil,nil,0,c) return Duel.CheckChainTarget(ct,c)
end end
function c61656650.eftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c61656650.eftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
local tf=re:GetTarget() if chk==0 then return Duel.IsExistingTarget(c61656650.filter,tp,0,LOCATION_MZONE,1,nil,ev) end
if chk==0 then return Duel.IsExistingTarget(c61656650.filter,tp,0,LOCATION_MZONE,1,nil,re,rp,tf) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c61656650.filter,tp,0,LOCATION_MZONE,1,1,nil,re,rp,tf) Duel.SelectTarget(tp,c61656650.filter,tp,0,LOCATION_MZONE,1,1,nil,ev)
end end
function c61656650.efop(e,tp,eg,ep,ev,re,r,rp) function c61656650.efop(e,tp,eg,ep,ev,re,r,rp)
local tf=re:GetTarget()
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tf(re,rp,nil,nil,nil,nil,nil,nil,0,tc) then if tc:IsRelateToEffect(e) and Duel.CheckChainTarget(ev,tc) then
local g=Group.FromCards(tc) local g=Group.FromCards(tc)
Duel.ChangeTargetCard(ev,g) Duel.ChangeTargetCard(ev,g)
end end
......
...@@ -67,16 +67,14 @@ function c68823957.cecon(e,tp,eg,ep,ev,re,r,rp) ...@@ -67,16 +67,14 @@ function c68823957.cecon(e,tp,eg,ep,ev,re,r,rp)
e:SetLabelObject(tc) e:SetLabelObject(tc)
return tc:IsLocation(LOCATION_MZONE) and tc:IsFacedown() return tc:IsLocation(LOCATION_MZONE) and tc:IsFacedown()
end end
function c68823957.cefilter(c,re,rp,tf,ceg,cep,cev,cre,cr,crp,oc) function c68823957.cefilter(c,ct,oc)
return oc~=c and tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) return oc~=c and Duel.CheckChainTarget(ct,c)
end end
function c68823957.cetg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c68823957.cetg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tf=re:GetTarget() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c68823957.cefilter(chkc,ev,e:GetHandler()) end
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true) if chk==0 then return Duel.IsExistingTarget(c68823957.cefilter,tp,LOCATION_MZONE,0,1,e:GetLabelObject(),ev,e:GetHandler()) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c68823957.cefilter(chkc,re,rp,tf,ceg,cep,cev,cre,cr,crp) end
if chk==0 then return Duel.IsExistingTarget(c68823957.cefilter,tp,LOCATION_MZONE,0,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c68823957.cefilter,tp,LOCATION_MZONE,0,1,1,e:GetLabelObject(),re,rp,tf,ceg,cep,cev,cre,cr,crp,e:GetHandler()) Duel.SelectTarget(tp,c68823957.cefilter,tp,LOCATION_MZONE,0,1,1,e:GetLabelObject(),ev,e:GetHandler())
end end
function c68823957.ceop(e,tp,eg,ep,ev,re,r,rp) function c68823957.ceop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
......
...@@ -78,16 +78,14 @@ function c81983656.cecon(e,tp,eg,ep,ev,re,r,rp) ...@@ -78,16 +78,14 @@ function c81983656.cecon(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return g and g:GetCount()==1 and g:GetFirst()==e:GetHandler() return g and g:GetCount()==1 and g:GetFirst()==e:GetHandler()
end end
function c81983656.cefilter(c,re,rp,tf,ceg,cep,cev,cre,cr,crp) function c81983656.cefilter(c,ct)
return c:IsFaceup() and c:IsSetCard(0x33) and tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) return c:IsFaceup() and c:IsSetCard(0x33) and Duel.CheckChainTarget(ct,c)
end end
function c81983656.cetg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c81983656.cetg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tf=re:GetTarget() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c81983656.cefilter(chkc,ev) end
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true) if chk==0 then return Duel.IsExistingTarget(c81983656.cefilter,tp,LOCATION_MZONE,0,1,e:GetHandler(),ev) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c81983656.cefilter(chkc,re,rp,tf,ceg,cep,cev,cre,cr,crp) end
if chk==0 then return Duel.IsExistingTarget(c81983656.cefilter,tp,LOCATION_MZONE,0,1,e:GetHandler(),re,rp,tf,ceg,cep,cev,cre,cr,crp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c81983656.cefilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),re,rp,tf,ceg,cep,cev,cre,cr,crp) Duel.SelectTarget(tp,c81983656.cefilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),ev)
end end
function c81983656.ceop(e,tp,eg,ep,ev,re,r,rp) function c81983656.ceop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
......
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