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
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
MyCard
ygopro-core
Commits
a68af2c2
Commit
a68af2c2
authored
Jun 27, 2017
by
nekrozar
Committed by
mercury233
Jun 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Card.IsCanBeLinkMaterial, Card.GetLinkType and Card.IsLinkType (#98)
parent
d7c5bec5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
0 deletions
+56
-0
card.cpp
card.cpp
+17
-0
card.h
card.h
+2
-0
effect.h
effect.h
+1
-0
interpreter.cpp
interpreter.cpp
+3
-0
libcard.cpp
libcard.cpp
+30
-0
scriptlib.h
scriptlib.h
+3
-0
No files found.
card.cpp
View file @
a68af2c2
...
...
@@ -440,6 +440,11 @@ uint32 card::get_synchro_type() {
return
data
.
type
;
return
get_type
();
}
uint32
card
::
get_link_type
()
{
if
(
current
.
location
==
LOCATION_SZONE
&&
(
data
.
type
&
TYPE_MONSTER
))
return
data
.
type
;
return
get_type
();
}
// Atk and def are sepcial cases since text atk/def ? are involved.
// Asuumption: we can only change the atk/def of cards in LOCATION_MZONE.
int32
card
::
get_base_attack
()
{
...
...
@@ -3421,3 +3426,15 @@ int32 card::is_can_be_xyz_material(card* scard) {
return
FALSE
;
return
TRUE
;
}
int32
card
::
is_can_be_link_material
(
card
*
scard
)
{
if
(
!
(
get_link_type
()
&
TYPE_MONSTER
))
return
FALSE
;
if
(
is_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
effect_set
eset
;
filter_effect
(
EFFECT_CANNOT_BE_LINK_MATERIAL
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
if
(
eset
[
i
]
->
get_value
(
scard
))
return
FALSE
;
return
TRUE
;
}
card.h
View file @
a68af2c2
...
...
@@ -179,6 +179,7 @@ public:
uint32
get_type
();
uint32
get_fusion_type
();
uint32
get_synchro_type
();
uint32
get_link_type
();
int32
get_base_attack
();
int32
get_attack
();
int32
get_base_defense
();
...
...
@@ -310,6 +311,7 @@ public:
int32
is_can_be_synchro_material
(
card
*
scard
,
card
*
tuner
=
0
);
int32
is_can_be_ritual_material
(
card
*
scard
);
int32
is_can_be_xyz_material
(
card
*
scard
);
int32
is_can_be_link_material
(
card
*
scard
);
};
//Locations
...
...
effect.h
View file @
a68af2c2
...
...
@@ -357,6 +357,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_CANNOT_BE_SYNCHRO_MATERIAL 236
#define EFFECT_SYNCHRO_MATERIAL_CUSTOM 237
#define EFFECT_CANNOT_BE_XYZ_MATERIAL 238
#define EFFECT_CANNOT_BE_LINK_MATERIAL 239
#define EFFECT_SYNCHRO_LEVEL 240
#define EFFECT_RITUAL_LEVEL 241
#define EFFECT_XYZ_LEVEL 242
...
...
interpreter.cpp
View file @
a68af2c2
...
...
@@ -29,6 +29,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetOriginalType"
,
scriptlib
::
card_get_origin_type
},
{
"GetFusionType"
,
scriptlib
::
card_get_fusion_type
},
{
"GetSynchroType"
,
scriptlib
::
card_get_synchro_type
},
{
"GetLinkType"
,
scriptlib
::
card_get_link_type
},
{
"GetLevel"
,
scriptlib
::
card_get_level
},
{
"GetRank"
,
scriptlib
::
card_get_rank
},
{
"GetLink"
,
scriptlib
::
card_get_link
},
...
...
@@ -91,6 +92,7 @@ static const struct luaL_Reg cardlib[] = {
{
"IsType"
,
scriptlib
::
card_is_type
},
{
"IsFusionType"
,
scriptlib
::
card_is_fusion_type
},
{
"IsSynchroType"
,
scriptlib
::
card_is_synchro_type
},
{
"IsLinkType"
,
scriptlib
::
card_is_link_type
},
{
"IsRace"
,
scriptlib
::
card_is_race
},
{
"IsAttribute"
,
scriptlib
::
card_is_attribute
},
{
"IsFusionAttribute"
,
scriptlib
::
card_is_fusion_attribute
},
...
...
@@ -218,6 +220,7 @@ static const struct luaL_Reg cardlib[] = {
{
"IsCanBeSynchroMaterial"
,
scriptlib
::
card_is_can_be_synchro_material
},
{
"IsCanBeRitualMaterial"
,
scriptlib
::
card_is_can_be_ritual_material
},
{
"IsCanBeXyzMaterial"
,
scriptlib
::
card_is_can_be_xyz_material
},
{
"IsCanBeLinkMaterial"
,
scriptlib
::
card_is_can_be_link_material
},
{
"CheckFusionMaterial"
,
scriptlib
::
card_check_fusion_material
},
{
"CheckFusionSubstitute"
,
scriptlib
::
card_check_fusion_substitute
},
{
"IsImmuneToEffect"
,
scriptlib
::
card_is_immune_to_effect
},
...
...
libcard.cpp
View file @
a68af2c2
...
...
@@ -168,6 +168,13 @@ int32 scriptlib::card_get_synchro_type(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
get_synchro_type
());
return
1
;
}
int32
scriptlib
::
card_get_link_type
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
lua_pushinteger
(
L
,
pcard
->
get_link_type
());
return
1
;
}
int32
scriptlib
::
card_get_level
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -668,6 +675,17 @@ int32 scriptlib::card_is_synchro_type(lua_State *L) {
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_link_type
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_tointeger
(
L
,
2
);
if
(
pcard
->
get_link_type
()
&
ttype
)
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_race
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -2177,6 +2195,18 @@ int32 scriptlib::card_is_can_be_xyz_material(lua_State *L) {
lua_pushboolean
(
L
,
pcard
->
is_can_be_xyz_material
(
scard
));
return
1
;
}
int32
scriptlib
::
card_is_can_be_link_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
scard
=
0
;
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
{
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
}
lua_pushboolean
(
L
,
pcard
->
is_can_be_link_material
(
scard
));
return
1
;
}
int32
scriptlib
::
card_check_fusion_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
scriptlib.h
View file @
a68af2c2
...
...
@@ -31,6 +31,7 @@ public:
static
int32
card_get_origin_type
(
lua_State
*
L
);
static
int32
card_get_fusion_type
(
lua_State
*
L
);
static
int32
card_get_synchro_type
(
lua_State
*
L
);
static
int32
card_get_link_type
(
lua_State
*
L
);
static
int32
card_get_level
(
lua_State
*
L
);
static
int32
card_get_rank
(
lua_State
*
L
);
static
int32
card_get_link
(
lua_State
*
L
);
...
...
@@ -93,6 +94,7 @@ public:
static
int32
card_is_type
(
lua_State
*
L
);
static
int32
card_is_fusion_type
(
lua_State
*
L
);
static
int32
card_is_synchro_type
(
lua_State
*
L
);
static
int32
card_is_link_type
(
lua_State
*
L
);
static
int32
card_is_race
(
lua_State
*
L
);
static
int32
card_is_attribute
(
lua_State
*
L
);
static
int32
card_is_fusion_attribute
(
lua_State
*
L
);
...
...
@@ -220,6 +222,7 @@ public:
static
int32
card_is_can_be_synchro_material
(
lua_State
*
L
);
static
int32
card_is_can_be_ritual_material
(
lua_State
*
L
);
static
int32
card_is_can_be_xyz_material
(
lua_State
*
L
);
static
int32
card_is_can_be_link_material
(
lua_State
*
L
);
static
int32
card_check_fusion_material
(
lua_State
*
L
);
static
int32
card_check_fusion_substitute
(
lua_State
*
L
);
static
int32
card_is_immune_to_effect
(
lua_State
*
L
);
...
...
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