Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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
List
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
nanahira
ygopro-core
Commits
aaf48f68
Commit
aaf48f68
authored
Jan 25, 2024
by
Uytrewq
Committed by
GitHub
Jan 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Group.CancelableSelect (#539)
parent
c98d8359
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
libgroup.cpp
libgroup.cpp
+41
-0
scriptlib.h
scriptlib.h
+1
-0
No files found.
libgroup.cpp
View file @
aaf48f68
...
...
@@ -374,6 +374,46 @@ int32 scriptlib::group_random_select(lua_State *L) {
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
}
int32
scriptlib
::
group_cancelable_select
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
field
::
card_set
cset
(
pgroup
->
container
);
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
5
,
TRUE
))
{
card
*
pexception
=
*
(
card
**
)
lua_touserdata
(
L
,
5
);
cset
.
erase
(
pexception
);
}
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
5
,
TRUE
))
{
group
*
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
for
(
auto
&
pcard
:
pexgroup
->
container
)
cset
.
erase
(
pcard
);
}
duel
*
pduel
=
pgroup
->
pduel
;
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
min
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint32
max
=
(
uint32
)
lua_tointeger
(
L
,
4
);
pduel
->
game_field
->
core
.
select_cards
.
clear
();
for
(
auto
&
pcard
:
cset
)
{
pduel
->
game_field
->
core
.
select_cards
.
push_back
(
pcard
);
}
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_CARD
,
0
,
0
,
0
,
playerid
+
0x10000
,
min
+
(
max
<<
16
));
return
lua_yieldk
(
L
,
0
,
(
lua_KContext
)
pduel
,
[](
lua_State
*
L
,
int32
status
,
lua_KContext
ctx
)
{
duel
*
pduel
=
(
duel
*
)
ctx
;
if
(
pduel
->
game_field
->
returns
.
bvalue
[
0
]
==
-
1
)
{
lua_pushnil
(
L
);
}
else
{
group
*
pgroup
=
pduel
->
new_group
();
for
(
int32
i
=
0
;
i
<
pduel
->
game_field
->
returns
.
bvalue
[
0
];
++
i
)
{
card
*
pcard
=
pduel
->
game_field
->
core
.
select_cards
[
pduel
->
game_field
->
returns
.
bvalue
[
i
+
1
]];
pgroup
->
container
.
insert
(
pcard
);
}
interpreter
::
group2value
(
L
,
pgroup
);
}
return
1
;
});
}
int32
scriptlib
::
group_is_exists
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
...
...
@@ -890,6 +930,7 @@ static const struct luaL_Reg grouplib[] = {
{
"Select"
,
scriptlib
::
group_select
},
{
"SelectUnselect"
,
scriptlib
::
group_select_unselect
},
{
"RandomSelect"
,
scriptlib
::
group_random_select
},
{
"CancelableSelect"
,
scriptlib
::
group_cancelable_select
},
{
"IsExists"
,
scriptlib
::
group_is_exists
},
{
"CheckWithSumEqual"
,
scriptlib
::
group_check_with_sum_equal
},
{
"SelectWithSumEqual"
,
scriptlib
::
group_select_with_sum_equal
},
...
...
scriptlib.h
View file @
aaf48f68
...
...
@@ -371,6 +371,7 @@ public:
static
int32
group_select
(
lua_State
*
L
);
static
int32
group_select_unselect
(
lua_State
*
L
);
static
int32
group_random_select
(
lua_State
*
L
);
static
int32
group_cancelable_select
(
lua_State
*
L
);
static
int32
group_is_exists
(
lua_State
*
L
);
static
int32
group_check_with_sum_equal
(
lua_State
*
L
);
static
int32
group_select_with_sum_equal
(
lua_State
*
L
);
...
...
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