Commit c8a18d35 authored by mercury233's avatar mercury233

add card::is_treated_as_not_on_field

parent d4e635f4
......@@ -1286,8 +1286,7 @@ int32 card::is_link_marker(uint32 dir) {
return (int32)(get_link_marker() & dir);
}
uint32 card::get_linked_zone() {
if(!(data.type & TYPE_LINK) || current.location != LOCATION_MZONE
|| get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_SPSUMMON_STEP))
if(!(data.type & TYPE_LINK) || current.location != LOCATION_MZONE || is_treated_as_not_on_field())
return 0;
int32 zones = 0;
int32 s = current.sequence;
......@@ -1343,8 +1342,7 @@ void card::get_linked_cards(card_set* cset) {
pduel->game_field->get_cards_in_zone(cset, linked_zone >> 16, 1 - p, LOCATION_MZONE);
}
uint32 card::get_mutual_linked_zone() {
if(!(data.type & TYPE_LINK) || current.location != LOCATION_MZONE
|| get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_SPSUMMON_STEP))
if(!(data.type & TYPE_LINK) || current.location != LOCATION_MZONE || is_treated_as_not_on_field())
return 0;
int32 zones = 0;
int32 p = current.controler;
......@@ -1507,6 +1505,10 @@ int32 card::is_all_column() {
return TRUE;
return FALSE;
}
int32 card::is_treated_as_not_on_field() {
return get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP);
}
void card::equip(card* target, uint32 send_msg) {
if (equiping_target)
return;
......
......@@ -268,6 +268,7 @@ public:
uint32 get_column_zone(int32 location);
void get_column_cards(card_set* cset);
int32 is_all_column();
int32 is_treated_as_not_on_field();
void equip(card* target, uint32 send_msg = TRUE);
void unequip();
......
......@@ -473,7 +473,7 @@ int32 effect::is_target(card* pcard) {
&& !pcard->is_position(POS_FACEUP))
return FALSE;
if(!is_flag(EFFECT_FLAG_IGNORE_RANGE)) {
if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP))
if(pcard->is_treated_as_not_on_field())
return FALSE;
if(is_flag(EFFECT_FLAG_SPSUM_PARAM))
return FALSE;
......
......@@ -1446,7 +1446,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui
for(uint32 p = 0; p < 2; ++p) {
if(location & LOCATION_MZONE) {
for(auto& pcard : player[self].list_mzone) {
if(pcard && !pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_SPSUMMON_STEP)
if(pcard && !pcard->is_treated_as_not_on_field()
&& pcard != pexception && !(pexgroup && pexgroup->has_card(pcard))
&& pduel->lua->check_matching(pcard, findex, extraargs)
&& (!is_target || pcard->is_capable_be_effect_target(core.reason_effect, core.reason_player))) {
......@@ -1465,7 +1465,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui
}
if(location & LOCATION_SZONE) {
for(auto& pcard : player[self].list_szone) {
if(pcard && !pcard->is_status(STATUS_ACTIVATE_DISABLED)
if(pcard && !pcard->is_treated_as_not_on_field()
&& pcard != pexception && !(pexgroup && pexgroup->has_card(pcard))
&& pduel->lua->check_matching(pcard, findex, extraargs)
&& (!is_target || pcard->is_capable_be_effect_target(core.reason_effect, core.reason_player))) {
......@@ -1484,7 +1484,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui
}
if(location & LOCATION_FZONE) {
card* pcard = player[self].list_szone[5];
if(pcard && !pcard->is_status(STATUS_ACTIVATE_DISABLED)
if(pcard && !pcard->is_treated_as_not_on_field()
&& pcard != pexception && !(pexgroup && pexgroup->has_card(pcard))
&& pduel->lua->check_matching(pcard, findex, extraargs)
&& (!is_target || pcard->is_capable_be_effect_target(core.reason_effect, core.reason_player))) {
......@@ -1503,7 +1503,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui
if(location & LOCATION_PZONE) {
for(int32 i = 0; i < 2; ++i) {
card* pcard = player[self].list_szone[core.duel_rule >= 4 ? i * 4 : i + 6];
if(pcard && pcard->current.pzone && !pcard->is_status(STATUS_ACTIVATE_DISABLED)
if(pcard && pcard->current.pzone && !pcard->is_treated_as_not_on_field()
&& pcard != pexception && !(pexgroup && pexgroup->has_card(pcard))
&& pduel->lua->check_matching(pcard, findex, extraargs)
&& (!is_target || pcard->is_capable_be_effect_target(core.reason_effect, core.reason_player))) {
......@@ -1895,7 +1895,7 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater
void field::get_fusion_material(uint8 playerid, card_set* material_all, card_set* material_base, uint32 location) {
if(location & LOCATION_MZONE) {
for(auto& pcard : player[playerid].list_mzone) {
if(pcard && !pcard->is_status(STATUS_SUMMONING))
if(pcard && !pcard->is_treated_as_not_on_field())
material_base->insert(pcard);
}
}
......
......@@ -824,7 +824,7 @@ int32 scriptlib::card_get_location(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP))
if(pcard->is_treated_as_not_on_field())
lua_pushinteger(L, 0);
else
lua_pushinteger(L, pcard->current.location);
......@@ -2613,8 +2613,7 @@ int32 scriptlib::card_is_onfield(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
if((pcard->current.location & LOCATION_ONFIELD)
&& !pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP))
if((pcard->current.location & LOCATION_ONFIELD) && !pcard->is_treated_as_not_on_field())
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
......@@ -2625,13 +2624,15 @@ int32 scriptlib::card_is_location(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 loc = (uint32)lua_tointeger(L, 2);
if(pcard->current.location == LOCATION_MZONE) {
if((loc & LOCATION_MZONE) && !pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_SPSUMMON_STEP))
if(pcard->is_treated_as_not_on_field()) {
lua_pushboolean(L, 0);
} else if(pcard->current.location == LOCATION_MZONE) {
if(loc & LOCATION_MZONE)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
} else if(pcard->current.location == LOCATION_SZONE) {
if(pcard->current.is_location(loc) && !pcard->is_status(STATUS_ACTIVATE_DISABLED))
if(pcard->current.is_location(loc))
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
......
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