Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
cb0165f5
Commit
cb0165f5
authored
Aug 02, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
3e6b2f2f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
13 deletions
+22
-13
Classes/ocgcore/effect.cpp
Classes/ocgcore/effect.cpp
+2
-2
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+4
-0
Classes/ocgcore/interpreter.cpp
Classes/ocgcore/interpreter.cpp
+1
-1
Classes/ocgcore/libcard.cpp
Classes/ocgcore/libcard.cpp
+5
-5
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+10
-5
No files found.
Classes/ocgcore/effect.cpp
View file @
cb0165f5
...
@@ -199,7 +199,7 @@ int32 effect::check_count_limit(uint8 playerid) {
...
@@ -199,7 +199,7 @@ int32 effect::check_count_limit(uint8 playerid) {
if
(
count_limit
==
0
)
if
(
count_limit
==
0
)
return
FALSE
;
return
FALSE
;
if
(
count_code
)
{
if
(
count_code
)
{
uint32
code
=
count_code
&
0xfffffff
;
uint32
code
=
count_code
&
MAX_CARD_ID
;
uint32
count
=
count_limit_max
;
uint32
count
=
count_limit_max
;
if
(
code
==
EFFECT_COUNT_CODE_SINGLE
)
{
if
(
code
==
EFFECT_COUNT_CODE_SINGLE
)
{
if
(
pduel
->
game_field
->
get_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
)
>=
count
)
if
(
pduel
->
game_field
->
get_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
)
>=
count
)
...
@@ -665,7 +665,7 @@ void effect::dec_count(uint32 playerid) {
...
@@ -665,7 +665,7 @@ void effect::dec_count(uint32 playerid) {
if
(
count_code
==
0
||
is_flag
(
EFFECT_FLAG_NO_TURN_RESET
))
if
(
count_code
==
0
||
is_flag
(
EFFECT_FLAG_NO_TURN_RESET
))
count_limit
-=
1
;
count_limit
-=
1
;
if
(
count_code
)
{
if
(
count_code
)
{
uint32
code
=
count_code
&
0xfffffff
;
uint32
code
=
count_code
&
MAX_CARD_ID
;
if
(
code
==
EFFECT_COUNT_CODE_SINGLE
)
if
(
code
==
EFFECT_COUNT_CODE_SINGLE
)
pduel
->
game_field
->
add_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
);
pduel
->
game_field
->
add_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
);
else
else
...
...
Classes/ocgcore/effect.h
View file @
cb0165f5
...
@@ -549,6 +549,10 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
...
@@ -549,6 +549,10 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define DOUBLE_DAMAGE 0x80000000
#define DOUBLE_DAMAGE 0x80000000
#define HALF_DAMAGE 0x80000001
#define HALF_DAMAGE 0x80000001
// flag effect
#define HEADER_FLAG_EFFECT 0x20000000
#define MAX_CARD_ID 0xfffffff
// The type of event in code
// The type of event in code
#define CODE_CUSTOM 1 // header + id (28 bits)
#define CODE_CUSTOM 1 // header + id (28 bits)
#define CODE_COUNTER 2 // header + counter_id (16 bits)
#define CODE_COUNTER 2 // header + counter_id (16 bits)
...
...
Classes/ocgcore/interpreter.cpp
View file @
cb0165f5
...
@@ -590,7 +590,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
...
@@ -590,7 +590,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
int32
result
=
lua_resume
(
rthread
,
0
,
param_count
);
int32
result
=
lua_resume
(
rthread
,
0
,
param_count
);
int32
nresults
=
lua_gettop
(
rthread
);
int32
nresults
=
lua_gettop
(
rthread
);
#endif
#endif
if
(
result
==
0
)
{
if
(
result
==
LUA_OK
)
{
coroutines
.
erase
(
f
);
coroutines
.
erase
(
f
);
if
(
yield_value
)
{
if
(
yield_value
)
{
if
(
nresults
==
0
)
if
(
nresults
==
0
)
...
...
Classes/ocgcore/libcard.cpp
View file @
cb0165f5
...
@@ -1793,7 +1793,7 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) {
...
@@ -1793,7 +1793,7 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) {
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
int32
reset
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
reset
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
flag
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
flag
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
count
=
(
int32
)
lua_tointeger
(
L
,
5
);
int32
count
=
(
int32
)
lua_tointeger
(
L
,
5
);
...
@@ -1827,7 +1827,7 @@ int32 scriptlib::card_get_flag_effect(lua_State *L) {
...
@@ -1827,7 +1827,7 @@ int32 scriptlib::card_get_flag_effect(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
lua_pushinteger
(
L
,
pcard
->
single_effect
.
count
(
code
));
lua_pushinteger
(
L
,
pcard
->
single_effect
.
count
(
code
));
return
1
;
return
1
;
}
}
...
@@ -1835,7 +1835,7 @@ int32 scriptlib::card_reset_flag_effect(lua_State *L) {
...
@@ -1835,7 +1835,7 @@ int32 scriptlib::card_reset_flag_effect(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
pcard
->
reset
(
code
,
RESET_CODE
);
pcard
->
reset
(
code
,
RESET_CODE
);
return
0
;
return
0
;
}
}
...
@@ -1843,7 +1843,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) {
...
@@ -1843,7 +1843,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
int32
lab
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
lab
=
(
int32
)
lua_tointeger
(
L
,
3
);
auto
eit
=
pcard
->
single_effect
.
find
(
code
);
auto
eit
=
pcard
->
single_effect
.
find
(
code
);
if
(
eit
==
pcard
->
single_effect
.
end
())
if
(
eit
==
pcard
->
single_effect
.
end
())
...
@@ -1859,7 +1859,7 @@ int32 scriptlib::card_get_flag_effect_label(lua_State *L) {
...
@@ -1859,7 +1859,7 @@ int32 scriptlib::card_get_flag_effect_label(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
auto
rg
=
pcard
->
single_effect
.
equal_range
(
code
);
auto
rg
=
pcard
->
single_effect
.
equal_range
(
code
);
int32
count
=
0
;
int32
count
=
0
;
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
,
++
count
)
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
,
++
count
)
...
...
Classes/ocgcore/libduel.cpp
View file @
cb0165f5
...
@@ -85,7 +85,7 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) {
...
@@ -85,7 +85,7 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) {
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
int32
reset
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
reset
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
flag
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
flag
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
count
=
(
int32
)
lua_tointeger
(
L
,
5
);
int32
count
=
(
int32
)
lua_tointeger
(
L
,
5
);
...
@@ -118,7 +118,7 @@ int32 scriptlib::duel_get_flag_effect(lua_State *L) {
...
@@ -118,7 +118,7 @@ int32 scriptlib::duel_get_flag_effect(lua_State *L) {
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
...
@@ -130,7 +130,7 @@ int32 scriptlib::duel_reset_flag_effect(lua_State *L) {
...
@@ -130,7 +130,7 @@ int32 scriptlib::duel_reset_flag_effect(lua_State *L) {
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
auto
pr
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
auto
pr
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
for
(;
pr
.
first
!=
pr
.
second
;
)
{
for
(;
pr
.
first
!=
pr
.
second
;
)
{
...
@@ -146,7 +146,7 @@ int32 scriptlib::duel_set_flag_effect_label(lua_State *L) {
...
@@ -146,7 +146,7 @@ int32 scriptlib::duel_set_flag_effect_label(lua_State *L) {
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
int32
lab
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
lab
=
(
int32
)
lua_tointeger
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
effect_set
eset
;
...
@@ -165,7 +165,7 @@ int32 scriptlib::duel_get_flag_effect_label(lua_State *L) {
...
@@ -165,7 +165,7 @@ int32 scriptlib::duel_get_flag_effect_label(lua_State *L) {
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
HEADER_FLAG_EFFECT
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
...
@@ -3718,6 +3718,11 @@ int32 scriptlib::duel_select_disable_field(lua_State * L) {
...
@@ -3718,6 +3718,11 @@ int32 scriptlib::duel_select_disable_field(lua_State * L) {
return
1
;
return
1
;
});
});
}
}
/*
Select zones from the viewpoint of playerid.
flag selectable zones XX000000 X0000000 for each player, 1 byte for SZONE(6), 1 byte for MZONE(7)
filter excluding zones, 0 for selectable, 1 for unselectable
*/
int32
scriptlib
::
duel_select_field
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_field
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
...
...
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