Commit 4704aa74 authored by VanillaSalt's avatar VanillaSalt

update

parent ac0471ae
...@@ -435,6 +435,11 @@ uint32 card::get_fusion_type() { ...@@ -435,6 +435,11 @@ uint32 card::get_fusion_type() {
return data.type; return data.type;
return get_type(); return get_type();
} }
uint32 card::get_synchro_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. // 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. // Asuumption: we can only change the atk/def of cards in LOCATION_MZONE.
int32 card::get_base_attack() { int32 card::get_base_attack() {
...@@ -3318,7 +3323,7 @@ int32 card::is_can_be_fusion_material(card* fcard) { ...@@ -3318,7 +3323,7 @@ int32 card::is_can_be_fusion_material(card* fcard) {
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 | TYPE_LINK)) if(data.type & (TYPE_XYZ | TYPE_LINK))
return FALSE; return FALSE;
if(!(get_type() & TYPE_MONSTER)) if(!(get_synchro_type() & TYPE_MONSTER))
return FALSE; return FALSE;
if(scard && current.location == LOCATION_MZONE && current.controler != scard->current.controler && !is_affected_by_effect(EFFECT_SYNCHRO_MATERIAL)) if(scard && current.location == LOCATION_MZONE && current.controler != scard->current.controler && !is_affected_by_effect(EFFECT_SYNCHRO_MATERIAL))
return FALSE; return FALSE;
......
...@@ -178,6 +178,7 @@ public: ...@@ -178,6 +178,7 @@ public:
int32 is_fusion_set_card(uint32 set_code); int32 is_fusion_set_card(uint32 set_code);
uint32 get_type(); uint32 get_type();
uint32 get_fusion_type(); uint32 get_fusion_type();
uint32 get_synchro_type();
int32 get_base_attack(); int32 get_base_attack();
int32 get_attack(); int32 get_attack();
int32 get_base_defense(); int32 get_base_defense();
......
...@@ -2394,7 +2394,7 @@ int32 field::check_synchro_material(card* pcard, int32 findex1, int32 findex2, i ...@@ -2394,7 +2394,7 @@ int32 field::check_synchro_material(card* pcard, int32 findex1, int32 findex2, i
return FALSE; return FALSE;
} }
int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 findex2, int32 min, int32 max, card* smat, group* mg) { int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 findex2, int32 min, int32 max, card* smat, group* mg) {
if(!tuner || !tuner->is_position(POS_FACEUP) || !(tuner->get_type() & TYPE_TUNER) || !tuner->is_can_be_synchro_material(pcard)) if(!tuner || !tuner->is_position(POS_FACEUP) || !(tuner->get_synchro_type() & TYPE_TUNER) || !tuner->is_can_be_synchro_material(pcard))
return FALSE; return FALSE;
effect* pcheck = tuner->is_affected_by_effect(EFFECT_SYNCHRO_CHECK); effect* pcheck = tuner->is_affected_by_effect(EFFECT_SYNCHRO_CHECK);
if(pcheck) if(pcheck)
......
...@@ -28,6 +28,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -28,6 +28,7 @@ static const struct luaL_Reg cardlib[] = {
{ "GetType", scriptlib::card_get_type }, { "GetType", scriptlib::card_get_type },
{ "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 },
{ "GetLevel", scriptlib::card_get_level }, { "GetLevel", scriptlib::card_get_level },
{ "GetRank", scriptlib::card_get_rank }, { "GetRank", scriptlib::card_get_rank },
{ "GetLink", scriptlib::card_get_link }, { "GetLink", scriptlib::card_get_link },
...@@ -88,6 +89,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -88,6 +89,7 @@ static const struct luaL_Reg cardlib[] = {
{ "IsCode", scriptlib::card_is_code }, { "IsCode", scriptlib::card_is_code },
{ "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 },
{ "IsRace", scriptlib::card_is_race }, { "IsRace", scriptlib::card_is_race },
{ "IsAttribute", scriptlib::card_is_attribute }, { "IsAttribute", scriptlib::card_is_attribute },
{ "IsFusionAttribute", scriptlib::card_is_fusion_attribute }, { "IsFusionAttribute", scriptlib::card_is_fusion_attribute },
......
...@@ -161,6 +161,13 @@ int32 scriptlib::card_get_fusion_type(lua_State *L) { ...@@ -161,6 +161,13 @@ int32 scriptlib::card_get_fusion_type(lua_State *L) {
lua_pushinteger(L, pcard->get_fusion_type()); lua_pushinteger(L, pcard->get_fusion_type());
return 1; return 1;
} }
int32 scriptlib::card_get_synchro_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_synchro_type());
return 1;
}
int32 scriptlib::card_get_level(lua_State *L) { int32 scriptlib::card_get_level(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);
...@@ -643,6 +650,17 @@ int32 scriptlib::card_is_fusion_type(lua_State *L) { ...@@ -643,6 +650,17 @@ int32 scriptlib::card_is_fusion_type(lua_State *L) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
} }
int32 scriptlib::card_is_synchro_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_synchro_type() & ttype)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_race(lua_State *L) { int32 scriptlib::card_is_race(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);
......
...@@ -884,6 +884,8 @@ int32 field::get_control(uint16 step, effect* reason_effect, uint8 reason_player ...@@ -884,6 +884,8 @@ int32 field::get_control(uint16 step, effect* reason_effect, uint8 reason_player
} }
card* pcard = *targets->it; card* pcard = *targets->it;
move_to_field(pcard, playerid, playerid, LOCATION_MZONE, pcard->current.position, FALSE, 0, FALSE, zone); move_to_field(pcard, playerid, playerid, LOCATION_MZONE, pcard->current.position, FALSE, 0, FALSE, zone);
pcard->fieldid = infos.field_id++;
pcard->fieldid_r = pcard->fieldid;
return FALSE; return FALSE;
} }
case 4: { case 4: {
......
...@@ -30,6 +30,7 @@ public: ...@@ -30,6 +30,7 @@ public:
static int32 card_get_type(lua_State *L); static int32 card_get_type(lua_State *L);
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_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);
static int32 card_get_link(lua_State *L); static int32 card_get_link(lua_State *L);
...@@ -90,6 +91,7 @@ public: ...@@ -90,6 +91,7 @@ public:
static int32 card_is_code(lua_State *L); static int32 card_is_code(lua_State *L);
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_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);
static int32 card_is_fusion_attribute(lua_State *L); static int32 card_is_fusion_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