refactor: fixed miss copy effect (related to #12605)

This commit is contained in:
Oleg Agafonov 2024-08-15 09:00:27 +04:00
parent 7969ffb548
commit e7585e8d95
2 changed files with 6 additions and 6 deletions

View file

@ -1,5 +1,3 @@
package mage.abilities.effects; package mage.abilities.effects;
import mage.constants.EffectType; import mage.constants.EffectType;
@ -37,4 +35,7 @@ public abstract class OneShotEffect extends EffectImpl {
super.setTargetPointer(targetPointer); super.setTargetPointer(targetPointer);
return this; return this;
} }
@Override
abstract public OneShotEffect copy();
} }

View file

@ -2,7 +2,6 @@ package mage.abilities.effects.common;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -44,7 +43,7 @@ public class ExileThenReturnTargetEffect extends OneShotEffect {
this.putCards = effect.putCards; this.putCards = effect.putCards;
this.yourControl = effect.yourControl; this.yourControl = effect.yourControl;
this.textThatCard = effect.textThatCard; this.textThatCard = effect.textThatCard;
this.afterEffect = effect.afterEffect; this.afterEffect = effect.afterEffect == null ? null : effect.afterEffect.copy();
} }
@Override @Override
@ -78,7 +77,7 @@ public class ExileThenReturnTargetEffect extends OneShotEffect {
yourControl ? controller : game.getPlayer(card.getOwnerId()), yourControl ? controller : game.getPlayer(card.getOwnerId()),
card.getMainCard(), source, game, "card"); card.getMainCard(), source, game, "card");
} }
if (afterEffect != null){ if (afterEffect != null) {
afterEffect.setTargetPointer(new FixedTargets(toFlicker, game)); afterEffect.setTargetPointer(new FixedTargets(toFlicker, game));
afterEffect.apply(game, source); afterEffect.apply(game, source);
} }
@ -105,7 +104,7 @@ public class ExileThenReturnTargetEffect extends OneShotEffect {
sb.append(this.yourControl ? "your" : "its owner's"); sb.append(this.yourControl ? "your" : "its owner's");
} }
sb.append(" control"); sb.append(" control");
if (afterEffect != null){ if (afterEffect != null) {
sb.append(". ").append(CardUtil.getTextWithFirstCharUpperCase(afterEffect.getText(mode))); sb.append(". ").append(CardUtil.getTextWithFirstCharUpperCase(afterEffect.getText(mode)));
} }
return sb.toString(); return sb.toString();