From c233ca57d8ce1b60483566dc2c0084045eab61d1 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 24 Sep 2020 19:59:31 -0400 Subject: [PATCH] removed a few TODOs --- Mage.Sets/src/mage/cards/c/CrownOfDoom.java | 12 ++--- Mage.Sets/src/mage/cards/m/MartyrOfBones.java | 1 - .../src/mage/cards/s/SeafloorStalker.java | 48 +++++-------------- 3 files changed, 16 insertions(+), 45 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CrownOfDoom.java b/Mage.Sets/src/mage/cards/c/CrownOfDoom.java index 47fe3f8071..0da09e5055 100644 --- a/Mage.Sets/src/mage/cards/c/CrownOfDoom.java +++ b/Mage.Sets/src/mage/cards/c/CrownOfDoom.java @@ -35,7 +35,7 @@ public final class CrownOfDoom extends CardImpl { private static final FilterPlayer filter = new FilterPlayer("player other than {this}'s owner"); static { - filter.add(new CrownOfDoomPredicate()); + filter.add(CrownOfDoomPredicate.instance); } public CrownOfDoom(UUID ownerId, CardSetInfo setInfo) { @@ -51,13 +51,11 @@ public final class CrownOfDoom extends CardImpl { SetTargetPointer.PERMANENT, true)); - //TODO: Make ability properly copiable - // {2}: Target player other than Crown of Doom's owner gains control of it. Activate this ability only during your turn. Ability ability = new ActivateIfConditionActivatedAbility( Zone.BATTLEFIELD, new CrownOfDoomEffect(), - new ManaCostsImpl("{2}"), + new ManaCostsImpl<>("{2}"), MyTurnCondition.instance); ability.addTarget(new TargetPlayer(1, 1, false, filter)); ability.addHint(MyTurnHint.instance); @@ -74,10 +72,8 @@ public final class CrownOfDoom extends CardImpl { } } -class CrownOfDoomPredicate implements ObjectSourcePlayerPredicate> { - - public CrownOfDoomPredicate() { - } +enum CrownOfDoomPredicate implements ObjectSourcePlayerPredicate> { + instance; @Override public boolean apply(ObjectSourcePlayer input, Game game) { diff --git a/Mage.Sets/src/mage/cards/m/MartyrOfBones.java b/Mage.Sets/src/mage/cards/m/MartyrOfBones.java index dd47c908df..554472fd15 100644 --- a/Mage.Sets/src/mage/cards/m/MartyrOfBones.java +++ b/Mage.Sets/src/mage/cards/m/MartyrOfBones.java @@ -40,7 +40,6 @@ public final class MartyrOfBones extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - // TODO: Make ability properly copiable // {1}, Reveal X black cards from your hand, Sacrifice Martyr of Bones: Exile up to X target cards from a single graveyard. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(), new GenericManaCost(1)); ability.addCost(new RevealVariableBlackCardsFromHandCost()); diff --git a/Mage.Sets/src/mage/cards/s/SeafloorStalker.java b/Mage.Sets/src/mage/cards/s/SeafloorStalker.java index e565b1224c..443d5889fb 100644 --- a/Mage.Sets/src/mage/cards/s/SeafloorStalker.java +++ b/Mage.Sets/src/mage/cards/s/SeafloorStalker.java @@ -3,17 +3,18 @@ package mage.cards.s; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.CostAdjuster; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.common.PartyCount; import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.hint.common.PartyCountHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; @@ -34,7 +35,6 @@ public final class SeafloorStalker extends CardImpl { this.toughness = new MageInt(3); // {4}{U}: Seafloor Stalker gets +1/+0 until end of turn and can't be blocked this turn. This ability costs {1} less to activate for each creature in your party. - // TODO: Make ability properly copiable Ability ability = new SimpleActivatedAbility( new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl<>("{4}{U}") ); @@ -42,10 +42,8 @@ public final class SeafloorStalker extends CardImpl { ability.addEffect(new InfoEffect( "This ability costs {1} less to activate for each creature in your party. " + PartyCount.getReminder() )); - this.addAbility(ability); - this.addAbility(new SimpleStaticAbility( - Zone.ALL, new SeafloorStalkerCostIncreasingEffect(ability.getOriginalId()) - ).addHint(PartyCountHint.instance)); + ability.setCostAdjuster(SeafloorStalkerAdjuster.instance); + this.addAbility(ability.addHint(PartyCountHint.instance)); } private SeafloorStalker(final SeafloorStalker card) { @@ -58,37 +56,15 @@ public final class SeafloorStalker extends CardImpl { } } -class SeafloorStalkerCostIncreasingEffect extends CostModificationEffectImpl { - - private final UUID originalId; - - SeafloorStalkerCostIncreasingEffect(UUID originalId) { - super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.REDUCE_COST); - this.originalId = originalId; - } - - private SeafloorStalkerCostIncreasingEffect(final SeafloorStalkerCostIncreasingEffect effect) { - super(effect); - this.originalId = effect.originalId; - } +enum SeafloorStalkerAdjuster implements CostAdjuster { + instance; @Override - public boolean apply(Game game, Ability source, Ability abilityToModify) { - Player controller = game.getPlayer(source.getControllerId()); + public void adjustCosts(Ability ability, Game game) { + Player controller = game.getPlayer(ability.getControllerId()); if (controller != null) { - int count = PartyCount.instance.calculate(game, source, this); - CardUtil.reduceCost(abilityToModify, count); + int count = PartyCount.instance.calculate(game, ability, null); + CardUtil.reduceCost(ability, count); } - return true; - } - - @Override - public boolean applies(Ability abilityToModify, Ability source, Game game) { - return abilityToModify.getOriginalId().equals(originalId); - } - - @Override - public SeafloorStalkerCostIncreasingEffect copy() { - return new SeafloorStalkerCostIncreasingEffect(this); } }