Commit 1ebb90a6 authored by fallenstardust's avatar fallenstardust

sync ocgcore

parent 5e57ceef
...@@ -1899,11 +1899,13 @@ int32 card::replace_effect(uint32 code, uint32 reset, uint32 count) { ...@@ -1899,11 +1899,13 @@ int32 card::replace_effect(uint32 code, uint32 reset, uint32 count) {
read_card(code, &cdata); read_card(code, &cdata);
if(cdata.type & TYPE_NORMAL) if(cdata.type & TYPE_NORMAL)
return -1; return -1;
if(is_status(STATUS_EFFECT_REPLACED))
set_status(STATUS_EFFECT_REPLACED, FALSE);
for(auto i = indexer.begin(); i != indexer.end();) { for(auto i = indexer.begin(); i != indexer.end();) {
auto rm = i++; auto rm = i++;
effect* peffect = rm->first; effect* peffect = rm->first;
auto it = rm->second; auto it = rm->second;
if(peffect->is_flag(EFFECT_FLAG_INITIAL | EFFECT_FLAG_COPY_INHERIT)) if (peffect->is_flag(EFFECT_FLAG_INITIAL | EFFECT_FLAG_COPY_INHERIT))
remove_effect(peffect, it); remove_effect(peffect, it);
} }
uint32 cr = pduel->game_field->core.copy_reset; uint32 cr = pduel->game_field->core.copy_reset;
......
...@@ -1225,6 +1225,9 @@ void field::remove_oath_effect(effect* reason_effect) { ...@@ -1225,6 +1225,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