refactor: cleanup unneeded method (closes #12547)

This commit is contained in:
xenohedron 2024-08-14 22:46:52 -04:00
parent f1bf8a7ebd
commit 7969ffb548
3 changed files with 6 additions and 40 deletions

View file

@ -51,7 +51,9 @@ public final class GiantOyster extends CardImpl {
this.addAbility(new SkipUntapOptionalAbility());
// {tap}: For as long as Giant Oyster remains tapped, target tapped creature doesn't untap during its controller's untap step, and at the beginning of each of your draw steps, put a -1/-1 counter on that creature. When Giant Oyster leaves the battlefield or becomes untapped, remove all -1/-1 counters from the creature.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GiantOysterDontUntapAsLongAsSourceTappedEffect(), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DontUntapAsLongAsSourceTappedEffect()
.setText("For as long as {this} remains tapped, target tapped creature doesn't untap during its controller's untap step"),
new TapSourceCost());
ability.addEffect(new GiantOysterCreateDelayedTriggerEffects());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
@ -67,26 +69,9 @@ public final class GiantOyster extends CardImpl {
}
}
class GiantOysterDontUntapAsLongAsSourceTappedEffect extends DontUntapAsLongAsSourceTappedEffect {
GiantOysterDontUntapAsLongAsSourceTappedEffect() {
super();
staticText = "For as long as {this} remains tapped, target tapped creature doesn't untap during its controller's untap step";
}
private GiantOysterDontUntapAsLongAsSourceTappedEffect(final GiantOysterDontUntapAsLongAsSourceTappedEffect effect) {
super(effect);
}
@Override
public GiantOysterDontUntapAsLongAsSourceTappedEffect copy() {
return new GiantOysterDontUntapAsLongAsSourceTappedEffect(this);
}
}
class GiantOysterCreateDelayedTriggerEffects extends OneShotEffect {
public GiantOysterCreateDelayedTriggerEffects() {
GiantOysterCreateDelayedTriggerEffects() {
super(Outcome.Detriment);
this.staticText = "at the beginning of each of your draw steps, put a -1/-1 counter on that creature. When {this} leaves the battlefield or becomes untapped, remove all -1/-1 counters from the creature.";
}
@ -105,13 +90,12 @@ class GiantOysterCreateDelayedTriggerEffects extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Permanent oyster = game.getPermanent(source.getSourceId());
Permanent tappedCreature = game.getPermanent(source.getFirstTarget());
FixedTarget fixedTarget = getTargetPointer().getFirstAsFixedTarget(game, source);
if (controller == null || oyster == null || tappedCreature == null || fixedTarget == null) {
if (controller == null || oyster == null || tappedCreature == null) {
return false;
}
Effect addCountersEffect = new AddCountersTargetEffect(CounterType.M1M1.createInstance(1));
addCountersEffect.setTargetPointer(fixedTarget);
addCountersEffect.setTargetPointer(new FixedTarget(tappedCreature, game));
DelayedTriggeredAbility drawStepAbility = new AtTheBeginOfYourNextDrawStepDelayedTriggeredAbility(addCountersEffect, Duration.Custom, false);
drawStepAbility.setControllerId(source.getControllerId());
UUID drawStepAbilityUUID = game.addDelayedTriggeredAbility(drawStepAbility, source);

View file

@ -32,11 +32,6 @@ public interface TargetPointer extends Serializable, Copyable<TargetPointer> {
*/
UUID getFirst(Game game, Ability source);
/**
* Return first actual target data (null on outdated targets)
*/
FixedTarget getFirstAsFixedTarget(Game game, Ability source);
TargetPointer copy();
/**

View file

@ -1,11 +1,7 @@
package mage.target.targetpointer;
import mage.abilities.Ability;
import mage.game.Game;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @author JayDi85
@ -57,13 +53,4 @@ public abstract class TargetPointerImpl implements TargetPointer {
return this;
}
@Override
public final FixedTarget getFirstAsFixedTarget(Game game, Ability source) {
UUID firstId = this.getFirst(game, source);
if (firstId != null) {
return new FixedTarget(firstId, game.getState().getZoneChangeCounter(firstId));
}
return null;
}
}