Commit 6194667e authored by mercury233's avatar mercury233 Committed by mercury233

update move to field flags

parent 9d6759f0
...@@ -80,6 +80,10 @@ struct card_sort { ...@@ -80,6 +80,10 @@ struct card_sort {
//Flip effect flags //Flip effect flags
#define NO_FLIP_EFFECT 0x10000 #define NO_FLIP_EFFECT 0x10000
//Move to field flags
#define RETURN_TEMP_REMOVE_TO_FIELD 1
#define RETURN_TRAP_MONSTER_TO_SZONE 2
//Types //Types
#define TYPE_MONSTER 0x1 // #define TYPE_MONSTER 0x1 //
#define TYPE_SPELL 0x2 // #define TYPE_SPELL 0x2 //
......
...@@ -897,7 +897,7 @@ int32 scriptlib::duel_return_to_field(lua_State *L) { ...@@ -897,7 +897,7 @@ int32 scriptlib::duel_return_to_field(lua_State *L) {
pcard->enable_field_effect(false); pcard->enable_field_effect(false);
pduel->game_field->adjust_instant(); pduel->game_field->adjust_instant();
pduel->game_field->refresh_location_info_instant(); pduel->game_field->refresh_location_info_instant();
pduel->game_field->move_to_field(pcard, pcard->previous.controler, pcard->previous.controler, pcard->previous.location, pos, TRUE, 1, pcard->previous.pzone, zone); pduel->game_field->move_to_field(pcard, pcard->previous.controler, pcard->previous.controler, pcard->previous.location, pos, TRUE, RETURN_TEMP_REMOVE_TO_FIELD, pcard->previous.pzone, zone);
return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) { return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) {
duel* pduel = (duel*)ctx; duel* pduel = (duel*)ctx;
lua_pushboolean(L, pduel->game_field->returns.ivalue[0]); lua_pushboolean(L, pduel->game_field->returns.ivalue[0]);
......
...@@ -1352,7 +1352,7 @@ int32 field::trap_monster_adjust(uint16 step) { ...@@ -1352,7 +1352,7 @@ int32 field::trap_monster_adjust(uint16 step) {
pcard->reset(RESET_TURN_SET, RESET_EVENT); pcard->reset(RESET_TURN_SET, RESET_EVENT);
if(core.duel_rule <= 4) if(core.duel_rule <= 4)
refresh_location_info_instant(); refresh_location_info_instant();
move_to_field(pcard, tp, tp, LOCATION_SZONE, pcard->current.position, FALSE, 2); move_to_field(pcard, tp, tp, LOCATION_SZONE, pcard->current.position, FALSE, RETURN_TRAP_MONSTER_TO_SZONE);
} }
tp = 1 - tp; tp = 1 - tp;
} }
...@@ -4550,7 +4550,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4550,7 +4550,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
switch(step) { switch(step) {
case 0: { case 0: {
returns.ivalue[0] = FALSE; returns.ivalue[0] = FALSE;
if((ret == 1) && (!(target->current.reason & REASON_TEMPORARY) || (target->current.reason_effect->owner != core.reason_effect->owner))) if((ret == RETURN_TEMP_REMOVE_TO_FIELD) && (!(target->current.reason & REASON_TEMPORARY) || (target->current.reason_effect->owner != core.reason_effect->owner)))
return TRUE; return TRUE;
if(location == LOCATION_SZONE && zone == 0x1 << 5 && (target->data.type & TYPE_FIELD) && (target->data.type & TYPE_SPELL)) { if(location == LOCATION_SZONE && zone == 0x1 << 5 && (target->data.type & TYPE_FIELD) && (target->data.type & TYPE_SPELL)) {
card* pcard = get_field_card(playerid, LOCATION_SZONE, 5); card* pcard = get_field_card(playerid, LOCATION_SZONE, 5);
...@@ -4585,7 +4585,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4585,7 +4585,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
uint32 flag; uint32 flag;
uint32 lreason = (target->current.location == LOCATION_MZONE) ? LOCATION_REASON_CONTROL : LOCATION_REASON_TOFIELD; uint32 lreason = (target->current.location == LOCATION_MZONE) ? LOCATION_REASON_CONTROL : LOCATION_REASON_TOFIELD;
int32 ct = get_useable_count(target, playerid, location, move_player, lreason, zone, &flag); int32 ct = get_useable_count(target, playerid, location, move_player, lreason, zone, &flag);
if((ret == 1) && (ct <= 0 || target->is_status(STATUS_FORBIDDEN) || !(positions & POS_FACEDOWN) && check_unique_onfield(target, playerid, location))) { if((ret == RETURN_TEMP_REMOVE_TO_FIELD) && (ct <= 0 || target->is_status(STATUS_FORBIDDEN) || !(positions & POS_FACEDOWN) && check_unique_onfield(target, playerid, location))) {
core.units.begin()->step = 3; core.units.begin()->step = 3;
send_to(target, core.reason_effect, REASON_RULE, 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;
...@@ -4604,7 +4604,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4604,7 +4604,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
} }
} }
} }
if(ret == 2 && core.duel_rule <= 4) { if(ret == RETURN_TRAP_MONSTER_TO_SZONE && core.duel_rule <= 4) {
returns.bvalue[2] = target->previous.sequence; returns.bvalue[2] = target->previous.sequence;
return FALSE; return FALSE;
} }
...@@ -4632,7 +4632,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4632,7 +4632,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
uint32 seq = returns.bvalue[2]; uint32 seq = returns.bvalue[2];
if(location == LOCATION_SZONE && zone == 0x1 << 5 && (target->data.type & TYPE_FIELD) && (target->data.type & TYPE_SPELL)) if(location == LOCATION_SZONE && zone == 0x1 << 5 && (target->data.type & TYPE_FIELD) && (target->data.type & TYPE_SPELL))
seq = 5; seq = 5;
if(ret != 1) { if(ret != RETURN_TEMP_REMOVE_TO_FIELD) {
if(location != target->current.location) { if(location != target->current.location) {
uint32 resetflag = 0; uint32 resetflag = 0;
if(location & LOCATION_ONFIELD) if(location & LOCATION_ONFIELD)
...@@ -4649,10 +4649,10 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4649,10 +4649,10 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
} }
if(!(target->current.location & LOCATION_ONFIELD)) if(!(target->current.location & LOCATION_ONFIELD))
target->clear_relate_effect(); target->clear_relate_effect();
if(ret == 1) if(ret == RETURN_TEMP_REMOVE_TO_FIELD)
target->current.reason &= ~REASON_TEMPORARY; target->current.reason &= ~REASON_TEMPORARY;
if(ret == 0 && location != target->current.location if(ret == 0 && location != target->current.location
|| ret == 1 && target->turnid != infos.turn_id) { || ret == RETURN_TEMP_REMOVE_TO_FIELD && target->turnid != infos.turn_id) {
target->set_status(STATUS_SUMMON_TURN, FALSE); target->set_status(STATUS_SUMMON_TURN, FALSE);
target->set_status(STATUS_FLIP_SUMMON_TURN, FALSE); target->set_status(STATUS_FLIP_SUMMON_TURN, FALSE);
target->set_status(STATUS_SPSUMMON_TURN, FALSE); target->set_status(STATUS_SPSUMMON_TURN, FALSE);
...@@ -4770,9 +4770,9 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4770,9 +4770,9 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
} }
} }
} }
if(enable || ((ret == 1) && target->is_position(POS_FACEUP))) if(enable || ((ret == RETURN_TEMP_REMOVE_TO_FIELD) && target->is_position(POS_FACEUP)))
target->enable_field_effect(true); target->enable_field_effect(true);
if(ret == 1 && target->current.location == LOCATION_MZONE && !(target->data.type & TYPE_MONSTER)) if(ret == RETURN_TEMP_REMOVE_TO_FIELD && target->current.location == LOCATION_MZONE && !(target->data.type & TYPE_MONSTER))
send_to(target, 0, REASON_RULE, PLAYER_NONE, PLAYER_NONE, LOCATION_GRAVE, 0, 0); send_to(target, 0, REASON_RULE, PLAYER_NONE, PLAYER_NONE, LOCATION_GRAVE, 0, 0);
else { else {
if(target->previous.location == LOCATION_GRAVE) { if(target->previous.location == LOCATION_GRAVE) {
...@@ -4955,7 +4955,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec ...@@ -4955,7 +4955,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
pcard->unequip(); pcard->unequip();
if(trapmonster) { if(trapmonster) {
refresh_location_info_instant(); refresh_location_info_instant();
move_to_field(pcard, pcard->current.controler, pcard->current.controler, LOCATION_SZONE, POS_FACEDOWN, FALSE, 2); move_to_field(pcard, pcard->current.controler, pcard->current.controler, LOCATION_SZONE, POS_FACEDOWN, FALSE, RETURN_TRAP_MONSTER_TO_SZONE);
raise_single_event(pcard, 0, EVENT_SSET, reason_effect, 0, reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_SSET, reason_effect, 0, reason_player, 0, 0);
ssets.insert(pcard); ssets.insert(pcard);
} }
......
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