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()); 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. // {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.addEffect(new GiantOysterCreateDelayedTriggerEffects());
ability.addTarget(new TargetCreaturePermanent(filter)); ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability); 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 { class GiantOysterCreateDelayedTriggerEffects extends OneShotEffect {
public GiantOysterCreateDelayedTriggerEffects() { GiantOysterCreateDelayedTriggerEffects() {
super(Outcome.Detriment); 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."; 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()); Player controller = game.getPlayer(source.getControllerId());
Permanent oyster = game.getPermanent(source.getSourceId()); Permanent oyster = game.getPermanent(source.getSourceId());
Permanent tappedCreature = game.getPermanent(source.getFirstTarget()); Permanent tappedCreature = game.getPermanent(source.getFirstTarget());
FixedTarget fixedTarget = getTargetPointer().getFirstAsFixedTarget(game, source); if (controller == null || oyster == null || tappedCreature == null) {
if (controller == null || oyster == null || tappedCreature == null || fixedTarget == null) {
return false; return false;
} }
Effect addCountersEffect = new AddCountersTargetEffect(CounterType.M1M1.createInstance(1)); 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); DelayedTriggeredAbility drawStepAbility = new AtTheBeginOfYourNextDrawStepDelayedTriggeredAbility(addCountersEffect, Duration.Custom, false);
drawStepAbility.setControllerId(source.getControllerId()); drawStepAbility.setControllerId(source.getControllerId());
UUID drawStepAbilityUUID = game.addDelayedTriggeredAbility(drawStepAbility, source); 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); UUID getFirst(Game game, Ability source);
/**
* Return first actual target data (null on outdated targets)
*/
FixedTarget getFirstAsFixedTarget(Game game, Ability source);
TargetPointer copy(); TargetPointer copy();
/** /**

View file

@ -1,11 +1,7 @@
package mage.target.targetpointer; package mage.target.targetpointer;
import mage.abilities.Ability;
import mage.game.Game;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID;
/** /**
* @author JayDi85 * @author JayDi85
@ -57,13 +53,4 @@ public abstract class TargetPointerImpl implements TargetPointer {
return this; 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;
}
} }