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
8201e4d2
Commit
8201e4d2
authored
Mar 21, 2017
by
edo9300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added TYPE_LINK
parent
9f856217
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
15 deletions
+47
-15
card.cpp
card.cpp
+42
-15
card.h
card.h
+5
-0
No files found.
card.cpp
View file @
8201e4d2
...
@@ -105,6 +105,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
...
@@ -105,6 +105,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
if
(
query_flag
&
QUERY_TYPE
)
q_cache
.
type
=
*
p
++
=
get_type
();
if
(
query_flag
&
QUERY_TYPE
)
q_cache
.
type
=
*
p
++
=
get_type
();
if
(
query_flag
&
QUERY_LEVEL
)
q_cache
.
level
=
*
p
++
=
get_level
();
if
(
query_flag
&
QUERY_LEVEL
)
q_cache
.
level
=
*
p
++
=
get_level
();
if
(
query_flag
&
QUERY_RANK
)
q_cache
.
rank
=
*
p
++
=
get_rank
();
if
(
query_flag
&
QUERY_RANK
)
q_cache
.
rank
=
*
p
++
=
get_rank
();
if
(
query_flag
&
QUERY_LINK
)
q_cache
.
link
=
*
p
++
=
get_link
();
if
(
query_flag
&
QUERY_ATTRIBUTE
)
q_cache
.
attribute
=
*
p
++
=
get_attribute
();
if
(
query_flag
&
QUERY_ATTRIBUTE
)
q_cache
.
attribute
=
*
p
++
=
get_attribute
();
if
(
query_flag
&
QUERY_RACE
)
q_cache
.
race
=
*
p
++
=
get_race
();
if
(
query_flag
&
QUERY_RACE
)
q_cache
.
race
=
*
p
++
=
get_race
();
if
(
query_flag
&
QUERY_ATTACK
)
q_cache
.
attack
=
*
p
++
=
get_attack
();
if
(
query_flag
&
QUERY_ATTACK
)
q_cache
.
attack
=
*
p
++
=
get_attack
();
...
@@ -129,6 +130,11 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
...
@@ -129,6 +130,11 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
q_cache
.
rank
=
tdata
;
q_cache
.
rank
=
tdata
;
*
p
++
=
tdata
;
*
p
++
=
tdata
;
}
else
query_flag
&=
~
QUERY_RANK
;
}
else
query_flag
&=
~
QUERY_RANK
;
if
((
query_flag
&
QUERY_LINK
)
&&
((
uint32
)(
tdata
=
get_link
())
!=
q_cache
.
link
))
{
q_cache
.
link
=
tdata
;
*
p
++
=
tdata
;
}
else
query_flag
&=
~
QUERY_LINK
;
if
((
query_flag
&
QUERY_ATTRIBUTE
)
&&
((
uint32
)(
tdata
=
get_attribute
())
!=
q_cache
.
attribute
))
{
if
((
query_flag
&
QUERY_ATTRIBUTE
)
&&
((
uint32
)(
tdata
=
get_attribute
())
!=
q_cache
.
attribute
))
{
q_cache
.
attribute
=
tdata
;
q_cache
.
attribute
=
tdata
;
*
p
++
=
tdata
;
*
p
++
=
tdata
;
...
@@ -429,8 +435,11 @@ int32 card::get_base_attack() {
...
@@ -429,8 +435,11 @@ int32 card::get_base_attack() {
bdef
=
0
;
bdef
=
0
;
temp
.
base_attack
=
batk
;
temp
.
base_attack
=
batk
;
effect_set
eset
;
effect_set
eset
;
filter_effect
(
EFFECT_SWAP_BASE_AD
,
&
eset
,
FALSE
);
int32
swap
=
0
;
int32
swap
=
eset
.
size
();
if
(
!
(
data
.
type
&
TYPE_LINK
))
{
filter_effect
(
EFFECT_SWAP_BASE_AD
,
&
eset
,
FALSE
);
swap
=
eset
.
size
();
}
filter_effect
(
EFFECT_SET_BASE_ATTACK
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_BASE_ATTACK
,
&
eset
,
FALSE
);
if
(
swap
)
if
(
swap
)
filter_effect
(
EFFECT_SET_BASE_DEFENSE
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_BASE_DEFENSE
,
&
eset
,
FALSE
);
...
@@ -577,7 +586,8 @@ int32 card::get_attack() {
...
@@ -577,7 +586,8 @@ int32 card::get_attack() {
swap_final
=
!
swap_final
;
swap_final
=
!
swap_final
;
break
;
break
;
case
EFFECT_SWAP_BASE_AD
:
case
EFFECT_SWAP_BASE_AD
:
std
::
swap
(
batk
,
bdef
);
if
(
!
(
data
.
type
&
TYPE_LINK
))
std
::
swap
(
batk
,
bdef
);
break
;
break
;
}
}
temp
.
base_attack
=
batk
;
temp
.
base_attack
=
batk
;
...
@@ -592,7 +602,7 @@ int32 card::get_attack() {
...
@@ -592,7 +602,7 @@ int32 card::get_attack() {
for
(
int32
i
=
0
;
i
<
effects_atk
.
size
();
++
i
)
for
(
int32
i
=
0
;
i
<
effects_atk
.
size
();
++
i
)
temp
.
attack
=
effects_atk
[
i
]
->
get_value
(
this
);
temp
.
attack
=
effects_atk
[
i
]
->
get_value
(
this
);
if
(
temp
.
defense
==
-
1
)
{
if
(
temp
.
defense
==
-
1
)
{
if
(
swap_final
)
{
if
(
swap_final
&&
!
(
data
.
type
&
TYPE_LINK
)
)
{
temp
.
attack
=
get_defense
();
temp
.
attack
=
get_defense
();
}
}
for
(
int32
i
=
0
;
i
<
effects_atk_r
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
effects_atk_r
.
size
();
++
i
)
{
...
@@ -609,7 +619,7 @@ int32 card::get_attack() {
...
@@ -609,7 +619,7 @@ int32 card::get_attack() {
return
atk
;
return
atk
;
}
}
int32
card
::
get_base_defense
()
{
int32
card
::
get_base_defense
()
{
if
(
!
(
data
.
type
&
TYPE_MONSTER
)
&&
!
(
get_type
()
&
TYPE_MONSTER
)
&&
!
is_affected_by_effect
(
EFFECT_PRE_MONSTER
))
if
(
(
!
(
data
.
type
&
TYPE_MONSTER
)
&&
!
(
get_type
()
&
TYPE_MONSTER
)
&&
!
is_affected_by_effect
(
EFFECT_PRE_MONSTER
))
||
(
data
.
type
&
TYPE_LINK
))
return
0
;
return
0
;
if
(
current
.
location
!=
LOCATION_MZONE
||
get_status
(
STATUS_SUMMONING
|
STATUS_SPSUMMON_STEP
))
if
(
current
.
location
!=
LOCATION_MZONE
||
get_status
(
STATUS_SUMMONING
|
STATUS_SPSUMMON_STEP
))
return
data
.
defense
;
return
data
.
defense
;
...
@@ -671,6 +681,8 @@ int32 card::get_base_defense() {
...
@@ -671,6 +681,8 @@ int32 card::get_base_defense() {
return
bdef
;
return
bdef
;
}
}
int32
card
::
get_defense
()
{
int32
card
::
get_defense
()
{
if
(
data
.
type
&
TYPE_LINK
)
return
0
;
if
(
assume_type
==
ASSUME_DEFENSE
)
if
(
assume_type
==
ASSUME_DEFENSE
)
return
assume_value
;
return
assume_value
;
if
(
!
(
data
.
type
&
TYPE_MONSTER
)
&&
!
(
get_type
()
&
TYPE_MONSTER
)
&&
!
is_affected_by_effect
(
EFFECT_PRE_MONSTER
))
if
(
!
(
data
.
type
&
TYPE_MONSTER
)
&&
!
(
get_type
()
&
TYPE_MONSTER
)
&&
!
is_affected_by_effect
(
EFFECT_PRE_MONSTER
))
...
@@ -806,7 +818,7 @@ int32 card::get_defense() {
...
@@ -806,7 +818,7 @@ int32 card::get_defense() {
// 2. cards with current type TYPE_MONSTER or
// 2. cards with current type TYPE_MONSTER or
// 3. cards with EFFECT_PRE_MONSTER
// 3. cards with EFFECT_PRE_MONSTER
uint32
card
::
get_level
()
{
uint32
card
::
get_level
()
{
if
((
data
.
type
&
TYPE_XYZ
)
||
(
status
&
STATUS_NO_LEVEL
)
if
((
data
.
type
&
TYPE_XYZ
)
||
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
)
||
(
!
(
data
.
type
&
TYPE_MONSTER
)
&&
!
(
get_type
()
&
TYPE_MONSTER
)
&&
!
is_affected_by_effect
(
EFFECT_PRE_MONSTER
)))
||
(
!
(
data
.
type
&
TYPE_MONSTER
)
&&
!
(
get_type
()
&
TYPE_MONSTER
)
&&
!
is_affected_by_effect
(
EFFECT_PRE_MONSTER
)))
return
0
;
return
0
;
if
(
assume_type
==
ASSUME_LEVEL
)
if
(
assume_type
==
ASSUME_LEVEL
)
...
@@ -888,8 +900,23 @@ uint32 card::get_rank() {
...
@@ -888,8 +900,23 @@ uint32 card::get_rank() {
temp
.
level
=
0xffffffff
;
temp
.
level
=
0xffffffff
;
return
rank
;
return
rank
;
}
}
uint32
card
::
get_link
()
{
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
return
0
;
if
(
!
(
current
.
location
&
LOCATION_MZONE
))
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
)
||
(
status
&
STATUS_NO_LEVEL
))
if
((
data
.
type
&
TYPE_XYZ
)
||
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
return
0
;
return
0
;
uint32
lev
;
uint32
lev
;
effect_set
eset
;
effect_set
eset
;
...
@@ -901,7 +928,7 @@ uint32 card::get_synchro_level(card* pcard) {
...
@@ -901,7 +928,7 @@ uint32 card::get_synchro_level(card* pcard) {
return
lev
;
return
lev
;
}
}
uint32
card
::
get_ritual_level
(
card
*
pcard
)
{
uint32
card
::
get_ritual_level
(
card
*
pcard
)
{
if
((
data
.
type
&
TYPE_XYZ
)
||
(
status
&
STATUS_NO_LEVEL
))
if
((
data
.
type
&
TYPE_XYZ
)
||
(
data
.
type
&
TYPE_LINK
)
||
(
status
&
STATUS_NO_LEVEL
))
return
0
;
return
0
;
uint32
lev
;
uint32
lev
;
effect_set
eset
;
effect_set
eset
;
...
@@ -2840,7 +2867,7 @@ int32 card::is_capable_send_to_grave(uint8 playerid) {
...
@@ -2840,7 +2867,7 @@ int32 card::is_capable_send_to_grave(uint8 playerid) {
int32
card
::
is_capable_send_to_hand
(
uint8
playerid
)
{
int32
card
::
is_capable_send_to_hand
(
uint8
playerid
)
{
if
(
is_status
(
STATUS_LEAVE_CONFIRMED
))
if
(
is_status
(
STATUS_LEAVE_CONFIRMED
))
return
FALSE
;
return
FALSE
;
if
((
current
.
location
==
LOCATION_EXTRA
)
&&
(
data
.
type
&
(
TYPE_FUSION
+
TYPE_SYNCHRO
+
TYPE_XYZ
)))
if
((
current
.
location
==
LOCATION_EXTRA
)
&&
(
data
.
type
&
(
TYPE_FUSION
+
TYPE_SYNCHRO
+
TYPE_XYZ
+
TYPE_LINK
)))
return
FALSE
;
return
FALSE
;
if
(
is_affected_by_effect
(
EFFECT_CANNOT_TO_HAND
))
if
(
is_affected_by_effect
(
EFFECT_CANNOT_TO_HAND
))
return
FALSE
;
return
FALSE
;
...
@@ -2851,7 +2878,7 @@ int32 card::is_capable_send_to_hand(uint8 playerid) {
...
@@ -2851,7 +2878,7 @@ int32 card::is_capable_send_to_hand(uint8 playerid) {
int32
card
::
is_capable_send_to_deck
(
uint8
playerid
)
{
int32
card
::
is_capable_send_to_deck
(
uint8
playerid
)
{
if
(
is_status
(
STATUS_LEAVE_CONFIRMED
))
if
(
is_status
(
STATUS_LEAVE_CONFIRMED
))
return
FALSE
;
return
FALSE
;
if
((
current
.
location
==
LOCATION_EXTRA
)
&&
(
data
.
type
&
(
TYPE_FUSION
+
TYPE_SYNCHRO
+
TYPE_XYZ
)))
if
((
current
.
location
==
LOCATION_EXTRA
)
&&
(
data
.
type
&
(
TYPE_FUSION
+
TYPE_SYNCHRO
+
TYPE_XYZ
+
TYPE_LINK
)))
return
FALSE
;
return
FALSE
;
if
(
is_affected_by_effect
(
EFFECT_CANNOT_TO_DECK
))
if
(
is_affected_by_effect
(
EFFECT_CANNOT_TO_DECK
))
return
FALSE
;
return
FALSE
;
...
@@ -2860,7 +2887,7 @@ int32 card::is_capable_send_to_deck(uint8 playerid) {
...
@@ -2860,7 +2887,7 @@ int32 card::is_capable_send_to_deck(uint8 playerid) {
return
TRUE
;
return
TRUE
;
}
}
int32
card
::
is_capable_send_to_extra
(
uint8
playerid
)
{
int32
card
::
is_capable_send_to_extra
(
uint8
playerid
)
{
if
(
!
(
data
.
type
&
(
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
|
TYPE_PENDULUM
)))
if
(
!
(
data
.
type
&
(
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
|
TYPE_PENDULUM
|
TYPE_LINK
)))
return
FALSE
;
return
FALSE
;
if
(
is_affected_by_effect
(
EFFECT_CANNOT_TO_DECK
))
if
(
is_affected_by_effect
(
EFFECT_CANNOT_TO_DECK
))
return
FALSE
;
return
FALSE
;
...
@@ -2896,7 +2923,7 @@ int32 card::is_capable_cost_to_grave(uint8 playerid) {
...
@@ -2896,7 +2923,7 @@ int32 card::is_capable_cost_to_grave(uint8 playerid) {
int32
card
::
is_capable_cost_to_hand
(
uint8
playerid
)
{
int32
card
::
is_capable_cost_to_hand
(
uint8
playerid
)
{
uint32
redirect
=
0
;
uint32
redirect
=
0
;
uint32
dest
=
LOCATION_HAND
;
uint32
dest
=
LOCATION_HAND
;
if
(
data
.
type
&
(
TYPE_TOKEN
|
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
))
if
(
data
.
type
&
(
TYPE_TOKEN
|
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
|
TYPE_LINK
))
return
FALSE
;
return
FALSE
;
if
(
current
.
location
==
LOCATION_HAND
)
if
(
current
.
location
==
LOCATION_HAND
)
return
FALSE
;
return
FALSE
;
...
@@ -2919,7 +2946,7 @@ int32 card::is_capable_cost_to_hand(uint8 playerid) {
...
@@ -2919,7 +2946,7 @@ int32 card::is_capable_cost_to_hand(uint8 playerid) {
int32
card
::
is_capable_cost_to_deck
(
uint8
playerid
)
{
int32
card
::
is_capable_cost_to_deck
(
uint8
playerid
)
{
uint32
redirect
=
0
;
uint32
redirect
=
0
;
uint32
dest
=
LOCATION_DECK
;
uint32
dest
=
LOCATION_DECK
;
if
(
data
.
type
&
(
TYPE_TOKEN
|
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
))
if
(
data
.
type
&
(
TYPE_TOKEN
|
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
|
TYPE_LINK
))
return
FALSE
;
return
FALSE
;
if
(
current
.
location
==
LOCATION_DECK
)
if
(
current
.
location
==
LOCATION_DECK
)
return
FALSE
;
return
FALSE
;
...
@@ -2942,7 +2969,7 @@ int32 card::is_capable_cost_to_deck(uint8 playerid) {
...
@@ -2942,7 +2969,7 @@ int32 card::is_capable_cost_to_deck(uint8 playerid) {
int32
card
::
is_capable_cost_to_extra
(
uint8
playerid
)
{
int32
card
::
is_capable_cost_to_extra
(
uint8
playerid
)
{
uint32
redirect
=
0
;
uint32
redirect
=
0
;
uint32
dest
=
LOCATION_DECK
;
uint32
dest
=
LOCATION_DECK
;
if
(
!
(
data
.
type
&
(
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
)))
if
(
!
(
data
.
type
&
(
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
|
TYPE_LINK
)))
return
FALSE
;
return
FALSE
;
if
(
current
.
location
==
LOCATION_EXTRA
)
if
(
current
.
location
==
LOCATION_EXTRA
)
return
FALSE
;
return
FALSE
;
...
@@ -3085,7 +3112,7 @@ int32 card::is_can_be_fusion_material(card* fcard) {
...
@@ -3085,7 +3112,7 @@ int32 card::is_can_be_fusion_material(card* fcard) {
return
TRUE
;
return
TRUE
;
}
}
int32
card
::
is_can_be_synchro_material
(
card
*
scard
,
card
*
tuner
)
{
int32
card
::
is_can_be_synchro_material
(
card
*
scard
,
card
*
tuner
)
{
if
(
data
.
type
&
TYPE_XYZ
)
if
(
(
data
.
type
&
TYPE_XYZ
)
||
(
data
.
type
&
TYPE_LINK
)
)
return
FALSE
;
return
FALSE
;
if
(
!
(
get_type
()
&
TYPE_MONSTER
))
if
(
!
(
get_type
()
&
TYPE_MONSTER
))
return
FALSE
;
return
FALSE
;
...
...
card.h
View file @
8201e4d2
...
@@ -42,6 +42,7 @@ struct card_state {
...
@@ -42,6 +42,7 @@ struct card_state {
uint32
type
;
uint32
type
;
uint32
level
;
uint32
level
;
uint32
rank
;
uint32
rank
;
uint32
link
;
uint32
lscale
;
uint32
lscale
;
uint32
rscale
;
uint32
rscale
;
uint32
attribute
;
uint32
attribute
;
...
@@ -66,6 +67,7 @@ struct query_cache {
...
@@ -66,6 +67,7 @@ struct query_cache {
uint32
type
;
uint32
type
;
uint32
level
;
uint32
level
;
uint32
rank
;
uint32
rank
;
uint32
link
;
uint32
attribute
;
uint32
attribute
;
uint32
race
;
uint32
race
;
int32
attack
;
int32
attack
;
...
@@ -178,6 +180,7 @@ public:
...
@@ -178,6 +180,7 @@ public:
int32
get_defense
();
int32
get_defense
();
uint32
get_level
();
uint32
get_level
();
uint32
get_rank
();
uint32
get_rank
();
uint32
get_link
();
uint32
get_synchro_level
(
card
*
pcard
);
uint32
get_synchro_level
(
card
*
pcard
);
uint32
get_ritual_level
(
card
*
pcard
);
uint32
get_ritual_level
(
card
*
pcard
);
uint32
check_xyz_level
(
card
*
pcard
,
uint32
lv
);
uint32
check_xyz_level
(
card
*
pcard
,
uint32
lv
);
...
@@ -343,6 +346,7 @@ public:
...
@@ -343,6 +346,7 @@ public:
#define TYPE_XYZ 0x800000 //
#define TYPE_XYZ 0x800000 //
#define TYPE_PENDULUM 0x1000000 //
#define TYPE_PENDULUM 0x1000000 //
#define TYPE_SPSUMMON 0x2000000 //
#define TYPE_SPSUMMON 0x2000000 //
#define TYPE_LINK 0x4000000 //
//Attributes
//Attributes
#define ATTRIBUTE_EARTH 0x01 //
#define ATTRIBUTE_EARTH 0x01 //
...
@@ -474,6 +478,7 @@ public:
...
@@ -474,6 +478,7 @@ public:
#define QUERY_IS_PUBLIC 0x100000
#define QUERY_IS_PUBLIC 0x100000
#define QUERY_LSCALE 0x200000
#define QUERY_LSCALE 0x200000
#define QUERY_RSCALE 0x400000
#define QUERY_RSCALE 0x400000
#define QUERY_LINK 0x800000
#define ASSUME_CODE 1
#define ASSUME_CODE 1
#define ASSUME_TYPE 2
#define ASSUME_TYPE 2
...
...
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