Commit 091ec4df authored by DailyShana's avatar DailyShana

fix reset control in end phase, close #203

parent b8e1459d
...@@ -1222,6 +1222,9 @@ void field::remove_oath_effect(effect* reason_effect) { ...@@ -1222,6 +1222,9 @@ void field::remove_oath_effect(effect* reason_effect) {
void field::reset_phase(uint32 phase) { void field::reset_phase(uint32 phase) {
for(auto eit = effects.pheff.begin(); eit != effects.pheff.end();) { for(auto eit = effects.pheff.begin(); eit != effects.pheff.end();) {
auto rm = eit++; auto rm = eit++;
// work around: skip turn still raise reset_phase(PHASE_END)
// without this taking control only for one turn will be returned when skipping turn
// RESET_TURN_END should be introduced
if((*rm)->code == EFFECT_SET_CONTROL) if((*rm)->code == EFFECT_SET_CONTROL)
continue; continue;
if((*rm)->reset(phase, RESET_PHASE)) { if((*rm)->reset(phase, RESET_PHASE)) {
......
...@@ -1395,6 +1395,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1395,6 +1395,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
core.select_chains.push_back(newchain); core.select_chains.push_back(newchain);
cn_count++; cn_count++;
} }
//all effects taking control non-permanently are only until End Phase, not until Turn end
for(auto eit = effects.pheff.begin(); eit != effects.pheff.end();) { for(auto eit = effects.pheff.begin(); eit != effects.pheff.end();) {
effect* peffect = *eit++; effect* peffect = *eit++;
if(peffect->code != EFFECT_SET_CONTROL) if(peffect->code != EFFECT_SET_CONTROL)
...@@ -1407,7 +1408,8 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1407,7 +1408,8 @@ int32 field::process_phase_event(int16 step, int32 phase) {
uint8 tp = infos.turn_player; uint8 tp = infos.turn_player;
if(!(((peffect->reset_flag & RESET_SELF_TURN) && pid == tp) || ((peffect->reset_flag & RESET_OPPO_TURN) && pid != tp))) if(!(((peffect->reset_flag & RESET_SELF_TURN) && pid == tp) || ((peffect->reset_flag & RESET_OPPO_TURN) && pid != tp)))
continue; continue;
if(peffect->reset_count != 1) peffect->reset_count--;
if(peffect->reset_count != 0)
continue; continue;
card* phandler = peffect->get_handler(); card* phandler = peffect->get_handler();
if(pid != phandler->current.controler) { if(pid != phandler->current.controler) {
...@@ -5047,7 +5049,7 @@ int32 field::adjust_step(uint16 step) { ...@@ -5047,7 +5049,7 @@ int32 field::adjust_step(uint16 step) {
return FALSE; return FALSE;
} }
case 4: { case 4: {
//1-5 control //control
core.control_adjust_set[0].clear(); core.control_adjust_set[0].clear();
core.control_adjust_set[1].clear(); core.control_adjust_set[1].clear();
for(uint8 p = 0; p < 2; ++p) { for(uint8 p = 0; p < 2; ++p) {
...@@ -5077,7 +5079,6 @@ int32 field::adjust_step(uint16 step) { ...@@ -5077,7 +5079,6 @@ int32 field::adjust_step(uint16 step) {
if(res) { if(res) {
for(uint8 p = 0; p < 2; ++p) { for(uint8 p = 0; p < 2; ++p) {
for(auto& pcard : player[p].list_mzone) { for(auto& pcard : player[p].list_mzone) {
// remove EFFECT_SET_CONTROL
if(pcard && pcard->is_affected_by_effect(EFFECT_REMOVE_BRAINWASHING)) { if(pcard && pcard->is_affected_by_effect(EFFECT_REMOVE_BRAINWASHING)) {
pcard->reset(EFFECT_SET_CONTROL, RESET_CODE); pcard->reset(EFFECT_SET_CONTROL, RESET_CODE);
if(p != pcard->owner && pcard->is_capable_change_control()) if(p != pcard->owner && pcard->is_capable_change_control())
......
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