Skip to content

Commit

Permalink
refactor: cleanup unneeded method (closes #12547)
Browse files Browse the repository at this point in the history
  • Loading branch information
xenohedron committed Aug 15, 2024
1 parent f1bf8a7 commit 7969ffb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 40 deletions.
28 changes: 6 additions & 22 deletions Mage.Sets/src/mage/cards/g/GiantOyster.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public GiantOyster(UUID ownerId, CardSetInfo setInfo) {
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);
Expand All @@ -67,26 +69,9 @@ public GiantOyster copy() {
}
}

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.";
}
Expand All @@ -105,13 +90,12 @@ public boolean apply(Game game, Ability source) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -57,13 +53,4 @@ public TargetPointer withData(String key, String value) {
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;
}
}

0 comments on commit 7969ffb

Please sign in to comment.