Skip to content

Commit

Permalink
Temp removed monsters can change position (#699)
Browse files Browse the repository at this point in the history
* Temp removed monsters can change position

* rename STATUS_FORM_CHANGED to STATUS_CANNOT_CHANGE_FORM

* Add STATUS_CANNOT_CHANGE_FORM after STATUS_PROC_COMPLETE

* reset STATUS_SUMMON_TURN, STATUS_CANNOT_CHANGE_FORM when return to field

---------

Co-authored-by: salix5 <salix5566@gmail.com>
  • Loading branch information
Wind2009-Louse and salix5 authored Dec 28, 2024
1 parent 83936a3 commit 1a0b712
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
8 changes: 2 additions & 6 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3419,9 +3419,7 @@ int32_t card::get_set_tribute_count() {
return min + (max << 16);
}
int32_t card::is_can_be_flip_summoned(uint8_t playerid) {
if(is_status(STATUS_SUMMON_TURN) || is_status(STATUS_FLIP_SUMMON_TURN) || is_status(STATUS_SPSUMMON_TURN) || is_status(STATUS_FORM_CHANGED))
return FALSE;
if(announce_count > 0)
if(is_status(STATUS_CANNOT_CHANGE_FORM))
return FALSE;
if(current.location != LOCATION_MZONE)
return FALSE;
Expand Down Expand Up @@ -3949,12 +3947,10 @@ int32_t card::is_capable_attack_announce(uint8_t playerid) {
return TRUE;
}
int32_t card::is_capable_change_position(uint8_t playerid) {
if(get_status(STATUS_SUMMON_TURN | STATUS_FLIP_SUMMON_TURN | STATUS_SPSUMMON_TURN | STATUS_FORM_CHANGED))
if(is_status(STATUS_CANNOT_CHANGE_FORM))
return FALSE;
if(data.type & TYPE_LINK)
return FALSE;
if(announce_count > 0)
return FALSE;
if(is_status(STATUS_FORBIDDEN))
return FALSE;
if(is_affected_by_effect(EFFECT_CANNOT_CHANGE_POSITION))
Expand Down
2 changes: 1 addition & 1 deletion common.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ inline bool check_playerid(int32_t playerid) {
#define STATUS_NO_LEVEL 0x0020
#define STATUS_BATTLE_RESULT 0x0040
#define STATUS_SPSUMMON_STEP 0x0080
#define STATUS_FORM_CHANGED 0x0100
#define STATUS_CANNOT_CHANGE_FORM 0x0100
#define STATUS_SUMMONING 0x0200
#define STATUS_EFFECT_ENABLED 0x0400
#define STATUS_SUMMON_TURN 0x0800
Expand Down
14 changes: 10 additions & 4 deletions operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,7 @@ int32_t field::summon(uint16_t step, uint8_t sumplayer, card* target, effect* pr
target->set_status(STATUS_SUMMONING, FALSE);
target->set_status(STATUS_FLIP_SUMMONING, FALSE);
target->set_status(STATUS_SUMMON_TURN, TRUE);
target->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
target->enable_field_effect(true);
if(target->is_status(STATUS_DISABLED))
target->reset(RESET_DISABLE, RESET_EVENT);
Expand Down Expand Up @@ -2048,6 +2049,7 @@ int32_t field::flip_summon(uint16_t step, uint8_t sumplayer, card * target, uint
if(target->is_status(STATUS_DISABLED))
target->reset(RESET_DISABLE, RESET_EVENT);
target->set_status(STATUS_FLIP_SUMMON_TURN, TRUE);
target->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
return FALSE;
}
case 4: {
Expand Down Expand Up @@ -2395,6 +2397,7 @@ int32_t field::mset(uint16_t step, uint8_t setplayer, card* target, effect* proc
++core.normalsummon_state_count[setplayer];
check_card_counter(target, ACTIVITY_NORMALSUMMON, setplayer);
target->set_status(STATUS_SUMMON_TURN, TRUE);
target->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
pduel->write_buffer8(MSG_SET);
pduel->write_buffer32(target->data.code);
pduel->write_buffer32(target->get_info_location());
Expand Down Expand Up @@ -2929,6 +2932,7 @@ int32_t field::special_summon_rule(uint16_t step, uint8_t sumplayer, card* targe
}
target->set_status(STATUS_SUMMONING, FALSE);
target->set_status(STATUS_PROC_COMPLETE | STATUS_SPSUMMON_TURN, TRUE);
target->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
target->enable_field_effect(true);
if(target->is_status(STATUS_DISABLED))
target->reset(RESET_DISABLE, RESET_EVENT);
Expand Down Expand Up @@ -3136,6 +3140,7 @@ int32_t field::special_summon_rule(uint16_t step, uint8_t sumplayer, card* targe
for(auto& pcard : pgroup->container) {
pcard->set_status(STATUS_SUMMONING, FALSE);
pcard->set_status(STATUS_SPSUMMON_TURN, TRUE);
pcard->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
pcard->enable_field_effect(true);
if(pcard->is_status(STATUS_DISABLED))
pcard->reset(RESET_DISABLE, RESET_EVENT);
Expand Down Expand Up @@ -3352,6 +3357,7 @@ int32_t field::special_summon(uint16_t step, effect* reason_effect, uint8_t reas
for(auto& pcard : targets->container) {
pcard->set_status(STATUS_SPSUMMON_STEP, FALSE);
pcard->set_status(STATUS_SPSUMMON_TURN, TRUE);
pcard->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
if(pcard->is_position(POS_FACEUP))
pcard->enable_field_effect(true);
}
Expand Down Expand Up @@ -4645,15 +4651,15 @@ int32_t field::move_to_field(uint16_t step, card* target, uint32_t enable, uint3
}
if(!(target->current.location & LOCATION_ONFIELD))
target->clear_relate_effect();
if(ret == RETURN_TEMP_REMOVE_TO_FIELD)
if(ret == RETURN_TEMP_REMOVE_TO_FIELD) {
target->current.reason &= ~REASON_TEMPORARY;
if(ret == 0 && location != target->current.location
|| ret == RETURN_TEMP_REMOVE_TO_FIELD && target->turnid != infos.turn_id) {
}
if(ret == 0 && location != target->current.location || ret == RETURN_TEMP_REMOVE_TO_FIELD) {
target->set_status(STATUS_SUMMON_TURN, FALSE);
target->set_status(STATUS_FLIP_SUMMON_TURN, FALSE);
target->set_status(STATUS_SPSUMMON_TURN, FALSE);
target->set_status(STATUS_SET_TURN, FALSE);
target->set_status(STATUS_FORM_CHANGED, FALSE);
target->set_status(STATUS_CANNOT_CHANGE_FORM, FALSE);
}
target->temp.sequence = seq;
if(location != LOCATION_MZONE) {
Expand Down
10 changes: 7 additions & 3 deletions processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,7 @@ int32_t field::process_idle_command(uint16_t step) {
return FALSE;
} else
add_process(PROCESSOR_FLIP_SUMMON, 0, 0, (group*)target, target->current.controler, 0);
target->set_status(STATUS_FORM_CHANGED, TRUE);
target->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
core.units.begin()->step = -1;
return FALSE;
}
Expand Down Expand Up @@ -2375,7 +2375,7 @@ int32_t field::process_idle_command(uint16_t step) {
adjust_all();
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, 0);
}
target->set_status(STATUS_FORM_CHANGED, TRUE);
target->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
core.units.begin()->step = -1;
return FALSE;
}
Expand Down Expand Up @@ -2665,6 +2665,7 @@ int32_t field::process_battle_command(uint16_t step) {
}
if(core.units.begin()->arg3) {//attack announce failed
++core.attacker->announce_count;
core.attacker->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
core.chain_attack = FALSE;
core.units.begin()->step = -1;
}
Expand Down Expand Up @@ -2739,6 +2740,7 @@ int32_t field::process_battle_command(uint16_t step) {
// go to damage step
if(!core.attack_rollback) {
++core.attacker->announce_count;
core.attacker->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
core.attacker->announced_cards.addcard(core.attack_target);
attack_all_target_check();
core.units.begin()->step = 18;
Expand Down Expand Up @@ -2771,6 +2773,7 @@ int32_t field::process_battle_command(uint16_t step) {
case 13: {
if(core.attacker->fieldid_r == core.pre_field[0]) {
++core.attacker->announce_count;
core.attacker->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
core.attacker->announced_cards.addcard(core.attack_target);
attack_all_target_check();
}
Expand Down Expand Up @@ -3323,6 +3326,7 @@ int32_t field::process_damage_step(uint16_t step, uint32_t new_attack) {
if(core.attacker) {
core.attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
++core.attacker->announce_count;
core.attacker->set_status(STATUS_CANNOT_CHANGE_FORM, TRUE);
core.attacker->announced_cards.addcard(core.attack_target);
attack_all_target_check();
}
Expand Down Expand Up @@ -3674,7 +3678,7 @@ int32_t field::process_turn(uint16_t step, uint8_t turn_player) {
pcard->set_status(STATUS_FLIP_SUMMON_TURN, FALSE);
pcard->set_status(STATUS_SPSUMMON_TURN, FALSE);
pcard->set_status(STATUS_SET_TURN, FALSE);
pcard->set_status(STATUS_FORM_CHANGED, FALSE);
pcard->set_status(STATUS_CANNOT_CHANGE_FORM, FALSE);
pcard->indestructable_effects.clear();
pcard->attack_announce_count = 0;
pcard->announce_count = 0;
Expand Down

0 comments on commit 1a0b712

Please sign in to comment.