multiple changes:

* refactor: improved target pointer init code and logic, added docs and runtime checks;
* game: fixed miss or wrong init calls in some continuous effects;
* game: fixed wrong usage of target pointers (miss copy code, miss npe checks);
This commit is contained in:
Oleg Agafonov 2024-02-18 15:05:05 +04:00
parent b2aa4ecc08
commit 78612ddc91
115 changed files with 466 additions and 355 deletions

View file

@ -4,6 +4,7 @@ package mage.abilities.effects;
import mage.constants.EffectType;
import mage.constants.Outcome;
import mage.target.targetpointer.TargetPointer;
/**
* @author BetaSteward_at_googlemail.com
@ -15,6 +16,12 @@ public abstract class OneShotEffect extends EffectImpl {
this.effectType = EffectType.ONESHOT;
}
@Override
public final void initNewTargetPointer() {
// one short effects don't use init logic
this.targetPointer.setInitialized();
}
protected OneShotEffect(final OneShotEffect effect) {
super(effect);
}
@ -24,4 +31,10 @@ public abstract class OneShotEffect extends EffectImpl {
super.setText(staticText);
return this;
}
@Override
public Effect setTargetPointer(TargetPointer targetPointer) {
super.setTargetPointer(targetPointer);
return this;
}
}