Commit d5538784 authored by salix5's avatar salix5

STATUS_SPSUMMON_STEP

1. Now cards sp_summoned by Duel.SpecialSummonStep() will not be counted
into cards on the filed in every script function.

2. If a card fails to return to field, it should be sent to grave by
REASON_RULE.
parent b01eeed3
...@@ -416,7 +416,7 @@ uint32 card::get_fusion_type() { ...@@ -416,7 +416,7 @@ uint32 card::get_fusion_type() {
int32 card::get_base_attack() { int32 card::get_base_attack() {
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))
return 0; return 0;
if (current.location != LOCATION_MZONE || is_status(STATUS_SUMMONING)) if (current.location != LOCATION_MZONE || get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP))
return data.attack; return data.attack;
if (temp.base_attack != -1) if (temp.base_attack != -1)
return temp.base_attack; return temp.base_attack;
...@@ -481,7 +481,7 @@ int32 card::get_attack() { ...@@ -481,7 +481,7 @@ int32 card::get_attack() {
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))
return 0; return 0;
if (current.location != LOCATION_MZONE || is_status(STATUS_SUMMONING)) if (current.location != LOCATION_MZONE || get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP))
return data.attack; return data.attack;
if (temp.attack != -1) if (temp.attack != -1)
return temp.attack; return temp.attack;
...@@ -610,7 +610,7 @@ int32 card::get_attack() { ...@@ -610,7 +610,7 @@ int32 card::get_attack() {
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))
return 0; return 0;
if (current.location != LOCATION_MZONE || is_status(STATUS_SUMMONING)) if (current.location != LOCATION_MZONE || get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP))
return data.defense; return data.defense;
if (temp.base_defense != -1) if (temp.base_defense != -1)
return temp.base_defense; return temp.base_defense;
...@@ -674,7 +674,7 @@ int32 card::get_defense() { ...@@ -674,7 +674,7 @@ int32 card::get_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))
return 0; return 0;
if (current.location != LOCATION_MZONE || is_status(STATUS_SUMMONING)) if (current.location != LOCATION_MZONE || get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP))
return data.defense; return data.defense;
if (temp.defense != -1) if (temp.defense != -1)
return temp.defense; return temp.defense;
...@@ -802,7 +802,7 @@ int32 card::get_defense() { ...@@ -802,7 +802,7 @@ int32 card::get_defense() {
} }
// Level/Attribute/Race is available for: // Level/Attribute/Race is available for:
// 1. cards with original type TYPE_MONSTER or // 1. cards with original type TYPE_MONSTER or
// 2. cards with current type TYPE_MONSTER // 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) || (status & STATUS_NO_LEVEL)
......
...@@ -429,7 +429,7 @@ int32 effect::is_target(card* pcard) { ...@@ -429,7 +429,7 @@ int32 effect::is_target(card* pcard) {
&& !pcard->is_position(POS_FACEUP)) && !pcard->is_position(POS_FACEUP))
return FALSE; return FALSE;
if(!is_flag(EFFECT_FLAG_IGNORE_RANGE)) { if(!is_flag(EFFECT_FLAG_IGNORE_RANGE)) {
if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED)) if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP))
return FALSE; return FALSE;
if(is_flag(EFFECT_FLAG_ABSOLUTE_TARGET)) { if(is_flag(EFFECT_FLAG_ABSOLUTE_TARGET)) {
if(pcard->current.controler == 0) { if(pcard->current.controler == 0) {
......
...@@ -992,7 +992,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui ...@@ -992,7 +992,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui
if(location & LOCATION_MZONE) { if(location & LOCATION_MZONE) {
for(uint32 i = 0; i < 5; ++i) { for(uint32 i = 0; i < 5; ++i) {
pcard = player[self].list_mzone[i]; pcard = player[self].list_mzone[i];
if(pcard && !pcard->is_status(STATUS_SUMMONING) && !pcard->is_status(STATUS_SUMMON_DISABLED) && !pcard->is_status(STATUS_SPSUMMON_STEP) if(pcard && !pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_SPSUMMON_STEP)
&& pcard != pexception && pduel->lua->check_matching(pcard, findex, extraargs) && pcard != pexception && pduel->lua->check_matching(pcard, findex, extraargs)
&& (!is_target || pcard->is_capable_be_effect_target(core.reason_effect, core.reason_player))) { && (!is_target || pcard->is_capable_be_effect_target(core.reason_effect, core.reason_player))) {
if(pret) { if(pret) {
...@@ -1116,6 +1116,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui ...@@ -1116,6 +1116,7 @@ int32 field::filter_matching_card(int32 findex, uint8 self, uint32 location1, ui
} }
return FALSE; return FALSE;
} }
// Duel.GetFieldGroup(), Duel.GetFieldGroupCount()
int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, group* pgroup) { int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, group* pgroup) {
if(self != 0 && self != 1) if(self != 0 && self != 1)
return 0; return 0;
...@@ -1126,7 +1127,7 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g ...@@ -1126,7 +1127,7 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g
if(location & LOCATION_MZONE) { if(location & LOCATION_MZONE) {
for(int i = 0; i < 5; ++i) { for(int i = 0; i < 5; ++i) {
pcard = player[self].list_mzone[i]; pcard = player[self].list_mzone[i];
if(pcard && !pcard->is_status(STATUS_SUMMONING)) { if(pcard && !pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP)) {
if(pgroup) if(pgroup)
pgroup->container.insert(pcard); pgroup->container.insert(pcard);
count++; count++;
...@@ -1406,7 +1407,7 @@ void field::get_overlay_group(uint8 self, uint8 s, uint8 o, card_set* pset) { ...@@ -1406,7 +1407,7 @@ void field::get_overlay_group(uint8 self, uint8 s, uint8 o, card_set* pset) {
if(c) { if(c) {
for(int i = 0; i < 5; ++i) { for(int i = 0; i < 5; ++i) {
pcard = player[self].list_mzone[i]; pcard = player[self].list_mzone[i];
if(pcard && !pcard->is_status(STATUS_SUMMONING) && pcard->xyz_materials.size()) if(pcard && !pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP) && pcard->xyz_materials.size())
pset->insert(pcard->xyz_materials.begin(), pcard->xyz_materials.end()); pset->insert(pcard->xyz_materials.begin(), pcard->xyz_materials.end());
} }
} }
...@@ -1421,7 +1422,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) { ...@@ -1421,7 +1422,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) {
if(c) { if(c) {
for(int i = 0; i < 5; ++i) { for(int i = 0; i < 5; ++i) {
card* pcard = player[self].list_mzone[i]; card* pcard = player[self].list_mzone[i];
if(pcard && !pcard->is_status(STATUS_SUMMONING)) if(pcard && !pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP))
count += pcard->xyz_materials.size(); count += pcard->xyz_materials.size();
} }
} }
......
...@@ -477,7 +477,7 @@ int32 scriptlib::card_get_location(lua_State *L) { ...@@ -477,7 +477,7 @@ int32 scriptlib::card_get_location(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);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED)) if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP))
lua_pushinteger(L, 0); lua_pushinteger(L, 0);
else else
lua_pushinteger(L, pcard->current.location); lua_pushinteger(L, pcard->current.location);
...@@ -1745,7 +1745,8 @@ int32 scriptlib::card_is_onfield(lua_State *L) { ...@@ -1745,7 +1745,8 @@ int32 scriptlib::card_is_onfield(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);
card* pcard = *(card**) lua_touserdata(L, 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)) if((pcard->current.location & LOCATION_ONFIELD)
&& !pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
...@@ -1757,7 +1758,7 @@ int32 scriptlib::card_is_location(lua_State *L) { ...@@ -1757,7 +1758,7 @@ int32 scriptlib::card_is_location(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
uint32 loc = lua_tointeger(L, 2); uint32 loc = lua_tointeger(L, 2);
if(pcard->current.location == LOCATION_MZONE) { if(pcard->current.location == LOCATION_MZONE) {
if((loc & LOCATION_MZONE) && !pcard->is_status(STATUS_SUMMONING) && !pcard->is_status(STATUS_SUMMON_DISABLED)) if((loc & LOCATION_MZONE) && !pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_SPSUMMON_STEP))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
......
...@@ -1459,7 +1459,7 @@ int32 scriptlib::duel_get_field_card(lua_State *L) { ...@@ -1459,7 +1459,7 @@ int32 scriptlib::duel_get_field_card(lua_State *L) {
return 0; return 0;
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
card* pcard = pduel->game_field->get_field_card(playerid, location, sequence); card* pcard = pduel->game_field->get_field_card(playerid, location, sequence);
if(!pcard || pcard->is_status(STATUS_SUMMONING)) if(!pcard || pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP))
return 0; return 0;
interpreter::card2value(L, pcard); interpreter::card2value(L, pcard);
return 1; return 1;
......
...@@ -3107,7 +3107,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3107,7 +3107,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3
for (auto cit = targets->container.begin(); cit != targets->container.end();) { for (auto cit = targets->container.begin(); cit != targets->container.end();) {
auto rm = cit++; auto rm = cit++;
card* pcard = *rm; card* pcard = *rm;
if (pcard->is_status(STATUS_SUMMONING) if (pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP)
|| ((reason & REASON_SUMMON) && !pcard->is_releasable_by_summon(reason_player, pcard->current.reason_card)) || ((reason & REASON_SUMMON) && !pcard->is_releasable_by_summon(reason_player, pcard->current.reason_card))
|| (!(pcard->current.reason & (REASON_RULE | REASON_SUMMON | REASON_COST)) || (!(pcard->current.reason & (REASON_RULE | REASON_SUMMON | REASON_COST))
&& (!pcard->is_affect_by_effect(pcard->current.reason_effect) || !pcard->is_releasable_by_nonsummon(reason_player)))) { && (!pcard->is_affect_by_effect(pcard->current.reason_effect) || !pcard->is_releasable_by_nonsummon(reason_player)))) {
...@@ -3216,7 +3216,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3216,7 +3216,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
card* pcard = *rm; card* pcard = *rm;
dest = (pcard->operation_param >> 8) & 0xff; dest = (pcard->operation_param >> 8) & 0xff;
if(!(reason & REASON_RULE) && if(!(reason & REASON_RULE) &&
(pcard->is_status(STATUS_SUMMONING) (pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP)
|| (!(pcard->current.reason & REASON_COST) && !pcard->is_affect_by_effect(pcard->current.reason_effect)) || (!(pcard->current.reason & REASON_COST) && !pcard->is_affect_by_effect(pcard->current.reason_effect))
|| (dest == LOCATION_HAND && !pcard->is_capable_send_to_hand(core.reason_player)) || (dest == LOCATION_HAND && !pcard->is_capable_send_to_hand(core.reason_player))
|| (dest == LOCATION_DECK && !pcard->is_capable_send_to_deck(core.reason_player)) || (dest == LOCATION_DECK && !pcard->is_capable_send_to_deck(core.reason_player))
...@@ -3841,7 +3841,7 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret ...@@ -3841,7 +3841,7 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret
uint32 ct = get_useable_count(playerid, location, move_player, lreason, &flag); uint32 ct = get_useable_count(playerid, location, move_player, lreason, &flag);
if((ret == 1) && (ct <= 0 || target->is_status(STATUS_FORBIDDEN) || check_unique_onfield(target, playerid, location))) { if((ret == 1) && (ct <= 0 || target->is_status(STATUS_FORBIDDEN) || check_unique_onfield(target, playerid, location))) {
core.units.begin()->step = 3; core.units.begin()->step = 3;
send_to(target, core.reason_effect, REASON_EFFECT, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, 0); send_to(target, core.reason_effect, REASON_RULE, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, 0);
return FALSE; return FALSE;
} }
if(!ct) if(!ct)
...@@ -3984,7 +3984,8 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec ...@@ -3984,7 +3984,8 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
uint8 npos = pcard->position_param & 0xff; uint8 npos = pcard->position_param & 0xff;
uint8 opos = pcard->current.position; uint8 opos = pcard->current.position;
uint8 flag = pcard->position_param >> 16; uint8 flag = pcard->position_param >> 16;
if(pcard->is_status(STATUS_SUMMONING) || pcard->overlay_target || !(pcard->current.location & LOCATION_ONFIELD) if(pcard->current.location != LOCATION_MZONE || pcard->current.location != LOCATION_SZONE
|| pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP)
|| !pcard->is_affect_by_effect(reason_effect) || npos == opos || !pcard->is_affect_by_effect(reason_effect) || npos == opos
|| (!(pcard->data.type & TYPE_TOKEN) && (opos & POS_FACEUP) && (npos & POS_FACEDOWN) && !pcard->is_capable_turn_set(reason_player)) || (!(pcard->data.type & TYPE_TOKEN) && (opos & POS_FACEUP) && (npos & POS_FACEDOWN) && !pcard->is_capable_turn_set(reason_player))
|| (reason_effect && pcard->is_affected_by_effect(EFFECT_CANNOT_CHANGE_POS_E))) { || (reason_effect && pcard->is_affected_by_effect(EFFECT_CANNOT_CHANGE_POS_E))) {
......
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