Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
7e5bf3da
Commit
7e5bf3da
authored
Feb 03, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
18c04bd1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
48 deletions
+60
-48
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+7
-7
Classes/ocgcore/effect.cpp
Classes/ocgcore/effect.cpp
+2
-2
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+6
-6
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+29
-23
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+6
-6
Classes/ocgcore/libeffect.cpp
Classes/ocgcore/libeffect.cpp
+1
-1
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+9
-3
No files found.
Classes/ocgcore/card.cpp
View file @
7e5bf3da
...
@@ -90,9 +90,9 @@ bool card::card_operation_sort(card* c1, card* c2) {
...
@@ -90,9 +90,9 @@ bool card::card_operation_sort(card* c1, card* c2) {
}
else
if
(
c1
->
current
.
location
==
LOCATION_DECK
&&
pduel
->
game_field
->
is_select_hide_deck_sequence
(
cp1
))
{
}
else
if
(
c1
->
current
.
location
==
LOCATION_DECK
&&
pduel
->
game_field
->
is_select_hide_deck_sequence
(
cp1
))
{
// if deck reversed and the card being at the top, it should go first
// if deck reversed and the card being at the top, it should go first
if
(
pduel
->
game_field
->
core
.
deck_reversed
)
{
if
(
pduel
->
game_field
->
core
.
deck_reversed
)
{
if
(
c1
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp1
].
list_main
.
size
()
-
1
)
if
(
c1
==
pduel
->
game_field
->
player
[
cp1
].
list_main
.
back
()
)
return
false
;
return
false
;
if
(
c2
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp2
].
list_main
.
size
()
-
1
)
if
(
c2
==
pduel
->
game_field
->
player
[
cp2
].
list_main
.
back
()
)
return
true
;
return
true
;
}
}
// faceup deck cards should go at the very first
// faceup deck cards should go at the very first
...
@@ -974,13 +974,13 @@ uint32_t card::get_level() {
...
@@ -974,13 +974,13 @@ uint32_t card::get_level() {
temp
.
level
=
level
+
up
;
temp
.
level
=
level
+
up
;
}
}
level
+=
up
;
level
+=
up
;
if
(
level
<
1
&&
(
get_type
()
&
TYPE_MONSTER
)
)
if
(
level
<
1
)
level
=
1
;
level
=
1
;
temp
.
level
=
UINT32_MAX
;
temp
.
level
=
UINT32_MAX
;
return
level
;
return
level
;
}
}
uint32_t
card
::
get_rank
()
{
uint32_t
card
::
get_rank
()
{
if
(
!
(
data
.
type
&
TYPE_XYZ
)
||
(
status
&
STATUS_NO_LEVEL
))
if
(
!
(
data
.
type
&
TYPE_XYZ
))
return
0
;
return
0
;
if
(
assume_type
==
ASSUME_RANK
)
if
(
assume_type
==
ASSUME_RANK
)
return
assume_value
;
return
assume_value
;
...
@@ -1007,13 +1007,13 @@ uint32_t card::get_rank() {
...
@@ -1007,13 +1007,13 @@ uint32_t card::get_rank() {
temp
.
level
=
rank
+
up
;
temp
.
level
=
rank
+
up
;
}
}
rank
+=
up
;
rank
+=
up
;
if
(
rank
<
1
&&
(
get_type
()
&
TYPE_MONSTER
)
)
if
(
rank
<
1
)
rank
=
1
;
rank
=
1
;
temp
.
level
=
UINT32_MAX
;
temp
.
level
=
UINT32_MAX
;
return
rank
;
return
rank
;
}
}
uint32_t
card
::
get_link
()
{
uint32_t
card
::
get_link
()
{
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
if
(
!
(
data
.
type
&
TYPE_LINK
))
return
0
;
return
0
;
return
data
.
level
;
return
data
.
level
;
}
}
...
@@ -1367,7 +1367,7 @@ int32_t card::is_extra_link_state() {
...
@@ -1367,7 +1367,7 @@ int32_t card::is_extra_link_state() {
uint32_t
checking
=
linked_zone
&
~
checked
;
uint32_t
checking
=
linked_zone
&
~
checked
;
if
(
!
checking
)
if
(
!
checking
)
return
FALSE
;
return
FALSE
;
uint32_t
rightmost
=
checking
&
(
-
checking
);
uint32_t
rightmost
=
checking
&
(
~
checking
+
1
);
checked
|=
rightmost
;
checked
|=
rightmost
;
if
(
rightmost
<
0x10000U
)
{
if
(
rightmost
<
0x10000U
)
{
for
(
int32_t
i
=
0
;
i
<
7
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
7
;
++
i
)
{
...
...
Classes/ocgcore/effect.cpp
View file @
7e5bf3da
...
@@ -168,8 +168,8 @@ int32_t effect::check_count_limit(uint8_t playerid) {
...
@@ -168,8 +168,8 @@ int32_t effect::check_count_limit(uint8_t playerid) {
return
FALSE
;
return
FALSE
;
if
(
count_code
)
{
if
(
count_code
)
{
uint32_t
limit_code
=
count_code
&
MAX_CARD_ID
;
uint32_t
limit_code
=
count_code
&
MAX_CARD_ID
;
uint32_t
limit_type
=
count_code
&
0xf0000000
;
uint32_t
limit_type
=
count_code
&
0xf0000000
U
;
u
int32_t
count
=
count_limit_max
;
int32_t
count
=
count_limit_max
;
if
(
limit_code
==
EFFECT_COUNT_CODE_SINGLE
)
{
if
(
limit_code
==
EFFECT_COUNT_CODE_SINGLE
)
{
if
(
pduel
->
game_field
->
get_effect_code
(
limit_type
|
get_handler
()
->
fieldid
,
PLAYER_NONE
)
>=
count
)
if
(
pduel
->
game_field
->
get_effect_code
(
limit_type
|
get_handler
()
->
fieldid
,
PLAYER_NONE
)
>=
count
)
return
FALSE
;
return
FALSE
;
...
...
Classes/ocgcore/effect.h
View file @
7e5bf3da
...
@@ -131,10 +131,10 @@ public:
...
@@ -131,10 +131,10 @@ public:
//#define EFFECT_STATUS_ACTIVATED 0x0002
//#define EFFECT_STATUS_ACTIVATED 0x0002
#define EFFECT_STATUS_SPSELF 0x0004
#define EFFECT_STATUS_SPSELF 0x0004
#define EFFECT_COUNT_CODE_OATH 0x10000000
#define EFFECT_COUNT_CODE_OATH 0x10000000
U
#define EFFECT_COUNT_CODE_DUEL 0x20000000
#define EFFECT_COUNT_CODE_DUEL 0x20000000
U
#define EFFECT_COUNT_CODE_CHAIN 0x40000000
#define EFFECT_COUNT_CODE_CHAIN 0x40000000
U
#define EFFECT_COUNT_CODE_SINGLE 0x1
#define EFFECT_COUNT_CODE_SINGLE 0x1
U
//========== Reset ==========
//========== Reset ==========
#define RESET_SELF_TURN 0x10000000
#define RESET_SELF_TURN 0x10000000
...
@@ -610,8 +610,8 @@ constexpr int32_t DOUBLE_DAMAGE = 0x80000000;
...
@@ -610,8 +610,8 @@ constexpr int32_t DOUBLE_DAMAGE = 0x80000000;
constexpr
int32_t
HALF_DAMAGE
=
0x80000001
;
constexpr
int32_t
HALF_DAMAGE
=
0x80000001
;
// flag effect
// flag effect
#define EFFECT_FLAG_EFFECT 0x20000000
#define EFFECT_FLAG_EFFECT 0x20000000
U
#define MAX_CARD_ID 0x
fffffff
#define MAX_CARD_ID 0x
0fffffffU
// The type of effect code
// The type of effect code
enum
code_type
:
int32_t
{
enum
code_type
:
int32_t
{
...
...
Classes/ocgcore/field.cpp
View file @
7e5bf3da
...
@@ -877,7 +877,7 @@ int32_t field::check_extra_link(int32_t playerid) {
...
@@ -877,7 +877,7 @@ int32_t field::check_extra_link(int32_t playerid) {
uint32_t
checking
=
linked_zone
&
~
checked
;
uint32_t
checking
=
linked_zone
&
~
checked
;
if
(
!
checking
)
if
(
!
checking
)
return
FALSE
;
return
FALSE
;
uint32_t
rightmost
=
checking
&
(
-
checking
);
uint32_t
rightmost
=
checking
&
(
~
checking
+
1
);
checked
|=
rightmost
;
checked
|=
rightmost
;
if
(
rightmost
<
0x10000U
)
{
if
(
rightmost
<
0x10000U
)
{
for
(
int32_t
i
=
0
;
i
<
7
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
7
;
++
i
)
{
...
@@ -1329,36 +1329,42 @@ void field::reset_chain() {
...
@@ -1329,36 +1329,42 @@ void field::reset_chain() {
(
*
rm
)
->
handler
->
remove_effect
((
*
rm
));
(
*
rm
)
->
handler
->
remove_effect
((
*
rm
));
}
}
}
}
void
field
::
add_effect_code
(
uint32_t
code
,
uint32_t
playerid
)
{
void
field
::
add_effect_code
(
uint32_t
code
,
int32_t
playerid
)
{
auto
*
count_map
=
&
core
.
effect_count_code
;
if
(
playerid
<
0
||
playerid
>
PLAYER_NONE
)
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
return
;
count_map
=
&
core
.
effect_count_code_duel
;
auto
count_map
=
&
core
.
effect_count_code
[
playerid
];
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
count_map
=
&
core
.
effect_count_code_chain
;
count_map
=
&
core
.
effect_count_code_duel
[
playerid
];
(
*
count_map
)[
code
+
(
playerid
<<
30
)]
++
;
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
}
count_map
=
&
core
.
effect_count_code_chain
[
playerid
];
uint32_t
field
::
get_effect_code
(
uint32_t
code
,
uint32_t
playerid
)
{
(
*
count_map
)[
code
]
++
;
auto
*
count_map
=
&
core
.
effect_count_code
;
}
int32_t
field
::
get_effect_code
(
uint32_t
code
,
int32_t
playerid
)
{
if
(
playerid
<
0
||
playerid
>
PLAYER_NONE
)
return
0
;
auto
count_map
=
&
core
.
effect_count_code
[
playerid
];
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
count_map
=
&
core
.
effect_count_code_duel
;
count_map
=
&
core
.
effect_count_code_duel
[
playerid
]
;
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
count_map
=
&
core
.
effect_count_code_chain
;
count_map
=
&
core
.
effect_count_code_chain
[
playerid
]
;
auto
iter
=
count_map
->
find
(
code
+
(
playerid
<<
30
)
);
auto
iter
=
count_map
->
find
(
code
);
if
(
iter
==
count_map
->
end
())
if
(
iter
==
count_map
->
end
())
return
0
;
return
0
;
return
iter
->
second
;
return
iter
->
second
;
}
}
void
field
::
dec_effect_code
(
uint32_t
code
,
uint32_t
playerid
)
{
void
field
::
dec_effect_code
(
uint32_t
code
,
int32_t
playerid
)
{
auto
*
count_map
=
&
core
.
effect_count_code
;
if
(
playerid
<
0
||
playerid
>
PLAYER_NONE
)
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
return
;
count_map
=
&
core
.
effect_count_code_duel
;
auto
count_map
=
&
core
.
effect_count_code
[
playerid
];
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
count_map
=
&
core
.
effect_count_code_chain
;
count_map
=
&
core
.
effect_count_code_duel
[
playerid
];
auto
iter
=
count_map
->
find
(
code
+
(
playerid
<<
30
));
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
count_map
=
&
core
.
effect_count_code_chain
[
playerid
];
auto
iter
=
count_map
->
find
(
code
);
if
(
iter
==
count_map
->
end
())
if
(
iter
==
count_map
->
end
())
return
;
return
;
if
(
iter
->
second
>
0
)
if
(
iter
->
second
>
0
)
--
iter
->
second
;
iter
->
second
--
;
}
}
void
field
::
filter_field_effect
(
uint32_t
code
,
effect_set
*
eset
,
uint8_t
sort
)
{
void
field
::
filter_field_effect
(
uint32_t
code
,
effect_set
*
eset
,
uint8_t
sort
)
{
auto
rg
=
effects
.
aura_effect
.
equal_range
(
code
);
auto
rg
=
effects
.
aura_effect
.
equal_range
(
code
);
...
...
Classes/ocgcore/field.h
View file @
7e5bf3da
...
@@ -255,9 +255,9 @@ struct processor {
...
@@ -255,9 +255,9 @@ struct processor {
std
::
set
<
effect
*>
reseted_effects
;
std
::
set
<
effect
*>
reseted_effects
;
std
::
unordered_map
<
card
*
,
uint32_t
>
readjust_map
;
std
::
unordered_map
<
card
*
,
uint32_t
>
readjust_map
;
std
::
unordered_set
<
card
*>
unique_cards
[
2
];
std
::
unordered_set
<
card
*>
unique_cards
[
2
];
std
::
unordered_map
<
uint32_t
,
uint32_t
>
effect_count_code
;
std
::
unordered_map
<
uint32_t
,
int32_t
>
effect_count_code
[
3
]
;
std
::
unordered_map
<
uint32_t
,
uint32_t
>
effect_count_code_duel
;
std
::
unordered_map
<
uint32_t
,
int32_t
>
effect_count_code_duel
[
3
]
;
std
::
unordered_map
<
uint32_t
,
uint32_t
>
effect_count_code_chain
;
std
::
unordered_map
<
uint32_t
,
int32_t
>
effect_count_code_chain
[
3
]
;
std
::
unordered_map
<
uint32_t
,
uint32_t
>
spsummon_once_map
[
2
];
std
::
unordered_map
<
uint32_t
,
uint32_t
>
spsummon_once_map
[
2
];
std
::
multimap
<
int32_t
,
card
*
,
std
::
greater
<
int32_t
>>
xmaterial_lst
;
std
::
multimap
<
int32_t
,
card
*
,
std
::
greater
<
int32_t
>>
xmaterial_lst
;
...
@@ -415,9 +415,9 @@ public:
...
@@ -415,9 +415,9 @@ public:
void
release_oath_relation
(
effect
*
reason_effect
);
void
release_oath_relation
(
effect
*
reason_effect
);
void
reset_phase
(
uint32_t
phase
);
void
reset_phase
(
uint32_t
phase
);
void
reset_chain
();
void
reset_chain
();
void
add_effect_code
(
uint32_t
code
,
u
int32_t
playerid
);
void
add_effect_code
(
uint32_t
code
,
int32_t
playerid
);
uint32_t
get_effect_code
(
uint32_t
code
,
u
int32_t
playerid
);
int32_t
get_effect_code
(
uint32_t
code
,
int32_t
playerid
);
void
dec_effect_code
(
uint32_t
code
,
u
int32_t
playerid
);
void
dec_effect_code
(
uint32_t
code
,
int32_t
playerid
);
void
filter_field_effect
(
uint32_t
code
,
effect_set
*
eset
,
uint8_t
sort
=
TRUE
);
void
filter_field_effect
(
uint32_t
code
,
effect_set
*
eset
,
uint8_t
sort
=
TRUE
);
void
filter_affected_cards
(
effect
*
peffect
,
card_set
*
cset
);
void
filter_affected_cards
(
effect
*
peffect
,
card_set
*
cset
);
...
...
Classes/ocgcore/libeffect.cpp
View file @
7e5bf3da
...
@@ -172,7 +172,7 @@ int32_t scriptlib::effect_set_count_limit(lua_State *L) {
...
@@ -172,7 +172,7 @@ int32_t scriptlib::effect_set_count_limit(lua_State *L) {
if
(
v
==
0
)
if
(
v
==
0
)
v
=
1
;
v
=
1
;
if
(
code
==
EFFECT_COUNT_CODE_CHAIN
)
if
(
code
==
EFFECT_COUNT_CODE_CHAIN
)
code
=
EFFECT_COUNT_CODE_CHAIN
+
EFFECT_COUNT_CODE_SINGLE
;
code
=
EFFECT_COUNT_CODE_CHAIN
|
EFFECT_COUNT_CODE_SINGLE
;
peffect
->
flag
[
0
]
|=
EFFECT_FLAG_COUNT_LIMIT
;
peffect
->
flag
[
0
]
|=
EFFECT_FLAG_COUNT_LIMIT
;
peffect
->
count_limit
=
v
;
peffect
->
count_limit
=
v
;
peffect
->
count_limit_max
=
v
;
peffect
->
count_limit_max
=
v
;
...
...
Classes/ocgcore/processor.cpp
View file @
7e5bf3da
...
@@ -1498,7 +1498,9 @@ int32_t field::process_point_event(int16_t step, int32_t skip_trigger, int32_t s
...
@@ -1498,7 +1498,9 @@ int32_t field::process_point_event(int16_t step, int32_t skip_trigger, int32_t s
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
core
.
chain_limit_p
.
clear
();
core
.
chain_limit_p
.
clear
();
core
.
effect_count_code_chain
.
clear
();
core
.
effect_count_code_chain
[
0
].
clear
();
core
.
effect_count_code_chain
[
1
].
clear
();
core
.
effect_count_code_chain
[
PLAYER_NONE
].
clear
();
reset_chain
();
reset_chain
();
returns
.
ivalue
[
0
]
=
FALSE
;
returns
.
ivalue
[
0
]
=
FALSE
;
}
}
...
@@ -3669,7 +3671,9 @@ int32_t field::process_turn(uint16_t step, uint8_t turn_player) {
...
@@ -3669,7 +3671,9 @@ int32_t field::process_turn(uint16_t step, uint8_t turn_player) {
pduel
->
delete_effect
(
peffect
);
pduel
->
delete_effect
(
peffect
);
}
}
core
.
reseted_effects
.
clear
();
core
.
reseted_effects
.
clear
();
core
.
effect_count_code
.
clear
();
core
.
effect_count_code
[
0
].
clear
();
core
.
effect_count_code
[
1
].
clear
();
core
.
effect_count_code
[
PLAYER_NONE
].
clear
();
for
(
uint8_t
p
=
0
;
p
<
2
;
++
p
)
{
for
(
uint8_t
p
=
0
;
p
<
2
;
++
p
)
{
for
(
auto
&
pcard
:
player
[
p
].
list_mzone
)
{
for
(
auto
&
pcard
:
player
[
p
].
list_mzone
)
{
if
(
!
pcard
)
if
(
!
pcard
)
...
@@ -4544,7 +4548,9 @@ int32_t field::solve_chain(uint16_t step, uint32_t chainend_arg1, uint32_t chain
...
@@ -4544,7 +4548,9 @@ int32_t field::solve_chain(uint16_t step, uint32_t chainend_arg1, uint32_t chain
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
core
.
chain_limit_p
.
clear
();
core
.
chain_limit_p
.
clear
();
core
.
effect_count_code_chain
.
clear
();
core
.
effect_count_code_chain
[
0
].
clear
();
core
.
effect_count_code_chain
[
1
].
clear
();
core
.
effect_count_code_chain
[
PLAYER_NONE
].
clear
();
reset_chain
();
reset_chain
();
if
(
core
.
summoning_card
)
if
(
core
.
summoning_card
)
core
.
subunits
.
push_back
(
core
.
summon_reserved
);
core
.
subunits
.
push_back
(
core
.
summon_reserved
);
...
...
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