Commit 2b7078dc authored by wind2009's avatar wind2009

simplify script

parent f10a475f
...@@ -135,31 +135,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -135,31 +135,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minc,maxc,alterf,alterdesc,alterop) function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minc,maxc,alterf,alterdesc,alterop)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then if og and not min then
if og:GetCount()<maxc and og:GetCount()>=minc and maxc==minc+2 then Auxiliary.Drake_Solve(tp,og,maxc,minc)
local et=maxc-og:GetCount()
local exg=og:Filter(Card.IsHasEffect,nil,81096431,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if et==0 or 2-et==ext then
for ttc in aux.Next(og) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
local tc=og:GetFirst() local tc=og:GetFirst()
while tc do while tc do
...@@ -172,31 +148,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -172,31 +148,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
Duel.Overlay(c,og) Duel.Overlay(c,og)
else else
local mg=e:GetLabelObject() local mg=e:GetLabelObject()
if mg:GetCount()<maxc and mg:GetCount()>=minc and maxc==minc+2 then Auxiliary.Drake_Solve(tp,mg,maxc,minc)
local et=maxc-mg:GetCount()
local exg=mg:Filter(Card.IsHasEffect,nil,81096431,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if et==0 or 2-et==ext then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
if e:GetLabel()==1 then if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup() local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then if mg2:GetCount()~=0 then
...@@ -225,31 +177,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -225,31 +177,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
function Auxiliary.XyzLevelFreeOperation(f,gf,minct,maxct) function Auxiliary.XyzLevelFreeOperation(f,gf,minct,maxct)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then if og and not min then
if og:GetCount()<maxct and og:GetCount()>=minct and maxct==minct+2 then Auxiliary.Drake_Solve(tp,og,maxct,minct)
local et=maxct-og:GetCount()
local exg=og:Filter(Card.IsHasEffect,nil,81096431,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if et==0 or 2-et==ext then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
local tc=og:GetFirst() local tc=og:GetFirst()
while tc do while tc do
...@@ -262,31 +190,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -262,31 +190,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
Duel.Overlay(c,og) Duel.Overlay(c,og)
else else
local mg=e:GetLabelObject() local mg=e:GetLabelObject()
if mg:GetCount()<maxct and mg:GetCount()>=minct and maxct==minct+2 then Auxiliary.Drake_Solve(tp,mg,maxct,minct)
local et=maxct-mg:GetCount()
local exg=mg:Filter(Card.IsHasEffect,nil,81096431,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if (et==0 or 2-et==ext) and exg then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
if e:GetLabel()==1 then if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup() local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then if mg2:GetCount()~=0 then
...@@ -332,3 +236,30 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -332,3 +236,30 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
end end
e:Reset() e:Reset()
end end
function Auxiliary.Drake_Solve(tp,g,maxct,minct)
if g:GetCount()<maxct and g:GetCount()>=minct and maxct==minct+2 then
local et=maxct-g:GetCount()
local exg=g:Filter(Card.IsHasEffect,nil,81096431,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if (et==0 or 2-et==ext) and #exg>0 then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
end
\ No newline at end of file
...@@ -91,31 +91,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -91,31 +91,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minc,maxc,alterf,alterdesc,alterop) function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minc,maxc,alterf,alterdesc,alterop)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then if og and not min then
if og:GetCount()<maxc and og:GetCount()>=minc and maxc==minc+2 then Auxiliary.Drake_Solve(tp,og,maxc,minc)
local et=maxc-og:GetCount()
local exg=og:Filter(Card.IsHasEffect,nil,id,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if et==0 or 2-et==ext then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
local tc=og:GetFirst() local tc=og:GetFirst()
while tc do while tc do
...@@ -128,31 +104,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -128,31 +104,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
Duel.Overlay(c,og) Duel.Overlay(c,og)
else else
local mg=e:GetLabelObject() local mg=e:GetLabelObject()
if mg:GetCount()<maxc and mg:GetCount()>=minc and maxc==minc+2 then Auxiliary.Drake_Solve(tp,mg,maxc,minc)
local et=maxc-mg:GetCount()
local exg=mg:Filter(Card.IsHasEffect,nil,id,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if et==0 or 2-et==ext then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
if e:GetLabel()==1 then if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup() local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then if mg2:GetCount()~=0 then
...@@ -181,31 +133,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -181,31 +133,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
function Auxiliary.XyzLevelFreeOperation(f,gf,minct,maxct) function Auxiliary.XyzLevelFreeOperation(f,gf,minct,maxct)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then if og and not min then
if og:GetCount()<maxct and og:GetCount()>=minct and maxct==minct+2 then Auxiliary.Drake_Solve(tp,og,maxct,minct)
local et=maxct-og:GetCount()
local exg=og:Filter(Card.IsHasEffect,nil,id,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if et==0 or 2-et==ext then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
local tc=og:GetFirst() local tc=og:GetFirst()
while tc do while tc do
...@@ -218,31 +146,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -218,31 +146,7 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
Duel.Overlay(c,og) Duel.Overlay(c,og)
else else
local mg=e:GetLabelObject() local mg=e:GetLabelObject()
if mg:GetCount()<maxct and mg:GetCount()>=minct and maxct==minct+2 then Auxiliary.Drake_Solve(tp,mg,maxct,minct)
local et=maxct-mg:GetCount()
local exg=mg:Filter(Card.IsHasEffect,nil,id,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if et==0 or 2-et==ext then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(id,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
if e:GetLabel()==1 then if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup() local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then if mg2:GetCount()~=0 then
...@@ -328,3 +232,30 @@ function s.xyzop(e,tp,eg,ep,ev,re,r,rp) ...@@ -328,3 +232,30 @@ function s.xyzop(e,tp,eg,ep,ev,re,r,rp)
Duel.Overlay(c,Group.FromCards(tc)) Duel.Overlay(c,Group.FromCards(tc))
end end
end end
function Auxiliary.Drake_Solve(tp,g,maxct,minct)
if g:GetCount()<maxct and g:GetCount()>=minct and maxct==minct+2 then
local et=maxct-g:GetCount()
local exg=g:Filter(Card.IsHasEffect,nil,81096431,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if (et==0 or 2-et==ext) and #exg>0 then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
else
local st=2-et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
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