From 89542ccb676e1ff01d6d4381e68c23c31463158c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 4 Nov 2017 16:22:10 +0100 Subject: [PATCH] * Removed unused code. --- Mage.Sets/src/mage/cards/e/ElkinLair.java | 14 +++++-------- Mage.Sets/src/mage/cards/n/Norritt.java | 9 +++++---- .../src/mage/cards/s/SeasonOfTheWitch.java | 20 +++++++++---------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/ElkinLair.java b/Mage.Sets/src/mage/cards/e/ElkinLair.java index fae0b6fb47f..861992f6394 100644 --- a/Mage.Sets/src/mage/cards/e/ElkinLair.java +++ b/Mage.Sets/src/mage/cards/e/ElkinLair.java @@ -51,17 +51,16 @@ import mage.game.permanent.Permanent; import mage.filter.FilterCard; import mage.players.Player; import mage.target.targetpointer.FixedTarget; -import mage.util.CardUtil; import mage.util.RandomUtil; /** - * + * * @author L_J */ public class ElkinLair extends CardImpl { public ElkinLair(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); addSuperType(SuperType.WORLD); // At the beginning of each player's upkeep, that player exiles a card at random from his or her hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, he or she puts it into his or her graveyard. @@ -111,11 +110,9 @@ class ElkinLairUpkeepEffect extends OneShotEffect { ContinuousEffect effect = new ElkinLairPlayExiledEffect(Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); game.addEffect(effect, source); - + DelayedTriggeredAbility delayed = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ElkinLairPutIntoGraveyardEffect()); game.addDelayedTriggeredAbility(delayed, source); - - } } return true; @@ -150,8 +147,8 @@ class ElkinLairPlayExiledEffect extends AsThoughEffectImpl { public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { Card card = game.getCard(objectId); if (card != null - && affectedControllerId.equals(card.getOwnerId()) - && game.getState().getZone(card.getId()) == Zone.EXILED) { + && affectedControllerId.equals(card.getOwnerId()) + && game.getState().getZone(card.getId()) == Zone.EXILED) { return true; } return false; @@ -173,7 +170,6 @@ class ElkinLairPutIntoGraveyardEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(game.getActivePlayerId()); if (player != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), 0); Set cardsInExile = game.getExile().getExileZone(source.getSourceId()).getCards(game); if (cardsInExile != null) { player.moveCardsToGraveyardWithInfo(cardsInExile, source, game, Zone.EXILED); diff --git a/Mage.Sets/src/mage/cards/n/Norritt.java b/Mage.Sets/src/mage/cards/n/Norritt.java index c69b56528f8..3d1b0efecfe 100644 --- a/Mage.Sets/src/mage/cards/n/Norritt.java +++ b/Mage.Sets/src/mage/cards/n/Norritt.java @@ -34,8 +34,8 @@ import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.condition.InvertCondition; -import mage.abilities.condition.common.TargetAttackedThisTurnCondition; import mage.abilities.condition.common.BeforeAttackersAreDeclaredCondition; +import mage.abilities.condition.common.TargetAttackedThisTurnCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalActivatedAbility; import mage.abilities.effects.OneShotEffect; @@ -52,7 +52,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.ControlledFromStartOfControllerTurnPredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; -import mage.players.Player; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; import mage.watchers.common.AttackedThisTurnWatcher; @@ -62,13 +61,15 @@ import mage.watchers.common.AttackedThisTurnWatcher; * @author MTGfan & L_J */ public class Norritt extends CardImpl { - + private static final FilterCreaturePermanent filterBlue = new FilterCreaturePermanent("blue creature"); + static { filterBlue.add(new ColorPredicate(ObjectColor.BLUE)); } private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("non-Wall creature"); + static { filterCreature.add(Predicates.not(new SubtypePredicate(SubType.WALL))); filterCreature.add(new ControlledFromStartOfControllerTurnPredicate()); @@ -90,7 +91,7 @@ public class Norritt extends CardImpl { // {T}: Choose target non-Wall creature the active player has controlled continuously since the beginning of the turn. That creature attacks this turn if able. If it doesn't, destroy it at the beginning of the next end step. Activate this ability only before attackers are declared. Ability ability2 = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new AttacksIfAbleTargetEffect(Duration.EndOfTurn), - new TapSourceCost(), BeforeAttackersAreDeclaredCondition.instance, + new TapSourceCost(), BeforeAttackersAreDeclaredCondition.instance, "{T}: Choose target non-Wall creature the active player has controlled continuously since the beginning of the turn. " + "That creature attacks this turn if able. If it doesn't, destroy it at the beginning of the next end step. " + "Activate this ability only before attackers are declared."); diff --git a/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java b/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java index ed6be2da1e6..e2bc1e7c4f6 100644 --- a/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java +++ b/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java @@ -41,15 +41,13 @@ import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.Outcome; -import mage.constants.WatcherScope; import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.WatcherScope; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; -import mage.filter.StaticFilters; import mage.players.Player; import mage.watchers.Watcher; import mage.watchers.common.AttackedThisTurnWatcher; @@ -116,14 +114,14 @@ class SeasonOfTheWitchEffect extends OneShotEffect { } // Creatures that attacked are safe. AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName()); - if (watcher != null - && watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game)) ) { + if (watcher != null + && watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) { continue; } // Creatures that couldn't attack are safe. CouldAttackThisTurnWatcher watcher2 = (CouldAttackThisTurnWatcher) game.getState().getWatchers().get(CouldAttackThisTurnWatcher.class.getSimpleName()); - if (watcher2 != null - && !watcher2.getCouldAttackThisTurnCreatures().contains(new MageObjectReference(permanent, game)) ) { + if (watcher2 != null + && !watcher2.getCouldAttackThisTurnCreatures().contains(new MageObjectReference(permanent, game))) { continue; } // Destroy the rest. @@ -156,11 +154,11 @@ class CouldAttackThisTurnWatcher extends Watcher { if (permanent.isCreature()) { for (UUID defender : game.getCombat().getDefenders()) { if (defender != activePlayer.getId()) { - if (permanent.canAttack(defender, game)) { + if (permanent.canAttack(defender, game)) { // exclude Propaganda style effects - if (!game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects( + if (!game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects( GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, - defender, permanent.getId(), permanent.getControllerId()), game)) { + defender, permanent.getId(), permanent.getControllerId()), game)) { this.couldAttackThisTurnCreatures.add(new MageObjectReference(permanent.getId(), game)); break; }