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
nanahira
ygopro-core
Commits
6973f2ba
Commit
6973f2ba
authored
Mar 25, 2017
by
VanillaSalt
Committed by
GitHub
Mar 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into mr4
parents
8201e4d2
f0f1ede3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
175 additions
and
34 deletions
+175
-34
card.cpp
card.cpp
+82
-12
card.h
card.h
+15
-0
field.cpp
field.cpp
+75
-19
field.h
field.h
+2
-2
operations.cpp
operations.cpp
+1
-1
No files found.
card.cpp
View file @
6973f2ba
...
@@ -902,18 +902,8 @@ uint32 card::get_rank() {
...
@@ -902,18 +902,8 @@ uint32 card::get_rank() {
}
}
uint32
card
::
get_link
()
{
uint32
card
::
get_link
()
{
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
return
0
;
return
0
;
if
(
!
(
current
.
location
&
LOCATION_MZONE
))
return
data
.
level
;
return
data
.
level
;
if
(
temp
.
level
!=
0xffffffff
)
return
temp
.
level
;
effect_set
effects
;
int32
link
=
data
.
level
;
temp
.
level
=
link
;
if
(
link
<
1
&&
(
get_type
()
&
TYPE_MONSTER
))
link
=
1
;
temp
.
level
=
0xffffffff
;
return
link
;
}
}
uint32
card
::
get_synchro_level
(
card
*
pcard
)
{
uint32
card
::
get_synchro_level
(
card
*
pcard
)
{
if
((
data
.
type
&
TYPE_XYZ
)
||
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
if
((
data
.
type
&
TYPE_XYZ
)
||
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
...
@@ -1084,6 +1074,86 @@ uint32 card::get_rscale() {
...
@@ -1084,6 +1074,86 @@ uint32 card::get_rscale() {
temp
.
rscale
=
0xffffffff
;
temp
.
rscale
=
0xffffffff
;
return
rscale
;
return
rscale
;
}
}
int32
card
::
get_link_marker
()
{
if
(
!
(
data
.
type
&
TYPE_LINK
))
return
0
;
return
data
.
link_marker
;
}
int32
card
::
is_link_marker
(
int32
dir
)
{
return
get_link_marker
()
&
dir
;
}
uint32
card
::
get_linked_zone
()
{
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
current
.
location
!=
LOCATION_MZONE
)
return
0
;
int32
zones
=
0
;
int32
s
=
current
.
sequence
;
if
(
s
>
0
&&
s
<=
4
&&
is_link_marker
(
LINK_MARKER_LEFT
))
zones
|=
1u
<<
(
s
-
1
);
if
(
s
<=
3
&&
is_link_marker
(
LINK_MARKER_RIGHT
))
zones
|=
1u
<<
(
s
+
1
);
if
((
s
==
0
&&
is_link_marker
(
LINK_MARKER_TOP_RIGHT
))
||
(
s
==
1
&&
is_link_marker
(
LINK_MARKER_TOP
))
||
(
s
==
2
&&
is_link_marker
(
LINK_MARKER_TOP_LEFT
)))
zones
|=
(
1u
<<
5
)
|
(
1u
<<
(
16
+
6
));
if
((
s
==
2
&&
is_link_marker
(
LINK_MARKER_TOP_RIGHT
))
||
(
s
==
3
&&
is_link_marker
(
LINK_MARKER_TOP
))
||
(
s
==
4
&&
is_link_marker
(
LINK_MARKER_TOP_LEFT
)))
zones
|=
(
1u
<<
6
)
|
(
1u
<<
(
16
+
5
));
if
(
s
==
5
)
{
if
(
is_link_marker
(
LINK_MARKER_BOTTOM_LEFT
))
zones
|=
1u
<<
0
;
if
(
is_link_marker
(
LINK_MARKER_BOTTOM
))
zones
|=
1u
<<
1
;
if
(
is_link_marker
(
LINK_MARKER_BOTTOM_RIGHT
))
zones
|=
1u
<<
2
;
if
(
is_link_marker
(
LINK_MARKER_TOP_LEFT
))
zones
|=
1u
<<
(
16
+
4
);
if
(
is_link_marker
(
LINK_MARKER_TOP
))
zones
|=
1u
<<
(
16
+
3
);
if
(
is_link_marker
(
LINK_MARKER_TOP_RIGHT
))
zones
|=
1u
<<
(
16
+
2
);
}
if
(
s
==
6
)
{
if
(
is_link_marker
(
LINK_MARKER_BOTTOM_LEFT
))
zones
|=
1u
<<
2
;
if
(
is_link_marker
(
LINK_MARKER_BOTTOM
))
zones
|=
1u
<<
3
;
if
(
is_link_marker
(
LINK_MARKER_BOTTOM_RIGHT
))
zones
|=
1u
<<
4
;
if
(
is_link_marker
(
LINK_MARKER_TOP_LEFT
))
zones
|=
1u
<<
(
16
+
2
);
if
(
is_link_marker
(
LINK_MARKER_TOP
))
zones
|=
1u
<<
(
16
+
1
);
if
(
is_link_marker
(
LINK_MARKER_TOP_RIGHT
))
zones
|=
1u
<<
(
16
+
0
);
}
return
zones
;
}
void
card
::
get_linked_cards
(
card_set
*
cset
)
{
cset
->
clear
();
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
current
.
location
!=
LOCATION_MZONE
)
return
;
int32
p
=
current
.
controler
;
uint32
zones
=
get_linked_zone
();
uint32
icheck
=
0x1
;
for
(
auto
it
=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
begin
();
it
!=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
end
();
++
it
)
{
if
(
zones
&
icheck
)
{
card
*
pcard
=
*
it
;
if
(
pcard
)
cset
->
insert
(
pcard
);
}
icheck
<<=
1
;
}
icheck
=
0x10000
;
for
(
auto
it
=
pduel
->
game_field
->
player
[
1
-
p
].
list_mzone
.
begin
();
it
!=
pduel
->
game_field
->
player
[
1
-
p
].
list_mzone
.
end
();
++
it
)
{
if
(
zones
&
icheck
)
{
card
*
pcard
=
*
it
;
if
(
pcard
)
cset
->
insert
(
pcard
);
}
icheck
<<=
1
;
}
}
int32
card
::
is_position
(
int32
pos
)
{
int32
card
::
is_position
(
int32
pos
)
{
return
current
.
position
&
pos
;
return
current
.
position
&
pos
;
}
}
...
...
card.h
View file @
6973f2ba
...
@@ -33,6 +33,7 @@ struct card_data {
...
@@ -33,6 +33,7 @@ struct card_data {
int32
defense
;
int32
defense
;
uint32
lscale
;
uint32
lscale
;
uint32
rscale
;
uint32
rscale
;
int32
link_marker
;
};
};
struct
card_state
{
struct
card_state
{
...
@@ -189,6 +190,10 @@ public:
...
@@ -189,6 +190,10 @@ public:
uint32
get_race
();
uint32
get_race
();
uint32
get_lscale
();
uint32
get_lscale
();
uint32
get_rscale
();
uint32
get_rscale
();
int32
get_link_marker
();
int32
is_link_marker
(
int32
dir
);
uint32
get_linked_zone
();
void
get_linked_cards
(
card_set
*
cset
);
int32
is_position
(
int32
pos
);
int32
is_position
(
int32
pos
);
void
set_status
(
uint32
status
,
int32
enabled
);
void
set_status
(
uint32
status
,
int32
enabled
);
int32
get_status
(
uint32
status
);
int32
get_status
(
uint32
status
);
...
@@ -488,4 +493,14 @@ public:
...
@@ -488,4 +493,14 @@ public:
#define ASSUME_RACE 6
#define ASSUME_RACE 6
#define ASSUME_ATTACK 7
#define ASSUME_ATTACK 7
#define ASSUME_DEFENSE 8
#define ASSUME_DEFENSE 8
#define LINK_MARKER_TOP 0x1
#define LINK_MARKER_TOP_LEFT 0x2
#define LINK_MARKER_LEFT 0x4
#define LINK_MARKER_BOTTOM_LEFT 0x8
#define LINK_MARKER_BOTTOM 0x10
#define LINK_MARKER_BOTTOM_RIGHT 0x20
#define LINK_MARKER_RIGHT 0x40
#define LINK_MARKER_TOP_RIGHT 0x80
#endif
/* CARD_H_ */
#endif
/* CARD_H_ */
field.cpp
View file @
6973f2ba
...
@@ -34,7 +34,6 @@ field::field(duel* pduel) {
...
@@ -34,7 +34,6 @@ field::field(duel* pduel) {
infos
.
card_id
=
1
;
infos
.
card_id
=
1
;
infos
.
phase
=
0
;
infos
.
phase
=
0
;
infos
.
turn_player
=
0
;
infos
.
turn_player
=
0
;
infos
.
usable_exmzone
=
0
;
for
(
int32
i
=
0
;
i
<
2
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
2
;
++
i
)
{
cost
[
i
].
count
=
0
;
cost
[
i
].
count
=
0
;
cost
[
i
].
amount
=
0
;
cost
[
i
].
amount
=
0
;
...
@@ -215,10 +214,6 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
...
@@ -215,10 +214,6 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
pcard
->
fieldid
=
infos
.
field_id
++
;
pcard
->
fieldid
=
infos
.
field_id
++
;
pcard
->
fieldid_r
=
pcard
->
fieldid
;
pcard
->
fieldid_r
=
pcard
->
fieldid
;
pcard
->
turnid
=
infos
.
turn_id
;
pcard
->
turnid
=
infos
.
turn_id
;
if
(
location
==
LOCATION_MZONE
)
{
if
(
!
infos
.
usable_exmzone
&&
sequence
>=
5
)
infos
.
usable_exmzone
=
sequence
;
}
if
(
location
==
LOCATION_MZONE
)
if
(
location
==
LOCATION_MZONE
)
player
[
playerid
].
used_location
|=
1
<<
sequence
;
player
[
playerid
].
used_location
|=
1
<<
sequence
;
if
(
location
==
LOCATION_SZONE
)
if
(
location
==
LOCATION_SZONE
)
...
@@ -534,26 +529,87 @@ int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, ui
...
@@ -534,26 +529,87 @@ int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, ui
return
count
;
return
count
;
}
}
}
}
int32
field
::
get_useable_count_fromex
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
*
list
)
{
int32
field
::
get_useable_count_fromex
(
uint8
playerid
,
uint8
uplayer
,
uint32
*
list
)
{
uint32
flag
=
0x1f
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
int32
count
=
1
;
uint32
used_flag
=
player
[
playerid
].
used_location
;
if
(
infos
.
usable_exmzone
==
5
)
{
uint32
zones
=
get_linked_zone
(
playerid
);
flag
=
flag
&
~
zones
&
0x1f
;
used_flag
=
used_flag
&
0x1f
;
int32
used_count
=
field_used_count
[
flag
];
int32
maxcount
=
6
;
if
(
player
[
playerid
].
list_mzone
[
5
]
||
player
[
playerid
].
list_mzone
[
6
])
{
flag
|=
(
1
<<
5
)
|
(
1
<<
6
);
maxcount
=
5
;
}
else
if
(
player
[
1
-
playerid
].
list_mzone
[
5
])
flag
|=
1
<<
6
;
flag
|=
1
<<
6
;
if
(
player
[
playerid
].
list_mzone
[
5
])
{
else
if
(
player
[
1
-
playerid
].
list_mzone
[
6
])
flag
|=
1
<<
5
;
count
=
0
;
}
}
else
if
(
infos
.
usable_exmzone
==
6
)
{
flag
|=
1
<<
5
;
flag
|=
1
<<
5
;
if
(
player
[
playerid
].
list_mzone
[
6
])
{
flag
|=
1
<<
6
;
count
=
0
;
}
}
if
(
list
)
if
(
list
)
*
list
=
flag
;
*
list
=
flag
;
int32
count
=
maxcount
-
used_count
;
effect_set
eset
;
if
(
uplayer
<
2
)
filter_player_effect
(
playerid
,
EFFECT_MAX_MZONE
,
&
eset
);
if
(
eset
.
size
())
{
int32
max
=
maxcount
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
LOCATION_REASON_TOFIELD
,
PARAM_TYPE_INT
);
int32
v
=
eset
[
i
]
->
get_value
(
3
);
if
(
max
>
v
)
max
=
v
;
}
int32
limit
=
max
-
field_used_count
[
used_flag
];
if
(
count
>
limit
)
count
=
limit
;
}
return
count
;
return
count
;
}
}
uint32
field
::
get_linked_zone
(
int32
playerid
)
{
uint32
zones
=
0
;
for
(
uint32
i
=
1
;
i
<
5
;
++
i
)
{
card
*
pcard
=
player
[
playerid
].
list_mzone
[
i
];
if
(
pcard
&&
pcard
->
is_link_marker
(
LINK_MARKER_LEFT
))
zones
|=
1u
<<
(
i
-
1
);
}
for
(
uint32
i
=
0
;
i
<
4
;
++
i
)
{
card
*
pcard
=
player
[
playerid
].
list_mzone
[
i
];
if
(
pcard
&&
pcard
->
is_link_marker
(
LINK_MARKER_RIGHT
))
zones
|=
1u
<<
(
i
+
1
);
}
//if((player[playerid].list_mzone[0] && player[playerid].list_mzone[0]->is_link_marker(LINK_MARKER_TOP_RIGHT))
// || (player[playerid].list_mzone[1] && player[playerid].list_mzone[1]->is_link_marker(LINK_MARKER_TOP))
// || (player[playerid].list_mzone[2] && player[playerid].list_mzone[2]->is_link_marker(LINK_MARKER_TOP_LEFT)))
// zones |= 1u << 5;
//if((player[playerid].list_mzone[2] && player[playerid].list_mzone[2]->is_link_marker(LINK_MARKER_TOP_RIGHT))
// || (player[playerid].list_mzone[3] && player[playerid].list_mzone[3]->is_link_marker(LINK_MARKER_TOP))
// || (player[playerid].list_mzone[4] && player[playerid].list_mzone[4]->is_link_marker(LINK_MARKER_TOP_LEFT)))
// zones |= 1u << 6;
for
(
uint32
i
=
0
;
i
<
2
;
++
i
)
{
card
*
pcard
=
player
[
playerid
].
list_mzone
[
i
+
5
];
if
(
pcard
)
{
if
(
pcard
->
is_link_marker
(
LINK_MARKER_BOTTOM_LEFT
))
zones
|=
1u
<<
(
i
*
2
);
if
(
pcard
->
is_link_marker
(
LINK_MARKER_BOTTOM
))
zones
|=
1u
<<
(
i
*
2
+
1
);
if
(
pcard
->
is_link_marker
(
LINK_MARKER_BOTTOM_RIGHT
))
zones
|=
1u
<<
(
i
*
2
+
2
);
}
}
for
(
uint32
i
=
0
;
i
<
2
;
++
i
)
{
card
*
pcard
=
player
[
1
-
playerid
].
list_mzone
[
i
+
5
];
if
(
pcard
)
{
if
(
pcard
->
is_link_marker
(
LINK_MARKER_TOP_LEFT
))
zones
|=
1u
<<
(
4
-
i
*
2
);
if
(
pcard
->
is_link_marker
(
LINK_MARKER_TOP
))
zones
|=
1u
<<
(
3
-
i
*
2
);
if
(
pcard
->
is_link_marker
(
LINK_MARKER_TOP_RIGHT
))
zones
|=
1u
<<
(
2
-
i
*
2
);
}
}
return
zones
;
}
void
field
::
shuffle
(
uint8
playerid
,
uint8
location
)
{
void
field
::
shuffle
(
uint8
playerid
,
uint8
location
)
{
if
(
!
(
location
&
(
LOCATION_HAND
|
LOCATION_DECK
)))
if
(
!
(
location
&
(
LOCATION_HAND
|
LOCATION_DECK
)))
return
;
return
;
...
...
field.h
View file @
6973f2ba
...
@@ -116,7 +116,6 @@ struct field_info {
...
@@ -116,7 +116,6 @@ struct field_info {
int16
card_id
;
int16
card_id
;
uint16
phase
;
uint16
phase
;
uint8
turn_player
;
uint8
turn_player
;
uint8
usable_exmzone
;
uint8
priorities
[
2
];
uint8
priorities
[
2
];
uint8
can_shuffle
;
uint8
can_shuffle
;
};
};
...
@@ -343,7 +342,8 @@ public:
...
@@ -343,7 +342,8 @@ public:
card
*
get_field_card
(
uint8
playerid
,
uint8
location
,
uint8
sequence
);
card
*
get_field_card
(
uint8
playerid
,
uint8
location
,
uint8
sequence
);
int32
is_location_useable
(
uint8
playerid
,
uint8
location
,
uint8
sequence
);
int32
is_location_useable
(
uint8
playerid
,
uint8
location
,
uint8
sequence
);
int32
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
*
list
=
0
);
int32
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
*
list
=
0
);
int32
get_useable_count_fromex
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
*
list
=
0
);
int32
get_useable_count_fromex
(
uint8
playerid
,
uint8
uplayer
,
uint32
*
list
=
0
);
uint32
get_linked_zone
(
int32
playerid
);
void
shuffle
(
uint8
playerid
,
uint8
location
);
void
shuffle
(
uint8
playerid
,
uint8
location
);
void
reset_sequence
(
uint8
playerid
,
uint8
location
);
void
reset_sequence
(
uint8
playerid
,
uint8
location
);
void
swap_deck_and_grave
(
uint8
playerid
);
void
swap_deck_and_grave
(
uint8
playerid
);
...
...
operations.cpp
View file @
6973f2ba
...
@@ -3840,7 +3840,7 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret
...
@@ -3840,7 +3840,7 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret
add_process
(
PROCESSOR_SELECT_PLACE
,
0
,
0
,
0
,
move_player
,
flag
,
1
);
add_process
(
PROCESSOR_SELECT_PLACE
,
0
,
0
,
0
,
move_player
,
flag
,
1
);
}
else
if
(
core
.
duel_rule
>=
4
&&
location
==
LOCATION_MZONE
&&
target
->
current
.
location
==
LOCATION_EXTRA
)
{
}
else
if
(
core
.
duel_rule
>=
4
&&
location
==
LOCATION_MZONE
&&
target
->
current
.
location
==
LOCATION_EXTRA
)
{
uint32
flag
;
uint32
flag
;
int32
ct
=
get_useable_count_fromex
(
playerid
,
location
,
move_player
,
&
flag
);
int32
ct
=
get_useable_count_fromex
(
playerid
,
move_player
,
&
flag
);
if
((
ret
==
1
)
&&
(
ct
<=
0
||
target
->
is_status
(
STATUS_FORBIDDEN
)
||
check_unique_onfield
(
target
,
playerid
,
location
)))
{
if
((
ret
==
1
)
&&
(
ct
<=
0
||
target
->
is_status
(
STATUS_FORBIDDEN
)
||
check_unique_onfield
(
target
,
playerid
,
location
)))
{
core
.
units
.
begin
()
->
step
=
3
;
core
.
units
.
begin
()
->
step
=
3
;
send_to
(
target
,
core
.
reason_effect
,
REASON_RULE
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
0
);
send_to
(
target
,
core
.
reason_effect
,
REASON_RULE
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
0
);
...
...
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