Commit 02401a9c authored by Nemo Ma's avatar Nemo Ma

fix

parent 0a729313
...@@ -197,12 +197,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -197,12 +197,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(re3) do for _,te3 in pairs(re3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,te,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,te,tp) then
if not tg or tg(te3,e,tp) then local tg=te3:GetTarget()
table.insert(t1,te3) if not tg or tg(te3,e,tp) then
table.insert(t2,5) table.insert(t1,te3)
table.insert(t2,5)
end
end end
end end
end end
...@@ -219,12 +221,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -219,12 +221,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(ae3) do for _,te3 in pairs(ae3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,de,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,de,tp) then
if not tg or tg(te3,de,tp) then local tg=te3:GetTarget()
table.insert(t3,te3) if not tg or tg(te3,de,tp) then
table.insert(t4,5) table.insert(t3,te3)
table.insert(t4,5)
end
end end
end end
end end
...@@ -283,13 +287,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -283,13 +287,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret2[k]==5 then if ret2[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,te,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,te,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,false)) if not tg then
elseif tg(v,te,tp) then v:SetTarget(cm.chtg2(aux.TRUE,false))
v:SetTarget(cm.chtg2(tg,false)) elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end end
end end
end end
...@@ -303,13 +309,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -303,13 +309,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret4[k]==5 then if ret4[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,de,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,de,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,true)) if not tg then
elseif tg(v,de,tp) then v:SetTarget(cm.chtg2(aux.TRUE,true))
v:SetTarget(cm.chtg2(tg,true)) elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end end
end end
end end
...@@ -337,12 +345,12 @@ function cm.chtg(_tg,res) ...@@ -337,12 +345,12 @@ function cm.chtg(_tg,res)
end end
function cm.chval(_val,res) function cm.chval(_val,res)
return function(e,re,...) return function(e,re,...)
local x=re local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() else if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50) local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect() re=rc:GetActivateEffect()
end else return res end
if x:IsHasEffect(m) then return res end if x and x:IsHasEffect(m) then return res end
return _val(e,re,...) return _val(e,re,...)
end end
end end
......
...@@ -60,7 +60,7 @@ function cm.chainfilter(re,tp,cid) ...@@ -60,7 +60,7 @@ function cm.chainfilter(re,tp,cid)
return not re:IsActiveType(TYPE_MONSTER) return not re:IsActiveType(TYPE_MONSTER)
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local cost=Duel.GetMatchingGroup(function(c)return c:IsSetCard(0x553b) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,nil) local cost=Duel.GetMatchingGroup(function(c)return c:IsSetCard(0x553b) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,e:GetHandler())
if chk==0 then return #cost>0 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end if chk==0 then return #cost>0 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=cost:Select(tp,1,1,e:GetHandler()) local g=cost:Select(tp,1,1,e:GetHandler())
...@@ -202,12 +202,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -202,12 +202,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(re3) do for _,te3 in pairs(re3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,te,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,te,tp) then
if not tg or tg(te3,e,tp) then local tg=te3:GetTarget()
table.insert(t1,te3) if not tg or tg(te3,e,tp) then
table.insert(t2,5) table.insert(t1,te3)
table.insert(t2,5)
end
end end
end end
end end
...@@ -224,12 +226,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -224,12 +226,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(ae3) do for _,te3 in pairs(ae3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,de,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,de,tp) then
if not tg or tg(te3,de,tp) then local tg=te3:GetTarget()
table.insert(t3,te3) if not tg or tg(te3,de,tp) then
table.insert(t4,5) table.insert(t3,te3)
table.insert(t4,5)
end
end end
end end
end end
...@@ -288,13 +292,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -288,13 +292,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret2[k]==5 then if ret2[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,te,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,te,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,false)) if not tg then
elseif tg(v,te,tp) then v:SetTarget(cm.chtg2(aux.TRUE,false))
v:SetTarget(cm.chtg2(tg,false)) elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end end
end end
end end
...@@ -308,13 +314,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -308,13 +314,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret4[k]==5 then if ret4[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,de,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,de,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,true)) if not tg then
elseif tg(v,de,tp) then v:SetTarget(cm.chtg2(aux.TRUE,true))
v:SetTarget(cm.chtg2(tg,true)) elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end end
end end
end end
...@@ -342,12 +350,12 @@ function cm.chtg(_tg,res) ...@@ -342,12 +350,12 @@ function cm.chtg(_tg,res)
end end
function cm.chval(_val,res) function cm.chval(_val,res)
return function(e,re,...) return function(e,re,...)
local x=re local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() else if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50) local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect() re=rc:GetActivateEffect()
end else return res end
if x:IsHasEffect(m) then return res end if x and x:IsHasEffect(m) then return res end
return _val(e,re,...) return _val(e,re,...)
end end
end end
......
...@@ -56,7 +56,7 @@ function cm.chainfilter(re,tp,cid) ...@@ -56,7 +56,7 @@ function cm.chainfilter(re,tp,cid)
return not re:IsActiveType(TYPE_MONSTER) return not re:IsActiveType(TYPE_MONSTER)
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local cost=Duel.GetMatchingGroup(function(c)return c:IsType(TYPE_CONTINUOUS) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,nil) local cost=Duel.GetMatchingGroup(function(c)return c:IsType(TYPE_CONTINUOUS) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,e:GetHandler())
if chk==0 then return #cost>2 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end if chk==0 then return #cost>2 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=cost:Select(tp,3,3,e:GetHandler()) local g=cost:Select(tp,3,3,e:GetHandler())
...@@ -143,14 +143,15 @@ function cm.regop(e,tp,eg,ep,ev,re,r,rp) ...@@ -143,14 +143,15 @@ function cm.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+(m+50*e:GetLabel()),re,r,rp,ep,ev) Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+(m+50*e:GetLabel()),re,r,rp,ep,ev)
e:Reset() e:Reset()
end end
function cm.filter(c,e) function cm.filter(c,e,tp)
local ct,se,p=e:GetLabel() local ct,se,p=e:GetLabel()
local seq=c:GetSequence() local seq=c:GetSequence()
if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end
return seq<5 and math.abs(se-math.abs(seq-4))==0 and c:IsAbleToGrave() if c:GetControler()~=tp then seq=math.abs(seq-4) end
return seq<5 and math.abs(se-seq)==0 and c:IsAbleToGrave()
end end
function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return cm.filter(chkc,e) and chkc:IsOnField() end if chkc then return cm.filter(chkc,e,tp) and chkc:IsOnField() end
local c=e:GetHandler() local c=e:GetHandler()
local ct,se,p=e:GetLabel() local ct,se,p=e:GetLabel()
if chk==0 then if chk==0 then
...@@ -162,10 +163,10 @@ function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -162,10 +163,10 @@ function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
break break
end end
end end
return res and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,e) and c:IsLocation(LOCATION_GRAVE+LOCATION_MZONE) and c:GetType()&0x20004==0x20004 and c:GetControler()==p return res and Duel.IsExistingTarget(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler(),e,tp) and c:IsLocation(LOCATION_GRAVE+LOCATION_MZONE) and c:GetType()&0x20004==0x20004 and c:GetControler()==p
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,e) local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler(),e,tp)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
local le={Duel.IsPlayerAffectedByEffect(tp,m)} local le={Duel.IsPlayerAffectedByEffect(tp,m)}
...@@ -313,12 +314,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -313,12 +314,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(re3) do for _,te3 in pairs(re3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,te,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,te,tp) then
if not tg or tg(te3,e,tp) then local tg=te3:GetTarget()
table.insert(t1,te3) if not tg or tg(te3,e,tp) then
table.insert(t2,5) table.insert(t1,te3)
table.insert(t2,5)
end
end end
end end
end end
...@@ -336,12 +339,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -336,12 +339,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(ae3) do for _,te3 in pairs(ae3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,de,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,de,tp) then
if not tg or tg(te3,de,tp) then local tg=te3:GetTarget()
table.insert(t3,te3) if not tg or tg(te3,de,tp) then
table.insert(t4,5) table.insert(t3,te3)
table.insert(t4,5)
end
end end
end end
end end
...@@ -400,13 +405,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -400,13 +405,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret2[k]==5 then if ret2[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,te,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,te,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,false)) if not tg then
elseif tg(v,te,tp) then v:SetTarget(cm.chtg2(aux.TRUE,false))
v:SetTarget(cm.chtg2(tg,false)) elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end end
end end
end end
...@@ -420,13 +427,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -420,13 +427,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret4[k]==5 then if ret4[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,de,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,de,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,true)) if not tg then
elseif tg(v,de,tp) then v:SetTarget(cm.chtg2(aux.TRUE,true))
v:SetTarget(cm.chtg2(tg,true)) elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end end
end end
end end
...@@ -454,12 +463,12 @@ function cm.chtg(_tg,res) ...@@ -454,12 +463,12 @@ function cm.chtg(_tg,res)
end end
function cm.chval(_val,res) function cm.chval(_val,res)
return function(e,re,...) return function(e,re,...)
local x=re local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() else if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50) local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect() re=rc:GetActivateEffect()
end else return res end
if x:IsHasEffect(m) then return res end if x and x:IsHasEffect(m) then return res end
return _val(e,re,...) return _val(e,re,...)
end end
end end
......
...@@ -56,7 +56,7 @@ function cm.chainfilter(re,tp,cid) ...@@ -56,7 +56,7 @@ function cm.chainfilter(re,tp,cid)
return not re:IsActiveType(TYPE_MONSTER) return not re:IsActiveType(TYPE_MONSTER)
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local cost=Duel.GetMatchingGroup(function(c)return c:IsType(TYPE_CONTINUOUS) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,nil) local cost=Duel.GetMatchingGroup(function(c)return c:IsType(TYPE_CONTINUOUS) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,e:GetHandler())
if chk==0 then return #cost>2 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end if chk==0 then return #cost>2 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=cost:Select(tp,3,3,e:GetHandler()) local g=cost:Select(tp,3,3,e:GetHandler())
...@@ -140,14 +140,15 @@ function cm.regop(e,tp,eg,ep,ev,re,r,rp) ...@@ -140,14 +140,15 @@ function cm.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+(m+50*e:GetLabel()),re,r,rp,ep,ev) Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+(m+50*e:GetLabel()),re,r,rp,ep,ev)
e:Reset() e:Reset()
end end
function cm.filter(c,e) function cm.filter(c,e,tp)
local ct,se,p=e:GetLabel() local ct,se,p=e:GetLabel()
local seq=c:GetSequence() local seq=c:GetSequence()
if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end
return seq<5 and math.abs(se-math.abs(seq-4))==1 and c:IsAbleToHand() if c:GetControler()~=tp then seq=math.abs(seq-4) end
return seq<5 and math.abs(se-seq)==1 and c:IsAbleToHand()
end end
function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return cm.filter(chkc,e) and chkc:IsOnField() end if chkc then return cm.filter(chkc,e,tp) and chkc:IsOnField() end
local c=e:GetHandler() local c=e:GetHandler()
local ct,se,p=e:GetLabel() local ct,se,p=e:GetLabel()
if chk==0 then if chk==0 then
...@@ -159,10 +160,10 @@ function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -159,10 +160,10 @@ function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
break break
end end
end end
return res and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,e) and c:IsLocation(LOCATION_REMOVED) and c:GetType()&0x20004==0x20004 and c:GetControler()==p return res and Duel.IsExistingTarget(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler(),e,tp) and c:IsLocation(LOCATION_REMOVED) and c:GetType()&0x20004==0x20004 and c:GetControler()==p
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,e) local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler(),e,tp)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
local le={Duel.IsPlayerAffectedByEffect(tp,m)} local le={Duel.IsPlayerAffectedByEffect(tp,m)}
...@@ -306,12 +307,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -306,12 +307,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(re3) do for _,te3 in pairs(re3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,te,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,te,tp) then
if not tg or tg(te3,e,tp) then local tg=te3:GetTarget()
table.insert(t1,te3) if not tg or tg(te3,e,tp) then
table.insert(t2,5) table.insert(t1,te3)
table.insert(t2,5)
end
end end
end end
end end
...@@ -329,12 +332,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -329,12 +332,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(ae3) do for _,te3 in pairs(ae3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,de,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,de,tp) then
if not tg or tg(te3,de,tp) then local tg=te3:GetTarget()
table.insert(t3,te3) if not tg or tg(te3,de,tp) then
table.insert(t4,5) table.insert(t3,te3)
table.insert(t4,5)
end
end end
end end
end end
...@@ -393,13 +398,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -393,13 +398,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret2[k]==5 then if ret2[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,te,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,te,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,false)) if not tg then
elseif tg(v,te,tp) then v:SetTarget(cm.chtg2(aux.TRUE,false))
v:SetTarget(cm.chtg2(tg,false)) elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end end
end end
end end
...@@ -413,13 +420,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -413,13 +420,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret4[k]==5 then if ret4[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,de,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,de,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,true)) if not tg then
elseif tg(v,de,tp) then v:SetTarget(cm.chtg2(aux.TRUE,true))
v:SetTarget(cm.chtg2(tg,true)) elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end end
end end
end end
...@@ -447,12 +456,12 @@ function cm.chtg(_tg,res) ...@@ -447,12 +456,12 @@ function cm.chtg(_tg,res)
end end
function cm.chval(_val,res) function cm.chval(_val,res)
return function(e,re,...) return function(e,re,...)
local x=re local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() else if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50) local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect() re=rc:GetActivateEffect()
end else return res end
if x:IsHasEffect(m) then return res end if x and x:IsHasEffect(m) then return res end
return _val(e,re,...) return _val(e,re,...)
end end
end end
......
...@@ -55,7 +55,7 @@ function cm.chainfilter(re,tp,cid) ...@@ -55,7 +55,7 @@ function cm.chainfilter(re,tp,cid)
return not re:IsActiveType(TYPE_MONSTER) return not re:IsActiveType(TYPE_MONSTER)
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local cost=Duel.GetMatchingGroup(function(c)return c:IsSetCard(0x353b) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,nil) local cost=Duel.GetMatchingGroup(function(c)return c:IsSetCard(0x353b) and c:IsReleasable()end,tp,LOCATION_ONFIELD,0,e:GetHandler())
if chk==0 then return #cost>1 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end if chk==0 then return #cost>1 and not e:GetHandler():IsForbidden() and e:GetHandler():CheckUniqueOnField(tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=cost:Select(tp,2,2,e:GetHandler()) local g=cost:Select(tp,2,2,e:GetHandler())
...@@ -169,12 +169,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -169,12 +169,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(re3) do for _,te3 in pairs(re3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,te,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,te,tp) then
if not tg or tg(te3,e,tp) then local tg=te3:GetTarget()
table.insert(t1,te3) if not tg or tg(te3,e,tp) then
table.insert(t2,5) table.insert(t1,te3)
table.insert(t2,5)
end
end end
end end
end end
...@@ -191,12 +193,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -191,12 +193,14 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
for _,te3 in pairs(ae3) do for _,te3 in pairs(ae3) do
local cost=te3:GetCost() if not te3:GetLabelObject() then
if cost and not cost(te3,de,tp) then local cost=te3:GetCost()
local tg=te3:GetTarget() if cost and not cost(te3,de,tp) then
if not tg or tg(te3,de,tp) then local tg=te3:GetTarget()
table.insert(t3,te3) if not tg or tg(te3,de,tp) then
table.insert(t4,5) table.insert(t3,te3)
table.insert(t4,5)
end
end end
end end
end end
...@@ -255,13 +259,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -255,13 +259,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret2[k]==5 then if ret2[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,te,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,te,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,false)) if not tg then
elseif tg(v,te,tp) then v:SetTarget(cm.chtg2(aux.TRUE,false))
v:SetTarget(cm.chtg2(tg,false)) elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end end
end end
end end
...@@ -275,13 +281,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -275,13 +281,15 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
if ret4[k]==5 then if ret4[k]==5 then
local cost=v:GetCost() if not v:GetLabelObject() then
if cost and not cost(v,de,tp) then local cost=v:GetCost()
local tg=v:GetTarget() if cost and not cost(v,de,tp) then
if not tg then local tg=v:GetTarget()
v:SetTarget(cm.chtg2(aux.TRUE,true)) if not tg then
elseif tg(v,de,tp) then v:SetTarget(cm.chtg2(aux.TRUE,true))
v:SetTarget(cm.chtg2(tg,true)) elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end end
end end
end end
...@@ -309,12 +317,12 @@ function cm.chtg(_tg,res) ...@@ -309,12 +317,12 @@ function cm.chtg(_tg,res)
end end
function cm.chval(_val,res) function cm.chval(_val,res)
return function(e,re,...) return function(e,re,...)
local x=re local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() else if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50) local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect() re=rc:GetActivateEffect()
end else return res end
if x:IsHasEffect(m) then return res end if x and x:IsHasEffect(m) then return res end
return _val(e,re,...) return _val(e,re,...)
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