delete card target on RESET_COPY & remove EFFECT_FLAG_COPY_INHERIT #644
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
delete card target on RESET_COPY
https://ocg-rule.readthedocs.io/zh-cn/latest/c06/2020.html#id178
https://ocg-rule.readthedocs.io/zh-cn/latest/c06/2022.html#id221
https://ocg-rule.readthedocs.io/zh-cn/latest/c06/2024.html#id97
2020: The card target is lost when the copied effects reset.
2022: The card target is not lost.
2024: The card target is lost.
Now it will delete card target on RESET_COPY.
remove EFFECT_FLAG_COPY_INHERIT
Now RESET_COPY will clear
effect_target_cards
.It it not used anymore.
effect_indexer::iterator remove_effect(effect* peffect)
Now
remove_effect
will return the next iterator, just likeerase
.We can use the standard way to remove from
effect_indexer
.fix field::add_effect
avoid duplicate entries like card::add_effect
reload script after removing all effects
If X gets 5 effects by
replace_effect
.Before:
It will reload the original effect when removing the first effect.
After:
It will reload the original effect after removing 5 effects.
fix field::adjust_grant_effect()
c1
e1: EFFECT_TYPE_GRANT
e2: EFFECT_TYPE_FIELD, gained from e1
e1 table
c1,e2
Call
c1->remove_effect(e1)
Call
pduel->game_field->remove_effect(e1)
e1 is EFFECT_TYPE_GRANT, call
erase_grant_effect(e1)
Call
c1->remove_effect(e2)
Call
pduel->game_field->remove_effect(e2)
It will erase 2 entries in
card::remove_effect()
, which breaks erasing while iteration.As a workaround, we do not allow c1 gains an effect from itself.
avoid nested EFFECT_TYPE_GRANT
...for the same reason
Reference
https://en.cppreference.com/w/cpp/container/set/erase_if
@mercury233
@purerosefallen