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
88ce3d3f
Commit
88ce3d3f
authored
Sep 24, 2023
by
mercury233
Committed by
GitHub
Sep 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more `Duel.Is` functions (#512)
parent
e670b330
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
libduel.cpp
libduel.cpp
+42
-0
scriptlib.h
scriptlib.h
+4
-0
No files found.
libduel.cpp
View file @
88ce3d3f
...
@@ -44,6 +44,16 @@ int32 scriptlib::duel_set_lp(lua_State *L) {
...
@@ -44,6 +44,16 @@ int32 scriptlib::duel_set_lp(lua_State *L) {
pduel
->
write_buffer32
(
lp
);
pduel
->
write_buffer32
(
lp
);
return
0
;
return
0
;
}
}
int32
scriptlib
::
duel_is_turn_player
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
infos
.
turn_player
==
playerid
)
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
duel_get_turn_player
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_turn_player
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
infos
.
turn_player
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
infos
.
turn_player
);
...
@@ -2234,6 +2244,34 @@ int32 scriptlib::duel_get_targets_relate_to_chain(lua_State* L) {
...
@@ -2234,6 +2244,34 @@ int32 scriptlib::duel_get_targets_relate_to_chain(lua_State* L) {
interpreter
::
group2value
(
L
,
pgroup
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_is_phase
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
pphase
=
(
uint32
)
lua_tointeger
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
infos
.
phase
==
pphase
)
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
duel_is_main_phase
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint16
phase
=
pduel
->
game_field
->
infos
.
phase
;
if
(
phase
==
PHASE_MAIN1
||
phase
==
PHASE_MAIN2
)
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
duel_is_battle_phase
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint16
phase
=
pduel
->
game_field
->
infos
.
phase
;
if
((
phase
>=
PHASE_BATTLE_START
)
&&
(
phase
<=
PHASE_BATTLE
))
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
duel_get_current_phase
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_current_phase
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
infos
.
phase
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
infos
.
phase
);
...
@@ -4642,6 +4680,7 @@ static const struct luaL_Reg duellib[] = {
...
@@ -4642,6 +4680,7 @@ static const struct luaL_Reg duellib[] = {
{
"EnableGlobalFlag"
,
scriptlib
::
duel_enable_global_flag
},
{
"EnableGlobalFlag"
,
scriptlib
::
duel_enable_global_flag
},
{
"GetLP"
,
scriptlib
::
duel_get_lp
},
{
"GetLP"
,
scriptlib
::
duel_get_lp
},
{
"SetLP"
,
scriptlib
::
duel_set_lp
},
{
"SetLP"
,
scriptlib
::
duel_set_lp
},
{
"IsTurnPlayer"
,
scriptlib
::
duel_is_turn_player
},
{
"GetTurnPlayer"
,
scriptlib
::
duel_get_turn_player
},
{
"GetTurnPlayer"
,
scriptlib
::
duel_get_turn_player
},
{
"GetTurnCount"
,
scriptlib
::
duel_get_turn_count
},
{
"GetTurnCount"
,
scriptlib
::
duel_get_turn_count
},
{
"GetDrawCount"
,
scriptlib
::
duel_get_draw_count
},
{
"GetDrawCount"
,
scriptlib
::
duel_get_draw_count
},
...
@@ -4741,6 +4780,9 @@ static const struct luaL_Reg duellib[] = {
...
@@ -4741,6 +4780,9 @@ static const struct luaL_Reg duellib[] = {
{
"GetChainEvent"
,
scriptlib
::
duel_get_chain_event
},
{
"GetChainEvent"
,
scriptlib
::
duel_get_chain_event
},
{
"GetFirstTarget"
,
scriptlib
::
duel_get_first_target
},
{
"GetFirstTarget"
,
scriptlib
::
duel_get_first_target
},
{
"GetTargetsRelateToChain"
,
scriptlib
::
duel_get_targets_relate_to_chain
},
{
"GetTargetsRelateToChain"
,
scriptlib
::
duel_get_targets_relate_to_chain
},
{
"IsPhase"
,
scriptlib
::
duel_is_phase
},
{
"IsMainPhase"
,
scriptlib
::
duel_is_main_phase
},
{
"IsBattlePhase"
,
scriptlib
::
duel_is_battle_phase
},
{
"GetCurrentPhase"
,
scriptlib
::
duel_get_current_phase
},
{
"GetCurrentPhase"
,
scriptlib
::
duel_get_current_phase
},
{
"SkipPhase"
,
scriptlib
::
duel_skip_phase
},
{
"SkipPhase"
,
scriptlib
::
duel_skip_phase
},
{
"IsDamageCalculated"
,
scriptlib
::
duel_is_damage_calculated
},
{
"IsDamageCalculated"
,
scriptlib
::
duel_is_damage_calculated
},
...
...
scriptlib.h
View file @
88ce3d3f
...
@@ -387,6 +387,7 @@ public:
...
@@ -387,6 +387,7 @@ public:
static
int32
duel_enable_global_flag
(
lua_State
*
L
);
static
int32
duel_enable_global_flag
(
lua_State
*
L
);
static
int32
duel_get_lp
(
lua_State
*
L
);
static
int32
duel_get_lp
(
lua_State
*
L
);
static
int32
duel_set_lp
(
lua_State
*
L
);
static
int32
duel_set_lp
(
lua_State
*
L
);
static
int32
duel_is_turn_player
(
lua_State
*
L
);
static
int32
duel_get_turn_player
(
lua_State
*
L
);
static
int32
duel_get_turn_player
(
lua_State
*
L
);
static
int32
duel_get_turn_count
(
lua_State
*
L
);
static
int32
duel_get_turn_count
(
lua_State
*
L
);
static
int32
duel_get_draw_count
(
lua_State
*
L
);
static
int32
duel_get_draw_count
(
lua_State
*
L
);
...
@@ -487,6 +488,9 @@ public:
...
@@ -487,6 +488,9 @@ public:
static
int32
duel_get_chain_event
(
lua_State
*
L
);
static
int32
duel_get_chain_event
(
lua_State
*
L
);
static
int32
duel_get_first_target
(
lua_State
*
L
);
static
int32
duel_get_first_target
(
lua_State
*
L
);
static
int32
duel_get_targets_relate_to_chain
(
lua_State
*
L
);
static
int32
duel_get_targets_relate_to_chain
(
lua_State
*
L
);
static
int32
duel_is_phase
(
lua_State
*
L
);
static
int32
duel_is_main_phase
(
lua_State
*
L
);
static
int32
duel_is_battle_phase
(
lua_State
*
L
);
static
int32
duel_get_current_phase
(
lua_State
*
L
);
static
int32
duel_get_current_phase
(
lua_State
*
L
);
static
int32
duel_skip_phase
(
lua_State
*
L
);
static
int32
duel_skip_phase
(
lua_State
*
L
);
static
int32
duel_is_damage_calculated
(
lua_State
*
L
);
static
int32
duel_is_damage_calculated
(
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