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
8afcfcbb
Commit
8afcfcbb
authored
Mar 15, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
3ad47c79
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
19 deletions
+31
-19
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+5
-1
Classes/ocgcore/card.h
Classes/ocgcore/card.h
+2
-0
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+1
-0
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+5
-5
Classes/ocgcore/interpreter.cpp
Classes/ocgcore/interpreter.cpp
+1
-1
Classes/ocgcore/libcard.cpp
Classes/ocgcore/libcard.cpp
+1
-2
Classes/ocgcore/mtrandom.h
Classes/ocgcore/mtrandom.h
+15
-9
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+1
-1
No files found.
Classes/ocgcore/card.cpp
View file @
8afcfcbb
...
@@ -1583,6 +1583,10 @@ int32 card::add_effect(effect* peffect) {
...
@@ -1583,6 +1583,10 @@ int32 card::add_effect(effect* peffect) {
peffect
->
count_limit
=
1
;
peffect
->
count_limit
=
1
;
peffect
->
count_limit_max
=
1
;
peffect
->
count_limit_max
=
1
;
}
}
// add EFFECT_FLAG_IGNORE_IMMUNE to EFFECT_CANNOT_TRIGGER by default
if
(
peffect
->
code
==
EFFECT_CANNOT_TRIGGER
)
{
peffect
->
flag
[
0
]
|=
EFFECT_FLAG_IGNORE_IMMUNE
;
}
card_set
check_target
=
{
this
};
card_set
check_target
=
{
this
};
effect_container
::
iterator
eit
;
effect_container
::
iterator
eit
;
if
(
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
{
if
(
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
{
...
@@ -3289,7 +3293,7 @@ uint8 card::get_spsummonable_position(effect* reason_effect, uint32 sumtype, uin
...
@@ -3289,7 +3293,7 @@ uint8 card::get_spsummonable_position(effect* reason_effect, uint32 sumtype, uin
continue
;
continue
;
if
((
data
.
type
&
(
TYPE_TOKEN
|
TYPE_LINK
))
&&
(
positions
[
p
]
&
POS_FACEDOWN
))
if
((
data
.
type
&
(
TYPE_TOKEN
|
TYPE_LINK
))
&&
(
positions
[
p
]
&
POS_FACEDOWN
))
continue
;
continue
;
pduel
->
game_field
->
filter_player_effect
(
sumplayer
,
EFFECT_
CANNOT_SPECIAL_SUMM
ON
,
&
eset
);
pduel
->
game_field
->
filter_player_effect
(
sumplayer
,
EFFECT_
LIMIT_SPECIAL_SUMMON_POSITI
ON
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
!
eset
[
i
]
->
target
)
if
(
!
eset
[
i
]
->
target
)
continue
;
continue
;
...
...
Classes/ocgcore/card.h
View file @
8afcfcbb
...
@@ -413,4 +413,6 @@ public:
...
@@ -413,4 +413,6 @@ public:
#define CARD_MARINE_DOLPHIN 78734254
#define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930
#define CARD_TWINKLE_MOSS 13857930
#define CARD_ARTWORK_VERSIONS_OFFSET 10
#endif
/* CARD_H_ */
#endif
/* CARD_H_ */
Classes/ocgcore/effect.h
View file @
8afcfcbb
...
@@ -463,6 +463,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
...
@@ -463,6 +463,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_CHANGE_GRAVE_ATTRIBUTE 365
#define EFFECT_CHANGE_GRAVE_ATTRIBUTE 365
#define EFFECT_CHANGE_GRAVE_RACE 366
#define EFFECT_CHANGE_GRAVE_RACE 366
#define EFFECT_ACTIVATION_COUNT_LIMIT 367
#define EFFECT_ACTIVATION_COUNT_LIMIT 367
#define EFFECT_LIMIT_SPECIAL_SUMMON_POSITION 368
#define EVENT_STARTUP 1000
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
#define EVENT_FLIP 1001
...
...
Classes/ocgcore/field.cpp
View file @
8afcfcbb
...
@@ -265,7 +265,7 @@ void field::move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequenc
...
@@ -265,7 +265,7 @@ void field::move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequenc
pcard
->
sendto_param
.
position
=
POS_FACEDOWN_DEFENSE
;
pcard
->
sendto_param
.
position
=
POS_FACEDOWN_DEFENSE
;
}
}
if
(
pcard
->
current
.
location
)
{
if
(
pcard
->
current
.
location
)
{
if
(
pcard
->
current
.
location
==
location
)
{
if
(
pcard
->
current
.
location
==
location
&&
pcard
->
current
.
pzone
==
!!
pzone
)
{
if
(
pcard
->
current
.
location
==
LOCATION_DECK
)
{
if
(
pcard
->
current
.
location
==
LOCATION_DECK
)
{
if
(
preplayer
==
playerid
)
{
if
(
preplayer
==
playerid
)
{
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer8
(
MSG_MOVE
);
...
@@ -957,14 +957,14 @@ void field::shuffle(uint8 playerid, uint8 location) {
...
@@ -957,14 +957,14 @@ void field::shuffle(uint8 playerid, uint8 location) {
}
}
}
}
if
(
location
==
LOCATION_HAND
||
!
(
core
.
duel_options
&
DUEL_PSEUDO_SHUFFLE
))
{
if
(
location
==
LOCATION_HAND
||
!
(
core
.
duel_options
&
DUEL_PSEUDO_SHUFFLE
))
{
uint32
s
=
(
u
int32
)
svector
.
size
();
int32
s
=
(
int32
)
svector
.
size
();
if
(
location
==
LOCATION_EXTRA
)
if
(
location
==
LOCATION_EXTRA
)
s
=
s
-
player
[
playerid
].
extra_p_count
;
s
=
s
-
(
int32
)
player
[
playerid
].
extra_p_count
;
if
(
s
>
1
)
{
if
(
s
>
1
)
{
if
(
core
.
duel_options
&
DUEL_OLD_REPLAY
)
if
(
core
.
duel_options
&
DUEL_OLD_REPLAY
)
pduel
->
random
.
shuffle_vector_old
(
svector
);
pduel
->
random
.
shuffle_vector_old
(
svector
,
0
,
s
-
1
);
else
else
pduel
->
random
.
shuffle_vector
(
svector
);
pduel
->
random
.
shuffle_vector
(
svector
,
0
,
s
-
1
);
reset_sequence
(
playerid
,
location
);
reset_sequence
(
playerid
,
location
);
}
}
}
}
...
...
Classes/ocgcore/interpreter.cpp
View file @
8afcfcbb
...
@@ -63,7 +63,7 @@ int32 interpreter::register_card(card *pcard) {
...
@@ -63,7 +63,7 @@ int32 interpreter::register_card(card *pcard) {
//some userdata may be created in script like token so use current_state
//some userdata may be created in script like token so use current_state
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
pcard
->
ref_handle
);
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
pcard
->
ref_handle
);
//load script
//load script
if
(
pcard
->
data
.
alias
&&
(
pcard
->
data
.
alias
<
pcard
->
data
.
code
+
10
)
&&
(
pcard
->
data
.
code
<
pcard
->
data
.
alias
+
10
))
if
(
pcard
->
data
.
alias
&&
(
pcard
->
data
.
alias
<
pcard
->
data
.
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
pcard
->
data
.
code
<
pcard
->
data
.
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
))
load_card_script
(
pcard
->
data
.
alias
);
load_card_script
(
pcard
->
data
.
alias
);
else
else
load_card_script
(
pcard
->
data
.
code
);
load_card_script
(
pcard
->
data
.
code
);
...
...
Classes/ocgcore/libcard.cpp
View file @
8afcfcbb
...
@@ -31,8 +31,7 @@ int32 scriptlib::card_get_origin_code(lua_State *L) {
...
@@ -31,8 +31,7 @@ int32 scriptlib::card_get_origin_code(lua_State *L) {
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
);
if
(
pcard
->
data
.
alias
)
{
if
(
pcard
->
data
.
alias
)
{
int32
dif
=
pcard
->
data
.
code
-
pcard
->
data
.
alias
;
if
((
pcard
->
data
.
alias
<
pcard
->
data
.
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
pcard
->
data
.
code
<
pcard
->
data
.
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
))
if
(
dif
>
-
10
&&
dif
<
10
)
lua_pushinteger
(
L
,
pcard
->
data
.
alias
);
lua_pushinteger
(
L
,
pcard
->
data
.
alias
);
else
else
lua_pushinteger
(
L
,
pcard
->
data
.
code
);
lua_pushinteger
(
L
,
pcard
->
data
.
code
);
...
...
Classes/ocgcore/mtrandom.h
View file @
8afcfcbb
...
@@ -44,20 +44,26 @@ public:
...
@@ -44,20 +44,26 @@ public:
return
result
;
return
result
;
}
}
// Fisher-Yates shuffle
// Fisher-Yates shuffle
v[a]~v[b]
template
<
typename
T
>
template
<
typename
T
>
void
shuffle_vector
(
std
::
vector
<
T
>&
v
)
{
void
shuffle_vector
(
std
::
vector
<
T
>&
v
,
int
a
=
-
1
,
int
b
=
-
1
)
{
int
n
=
(
int
)
v
.
size
();
if
(
a
<
0
)
for
(
int
i
=
0
;
i
<
n
-
1
;
++
i
)
{
a
=
0
;
int
r
=
get_random_integer
(
i
,
n
-
1
);
if
(
b
<
0
)
b
=
(
int
)
v
.
size
()
-
1
;
for
(
int
i
=
a
;
i
<
b
;
++
i
)
{
int
r
=
get_random_integer
(
i
,
b
);
std
::
swap
(
v
[
i
],
v
[
r
]);
std
::
swap
(
v
[
i
],
v
[
r
]);
}
}
}
}
template
<
typename
T
>
template
<
typename
T
>
void
shuffle_vector_old
(
std
::
vector
<
T
>&
v
)
{
void
shuffle_vector_old
(
std
::
vector
<
T
>&
v
,
int
a
=
-
1
,
int
b
=
-
1
)
{
int
n
=
(
int
)
v
.
size
();
if
(
a
<
0
)
for
(
int
i
=
0
;
i
<
n
-
1
;
++
i
)
{
a
=
0
;
int
r
=
get_random_integer_old
(
i
,
n
-
1
);
if
(
b
<
0
)
b
=
(
int
)
v
.
size
()
-
1
;
for
(
int
i
=
a
;
i
<
b
;
++
i
)
{
int
r
=
get_random_integer_old
(
i
,
b
);
std
::
swap
(
v
[
i
],
v
[
r
]);
std
::
swap
(
v
[
i
],
v
[
r
]);
}
}
}
}
...
...
Classes/ocgcore/operations.cpp
View file @
8afcfcbb
...
@@ -289,7 +289,7 @@ void field::send_to(card* target, effect* reason_effect, uint32 reason, uint32 r
...
@@ -289,7 +289,7 @@ void field::send_to(card* target, effect* reason_effect, uint32 reason, uint32 r
void
field
::
move_to_field
(
card
*
target
,
uint32
move_player
,
uint32
playerid
,
uint32
destination
,
uint32
positions
,
uint32
enable
,
uint32
ret
,
uint32
pzone
,
uint32
zone
)
{
void
field
::
move_to_field
(
card
*
target
,
uint32
move_player
,
uint32
playerid
,
uint32
destination
,
uint32
positions
,
uint32
enable
,
uint32
ret
,
uint32
pzone
,
uint32
zone
)
{
if
(
!
(
destination
&
LOCATION_ONFIELD
)
||
!
positions
)
if
(
!
(
destination
&
LOCATION_ONFIELD
)
||
!
positions
)
return
;
return
;
if
(
destination
==
target
->
current
.
location
&&
playerid
==
target
->
current
.
controler
)
if
(
destination
==
target
->
current
.
location
&&
playerid
==
target
->
current
.
controler
&&
target
->
current
.
pzone
==
!!
pzone
)
return
;
return
;
target
->
to_field_param
=
(
move_player
<<
24
)
+
(
playerid
<<
16
)
+
(
destination
<<
8
)
+
positions
;
target
->
to_field_param
=
(
move_player
<<
24
)
+
(
playerid
<<
16
)
+
(
destination
<<
8
)
+
positions
;
add_process
(
PROCESSOR_MOVETOFIELD
,
0
,
0
,
(
group
*
)
target
,
enable
,
ret
+
(
pzone
<<
8
),
zone
);
add_process
(
PROCESSOR_MOVETOFIELD
,
0
,
0
,
(
group
*
)
target
,
enable
,
ret
+
(
pzone
<<
8
),
zone
);
...
...
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