Commit 7646ecfa authored by salix5's avatar salix5

card::filter_disable_related_cards()

1. Now it will check the continuous target of EFFECT_FLAG_OWNER_RELATE.
2. Remove effects.disable_check_list.
parent f95d9084
...@@ -2427,8 +2427,10 @@ void card::filter_immune_effect() { ...@@ -2427,8 +2427,10 @@ void card::filter_immune_effect() {
immune_effect.sort(); immune_effect.sort();
} }
// for all disable-related peffect of this, // for all disable-related peffect of this,
// 1. put all cards in the target of peffect into effects.disable_check_set, effects.disable_check_list // 1. Insert all cards in the target of peffect into effects.disable_check_set.
// 2. add equiping_target of peffect into effects.disable_check_set, effects.disable_check_list // 2. Insert equiping_target of peffect into it.
// 3. Insert overlay_target of peffect into it.
// 4. Insert continuous target of this into it.
void card::filter_disable_related_cards() { void card::filter_disable_related_cards() {
for (auto& it : indexer) { for (auto& it : indexer) {
effect* peffect = it.first; effect* peffect = it.first;
...@@ -2441,6 +2443,15 @@ void card::filter_disable_related_cards() { ...@@ -2441,6 +2443,15 @@ void card::filter_disable_related_cards() {
pduel->game_field->add_to_disable_check_list(overlay_target); pduel->game_field->add_to_disable_check_list(overlay_target);
} }
} }
for(auto pcard : effect_target_cards) {
for(auto it = pcard->single_effect.begin(); it != pcard->single_effect.end(); ++it) {
effect* peffect = it->second;
if(peffect->is_disable_related() && peffect->is_flag(EFFECT_FLAG_OWNER_RELATE)){
pduel->game_field->add_to_disable_check_list(pcard);
break;
}
}
}
} }
// put all summon procedures except ordinay summon in peset (see is_can_be_summoned()) // put all summon procedures except ordinay summon in peset (see is_can_be_summoned())
// return value: // return value:
......
...@@ -1869,7 +1869,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) { ...@@ -1869,7 +1869,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) {
} }
return count; return count;
} }
// put all cards in the target of peffect into effects.disable_check_set, effects.disable_check_list // put all cards in the target of peffect into effects.disable_check_set
void field::update_disable_check_list(effect* peffect) { void field::update_disable_check_list(effect* peffect) {
card_set cset; card_set cset;
filter_affected_cards(peffect, &cset); filter_affected_cards(peffect, &cset);
...@@ -1877,22 +1877,18 @@ void field::update_disable_check_list(effect* peffect) { ...@@ -1877,22 +1877,18 @@ void field::update_disable_check_list(effect* peffect) {
add_to_disable_check_list(pcard); add_to_disable_check_list(pcard);
} }
void field::add_to_disable_check_list(card* pcard) { void field::add_to_disable_check_list(card* pcard) {
if (effects.disable_check_set.find(pcard) != effects.disable_check_set.end())
return;
effects.disable_check_set.insert(pcard); effects.disable_check_set.insert(pcard);
effects.disable_check_list.push_back(pcard);
} }
void field::adjust_disable_check_list() { void field::adjust_disable_check_list() {
card* checking; card* checking;
int32 pre_disable, new_disable; int32 pre_disable, new_disable;
if (!effects.disable_check_list.size()) if (!effects.disable_check_set.size())
return; return;
card_set checked; card_set checked;
do { do {
checked.clear(); checked.clear();
while (effects.disable_check_list.size()) { while (effects.disable_check_set.size()) {
checking = effects.disable_check_list.front(); checking = *(effects.disable_check_set.begin());
effects.disable_check_list.pop_front();
effects.disable_check_set.erase(checking); effects.disable_check_set.erase(checking);
checked.insert(checking); checked.insert(checking);
if (checking->is_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE)) if (checking->is_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE))
...@@ -1913,7 +1909,7 @@ void field::adjust_disable_check_list() { ...@@ -1913,7 +1909,7 @@ void field::adjust_disable_check_list() {
pcard->reset(RESET_DISABLE, RESET_EVENT); pcard->reset(RESET_DISABLE, RESET_EVENT);
pcard->set_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE, FALSE); pcard->set_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE, FALSE);
} }
} while(effects.disable_check_list.size()); } while(effects.disable_check_set.size());
} }
// adjust SetUniqueOnField(), EFFECT_SELF_DESTROY, EFFECT_SELF_TOGRAVE // adjust SetUniqueOnField(), EFFECT_SELF_DESTROY, EFFECT_SELF_TOGRAVE
void field::adjust_self_destroy_set() { void field::adjust_self_destroy_set() {
......
...@@ -110,7 +110,6 @@ struct field_effect { ...@@ -110,7 +110,6 @@ struct field_effect {
effect_collection rechargeable; effect_collection rechargeable;
effect_collection spsummon_count_eff; effect_collection spsummon_count_eff;
std::list<card*> disable_check_list;
std::unordered_set<card*> disable_check_set; std::unordered_set<card*> disable_check_set;
grant_effect_container grant_effect; grant_effect_container grant_effect;
......
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