Skip to content

Commit

Permalink
revert: X can gain an effect from itself (#665)
Browse files Browse the repository at this point in the history
* revert: X can gain an effect from itself

* reject EFFECT_UNIQUE_CHECK in adjust_grant_effect
  • Loading branch information
salix5 authored Nov 20, 2024
1 parent e090c4f commit 87a3541
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,7 @@ effect_indexer::iterator card::remove_effect(effect* peffect) {
pduel->game_field->update_disable_check_list(peffect);
}
field_effect.erase(it);
pduel->game_field->remove_effect(peffect);
}
if ((current.controler != PLAYER_NONE) && !get_status(STATUS_DISABLED | STATUS_FORBIDDEN) && !check_target.empty()) {
if (peffect->is_disable_related()) {
Expand Down Expand Up @@ -2002,7 +2003,6 @@ effect_indexer::iterator card::remove_effect(effect* peffect) {
unique_pos[0] = unique_pos[1] = 0;
unique_code = 0;
}
pduel->game_field->remove_effect(peffect);
pduel->game_field->core.reseted_effects.insert(peffect);
return ret;
}
Expand Down
5 changes: 2 additions & 3 deletions field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,8 @@ int32 field::adjust_grant_effect() {
effect* geffect = (effect*)peffect->get_label_object();
if (geffect->type & EFFECT_TYPE_GRANT)
continue;
if (geffect->code == EFFECT_UNIQUE_CHECK)
continue;
card_set cset;
if(peffect->is_available())
filter_affected_cards(peffect, &cset);
Expand All @@ -2138,9 +2140,6 @@ int32 field::adjust_grant_effect() {
if(!pcard->is_affect_by_effect(peffect) || !cset.count(pcard))
remove_set.insert(pcard);
}
//X gains an effect from itself will break card::remove_effect
if (!peffect->is_flag(EFFECT_FLAG_FIELD_ONLY))
add_set.erase(peffect->handler);
for(auto& pcard : add_set) {
effect* ceffect = geffect->clone();
ceffect->owner = pcard;
Expand Down

0 comments on commit 87a3541

Please sign in to comment.