Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-scripts
Commits
aa4ff6cc
Commit
aa4ff6cc
authored
Feb 19, 2019
by
mercury233
Committed by
GitHub
Feb 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Group.SelectSubGroup (#1151)
Skip cards which had been proved to be selectable or not selectable.
parent
2612ab25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
utility.lua
utility.lua
+32
-2
No files found.
utility.lua
View file @
aa4ff6cc
...
@@ -2008,6 +2008,7 @@ function Auxiliary.GetMultiLinkedZone(tp)
...
@@ -2008,6 +2008,7 @@ function Auxiliary.GetMultiLinkedZone(tp)
end
end
return
multi_linked_zone
return
multi_linked_zone
end
end
Auxiliary
.
SubGroupCaptured
=
nil
function
Auxiliary
.
CheckGroupRecursive
(
c
,
sg
,
g
,
f
,
min
,
max
,
ext_params
)
function
Auxiliary
.
CheckGroupRecursive
(
c
,
sg
,
g
,
f
,
min
,
max
,
ext_params
)
sg
:
AddCard
(
c
)
sg
:
AddCard
(
c
)
local
res
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
table.unpack
(
ext_params
)))
local
res
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
table.unpack
(
ext_params
)))
...
@@ -2015,6 +2016,18 @@ function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
...
@@ -2015,6 +2016,18 @@ function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
sg
:
RemoveCard
(
c
)
sg
:
RemoveCard
(
c
)
return
res
return
res
end
end
function
Auxiliary
.
CheckGroupRecursiveCapture
(
c
,
sg
,
g
,
f
,
min
,
max
,
ext_params
)
sg
:
AddCard
(
c
)
local
res
=#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
table.unpack
(
ext_params
))
if
res
then
Auxiliary
.
SubGroupCaptured
:
Clear
()
Auxiliary
.
SubGroupCaptured
:
Merge
(
sg
)
else
res
=#
sg
<
max
and
g
:
IsExists
(
Auxiliary
.
CheckGroupRecursiveCapture
,
1
,
sg
,
sg
,
g
,
f
,
min
,
max
,
ext_params
)
end
sg
:
RemoveCard
(
c
)
return
res
end
function
Group
.
CheckSubGroup
(
g
,
f
,
min
,
max
,
...
)
function
Group
.
CheckSubGroup
(
g
,
f
,
min
,
max
,
...
)
local
min
=
min
or
1
local
min
=
min
or
1
local
max
=
max
or
#
g
local
max
=
max
or
#
g
...
@@ -2023,9 +2036,15 @@ function Group.CheckSubGroup(g,f,min,max,...)
...
@@ -2023,9 +2036,15 @@ function Group.CheckSubGroup(g,f,min,max,...)
local
sg
=
Duel
.
GrabSelectedCard
()
local
sg
=
Duel
.
GrabSelectedCard
()
if
#
sg
>
max
or
#
(
g
+
sg
)
<
min
or
#
sg
==
max
and
not
f
(
sg
,
...
)
then
return
false
end
if
#
sg
>
max
or
#
(
g
+
sg
)
<
min
or
#
sg
==
max
and
not
f
(
sg
,
...
)
then
return
false
end
if
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
)
then
return
true
end
if
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
)
then
return
true
end
return
g
:
IsExists
(
Auxiliary
.
CheckGroupRecursive
,
1
,
sg
,
sg
,
g
,
f
,
min
,
max
,
ext_params
)
local
eg
=
g
:
Clone
()
for
c
in
aux
.
Next
(
g
-
sg
)
do
if
Auxiliary
.
CheckGroupRecursive
(
c
,
sg
,
eg
,
f
,
min
,
max
,
ext_params
)
then
return
true
end
eg
:
RemoveCard
(
c
)
end
return
false
end
end
function
Group
.
SelectSubGroup
(
g
,
tp
,
f
,
cancelable
,
min
,
max
,
...
)
function
Group
.
SelectSubGroup
(
g
,
tp
,
f
,
cancelable
,
min
,
max
,
...
)
Auxiliary
.
SubGroupCaptured
=
Group
.
CreateGroup
()
local
min
=
min
or
1
local
min
=
min
or
1
local
max
=
max
or
#
g
local
max
=
max
or
#
g
local
ext_params
=
{
...
}
local
ext_params
=
{
...
}
...
@@ -2038,7 +2057,18 @@ function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
...
@@ -2038,7 +2057,18 @@ function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
sg
:
Merge
(
fg
)
sg
:
Merge
(
fg
)
local
finish
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
))
local
finish
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
))
while
#
sg
<
max
do
while
#
sg
<
max
do
local
cg
=
g
:
Filter
(
Auxiliary
.
CheckGroupRecursive
,
sg
,
sg
,
g
,
f
,
min
,
max
,
ext_params
)
local
cg
=
Group
.
CreateGroup
()
local
eg
=
g
:
Clone
()
for
c
in
aux
.
Next
(
g
-
sg
)
do
if
not
cg
:
IsContains
(
c
)
then
if
Auxiliary
.
CheckGroupRecursiveCapture
(
c
,
sg
,
eg
,
f
,
min
,
max
,
ext_params
)
then
cg
:
Merge
(
Auxiliary
.
SubGroupCaptured
)
else
eg
:
RemoveCard
(
c
)
end
end
end
cg
:
Sub
(
sg
)
finish
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
))
finish
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
))
if
#
cg
==
0
then
break
end
if
#
cg
==
0
then
break
end
local
cancel
=
not
finish
and
cancelable
local
cancel
=
not
finish
and
cancelable
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment