Fluorohydride / ygopro-core

ygopro script engine.
MIT License
327 stars 134 forks source link

delete card target on RESET_COPY & remove EFFECT_FLAG_COPY_INHERIT #644

Closed salix5 closed 3 days ago

salix5 commented 1 week ago

delete card target on RESET_COPY

https://ocg-rule.readthedocs.io/zh-cn/latest/c06/2020.html#id178

得到了「No.45 灭亡之预言者」卡名·效果的「混沌超量 冀望皇 异晶人」以1张表侧表示的卡为对象发动了得到的「No.45 灭亡之预言者」的①效果后,因「技能抽取」的效果而被无效的场合,仍然和作为对象的卡持续取对象。

https://ocg-rule.readthedocs.io/zh-cn/latest/c06/2022.html#id221

「混沌超量 冀望皇 异晶人」发动②效果,得到了「No.45 灭亡之预言者」的卡名·效果后,发动得到的「No.45 灭亡之预言者」的①效果并适用的状况,对方回合结束后,虽然「混沌超量 冀望皇 异晶人」失去了「No.45 灭亡之预言者」的卡名·效果,但是只要「混沌超量 冀望皇 异晶人」表侧表示在场上,『这只怪兽表侧表示存在期间,作为对象的表侧表示的卡的效果无效化』效果仍然适用。此外,「No.45 灭亡之预言者」的②效果是永续效果,失去「No.45 灭亡之预言者」的卡名·效果后不再适用。

https://ocg-rule.readthedocs.io/zh-cn/latest/c06/2024.html#id97

裁定变更: 「混沌超量 冀望皇 异晶人」发动②效果,得到了「No.45 灭亡之预言者」「No.106 巨岩掌 巨手」的卡名·效果后,发动得到的「No.45 灭亡之预言者」「No.106 巨岩掌 巨手」的①效果并适用的状况,对方回合结束后,「混沌超量 冀望皇 异晶人」失去了「No.45 灭亡之预言者」「No.106 巨岩掌 巨手」的卡名·效果,即使这只「混沌超量 冀望皇 异晶人」表侧表示在场上,得到的「No.45 灭亡之预言者」「No.106 巨岩掌 巨手」的①效果不再适用。

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 like erase. 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