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
xiaoye
ygopro-core
Commits
bfc0589c
Commit
bfc0589c
authored
Mar 12, 2022
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro-core
parents
8a591503
f5ff25ce
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
17 deletions
+29
-17
card.cpp
card.cpp
+5
-1
card.h
card.h
+2
-0
effect.h
effect.h
+1
-0
field.cpp
field.cpp
+4
-4
interpreter.cpp
interpreter.cpp
+1
-1
libcard.cpp
libcard.cpp
+1
-2
mtrandom.h
mtrandom.h
+15
-9
No files found.
card.cpp
View file @
bfc0589c
...
@@ -1579,6 +1579,10 @@ int32 card::add_effect(effect* peffect) {
...
@@ -1579,6 +1579,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
)
{
...
@@ -3285,7 +3289,7 @@ uint8 card::get_spsummonable_position(effect* reason_effect, uint32 sumtype, uin
...
@@ -3285,7 +3289,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
;
...
...
card.h
View file @
bfc0589c
...
@@ -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_ */
effect.h
View file @
bfc0589c
...
@@ -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
...
...
field.cpp
View file @
bfc0589c
...
@@ -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
);
}
}
}
}
...
...
interpreter.cpp
View file @
bfc0589c
...
@@ -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
);
...
...
libcard.cpp
View file @
bfc0589c
...
@@ -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
);
...
...
mtrandom.h
View file @
bfc0589c
...
@@ -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
]);
}
}
}
}
...
...
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