Commit 0dcb83ef authored by nekrozar's avatar nekrozar Committed by mercury233

add Card.GetXyzType&Card.IsXyzType (#99)

parent a68af2c2
...@@ -440,6 +440,11 @@ uint32 card::get_synchro_type() { ...@@ -440,6 +440,11 @@ uint32 card::get_synchro_type() {
return data.type; return data.type;
return get_type(); return get_type();
} }
uint32 card::get_xyz_type() {
if(current.location == LOCATION_SZONE && (data.type & TYPE_MONSTER))
return data.type;
return get_type();
}
uint32 card::get_link_type() { uint32 card::get_link_type() {
if(current.location == LOCATION_SZONE && (data.type & TYPE_MONSTER)) if(current.location == LOCATION_SZONE && (data.type & TYPE_MONSTER))
return data.type; return data.type;
...@@ -3415,7 +3420,7 @@ int32 card::is_can_be_ritual_material(card* scard) { ...@@ -3415,7 +3420,7 @@ int32 card::is_can_be_ritual_material(card* scard) {
int32 card::is_can_be_xyz_material(card* scard) { int32 card::is_can_be_xyz_material(card* scard) {
if(data.type & TYPE_TOKEN) if(data.type & TYPE_TOKEN)
return FALSE; return FALSE;
if(!(get_type() & TYPE_MONSTER)) if(!(get_xyz_type() & TYPE_MONSTER))
return FALSE; return FALSE;
if(is_status(STATUS_FORBIDDEN)) if(is_status(STATUS_FORBIDDEN))
return FALSE; return FALSE;
......
...@@ -179,6 +179,7 @@ public: ...@@ -179,6 +179,7 @@ public:
uint32 get_type(); uint32 get_type();
uint32 get_fusion_type(); uint32 get_fusion_type();
uint32 get_synchro_type(); uint32 get_synchro_type();
uint32 get_xyz_type();
uint32 get_link_type(); uint32 get_link_type();
int32 get_base_attack(); int32 get_base_attack();
int32 get_attack(); int32 get_attack();
......
...@@ -29,6 +29,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -29,6 +29,7 @@ static const struct luaL_Reg cardlib[] = {
{ "GetOriginalType", scriptlib::card_get_origin_type }, { "GetOriginalType", scriptlib::card_get_origin_type },
{ "GetFusionType", scriptlib::card_get_fusion_type }, { "GetFusionType", scriptlib::card_get_fusion_type },
{ "GetSynchroType", scriptlib::card_get_synchro_type }, { "GetSynchroType", scriptlib::card_get_synchro_type },
{ "GetXyzType", scriptlib::card_get_xyz_type },
{ "GetLinkType", scriptlib::card_get_link_type }, { "GetLinkType", scriptlib::card_get_link_type },
{ "GetLevel", scriptlib::card_get_level }, { "GetLevel", scriptlib::card_get_level },
{ "GetRank", scriptlib::card_get_rank }, { "GetRank", scriptlib::card_get_rank },
...@@ -92,6 +93,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -92,6 +93,7 @@ static const struct luaL_Reg cardlib[] = {
{ "IsType", scriptlib::card_is_type }, { "IsType", scriptlib::card_is_type },
{ "IsFusionType", scriptlib::card_is_fusion_type }, { "IsFusionType", scriptlib::card_is_fusion_type },
{ "IsSynchroType", scriptlib::card_is_synchro_type }, { "IsSynchroType", scriptlib::card_is_synchro_type },
{ "IsXyzType", scriptlib::card_is_xyz_type },
{ "IsLinkType", scriptlib::card_is_link_type }, { "IsLinkType", scriptlib::card_is_link_type },
{ "IsRace", scriptlib::card_is_race }, { "IsRace", scriptlib::card_is_race },
{ "IsAttribute", scriptlib::card_is_attribute }, { "IsAttribute", scriptlib::card_is_attribute },
......
...@@ -168,6 +168,13 @@ int32 scriptlib::card_get_synchro_type(lua_State *L) { ...@@ -168,6 +168,13 @@ int32 scriptlib::card_get_synchro_type(lua_State *L) {
lua_pushinteger(L, pcard->get_synchro_type()); lua_pushinteger(L, pcard->get_synchro_type());
return 1; return 1;
} }
int32 scriptlib::card_get_xyz_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_xyz_type());
return 1;
}
int32 scriptlib::card_get_link_type(lua_State *L) { int32 scriptlib::card_get_link_type(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
...@@ -675,6 +682,17 @@ int32 scriptlib::card_is_synchro_type(lua_State *L) { ...@@ -675,6 +682,17 @@ int32 scriptlib::card_is_synchro_type(lua_State *L) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
} }
int32 scriptlib::card_is_xyz_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_xyz_type() & ttype)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_link_type(lua_State *L) { int32 scriptlib::card_is_link_type(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
......
...@@ -31,6 +31,7 @@ public: ...@@ -31,6 +31,7 @@ public:
static int32 card_get_origin_type(lua_State *L); static int32 card_get_origin_type(lua_State *L);
static int32 card_get_fusion_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_synchro_type(lua_State *L);
static int32 card_get_xyz_type(lua_State *L);
static int32 card_get_link_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_level(lua_State *L);
static int32 card_get_rank(lua_State *L); static int32 card_get_rank(lua_State *L);
...@@ -94,6 +95,7 @@ public: ...@@ -94,6 +95,7 @@ public:
static int32 card_is_type(lua_State *L); static int32 card_is_type(lua_State *L);
static int32 card_is_fusion_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_synchro_type(lua_State *L);
static int32 card_is_xyz_type(lua_State *L);
static int32 card_is_link_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_race(lua_State *L);
static int32 card_is_attribute(lua_State *L); static int32 card_is_attribute(lua_State *L);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment