Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
5be1c7d0
You need to sign in or sign up before continuing.
Commit
5be1c7d0
authored
Oct 28, 2017
by
Momobako
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updc
parent
d3e8fa81
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
2 deletions
+62
-2
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+3
-0
ocgcore/libduel.cpp
ocgcore/libduel.cpp
+55
-1
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+4
-1
No files found.
ocgcore/interpreter.cpp
View file @
5be1c7d0
...
...
@@ -358,6 +358,8 @@ static const struct luaL_Reg duellib[] = {
{
"RegisterFlagEffect"
,
scriptlib
::
duel_register_flag_effect
},
{
"GetFlagEffect"
,
scriptlib
::
duel_get_flag_effect
},
{
"ResetFlagEffect"
,
scriptlib
::
duel_reset_flag_effect
},
{
"SetFlagEffectLabel"
,
scriptlib
::
duel_set_flag_effect_label
},
{
"GetFlagEffectLabel"
,
scriptlib
::
duel_get_flag_effect_label
},
{
"Destroy"
,
scriptlib
::
duel_destroy
},
{
"Remove"
,
scriptlib
::
duel_remove
},
{
"SendtoGrave"
,
scriptlib
::
duel_sendto_grave
},
...
...
@@ -442,6 +444,7 @@ static const struct luaL_Reg duellib[] = {
{
"CheckLocation"
,
scriptlib
::
duel_check_location
},
{
"GetCurrentChain"
,
scriptlib
::
duel_get_current_chain
},
{
"GetChainInfo"
,
scriptlib
::
duel_get_chain_info
},
{
"GetChainEvent"
,
scriptlib
::
duel_get_chain_event
},
{
"GetFirstTarget"
,
scriptlib
::
duel_get_first_target
},
{
"GetCurrentPhase"
,
scriptlib
::
duel_get_current_phase
},
{
"SkipPhase"
,
scriptlib
::
duel_skip_phase
},
...
...
ocgcore/libduel.cpp
View file @
5be1c7d0
...
...
@@ -89,6 +89,9 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) {
int32
reset
=
lua_tointeger
(
L
,
3
);
int32
flag
=
lua_tointeger
(
L
,
4
);
int32
count
=
lua_tointeger
(
L
,
5
);
int32
lab
=
0
;
if
(
lua_gettop
(
L
)
>=
6
)
lab
=
lua_tointeger
(
L
,
6
);
if
(
count
==
0
)
count
=
1
;
if
(
reset
&
(
RESET_PHASE
)
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
...
...
@@ -105,6 +108,7 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) {
peffect
->
s_range
=
1
;
peffect
->
o_range
=
0
;
peffect
->
reset_count
=
count
;
peffect
->
label
=
lab
;
pduel
->
game_field
->
add_effect
(
peffect
,
playerid
);
interpreter
::
effect2value
(
L
,
peffect
);
return
1
;
...
...
@@ -132,11 +136,46 @@ int32 scriptlib::duel_reset_flag_effect(lua_State *L) {
for
(;
pr
.
first
!=
pr
.
second
;
)
{
auto
rm
=
pr
.
first
++
;
effect
*
peffect
=
rm
->
second
;
if
(
peffect
->
code
==
code
)
if
(
peffect
->
code
==
code
&&
peffect
->
is_target_player
(
playerid
)
)
pduel
->
game_field
->
remove_effect
(
peffect
);
}
return
0
;
}
int32
scriptlib
::
duel_set_flag_effect_label
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
lab
=
lua_tointeger
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
if
(
!
eset
.
size
())
lua_pushboolean
(
L
,
FALSE
);
else
{
eset
[
0
]
->
label
=
lab
;
lua_pushboolean
(
L
,
TRUE
);
}
return
1
;
}
int32
scriptlib
::
duel_get_flag_effect_label
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
if
(
!
eset
.
size
())
{
lua_pushnil
(
L
);
return
1
;
}
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
lua_pushinteger
(
L
,
eset
[
i
]
->
label
);
return
eset
.
size
();
}
int32
scriptlib
::
duel_destroy
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
...
...
@@ -1824,6 +1863,21 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) {
}
return
args
;
}
int32
scriptlib
::
duel_get_chain_event
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
count
=
lua_tointeger
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
count
);
if
(
!
ch
)
return
0
;
interpreter
::
group2value
(
L
,
ch
->
evt
.
event_cards
);
lua_pushinteger
(
L
,
ch
->
evt
.
event_player
);
lua_pushinteger
(
L
,
ch
->
evt
.
event_value
);
interpreter
::
effect2value
(
L
,
ch
->
evt
.
reason_effect
);
lua_pushinteger
(
L
,
ch
->
evt
.
reason
);
lua_pushinteger
(
L
,
ch
->
evt
.
reason_player
);
return
6
;
}
int32
scriptlib
::
duel_get_first_target
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
...
...
ocgcore/scriptlib.h
View file @
5be1c7d0
...
...
@@ -352,8 +352,10 @@ public:
static
int32
duel_get_draw_count
(
lua_State
*
L
);
static
int32
duel_register_effect
(
lua_State
*
L
);
static
int32
duel_register_flag_effect
(
lua_State
*
L
);
static
int32
duel_reset_flag_effect
(
lua_State
*
L
);
static
int32
duel_get_flag_effect
(
lua_State
*
L
);
static
int32
duel_reset_flag_effect
(
lua_State
*
L
);
static
int32
duel_set_flag_effect_label
(
lua_State
*
L
);
static
int32
duel_get_flag_effect_label
(
lua_State
*
L
);
static
int32
duel_destroy
(
lua_State
*
L
);
static
int32
duel_remove
(
lua_State
*
L
);
static
int32
duel_sendto_grave
(
lua_State
*
L
);
...
...
@@ -439,6 +441,7 @@ public:
static
int32
duel_check_location
(
lua_State
*
L
);
static
int32
duel_get_current_chain
(
lua_State
*
L
);
static
int32
duel_get_chain_info
(
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_current_phase
(
lua_State
*
L
);
static
int32
duel_skip_phase
(
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