From 20d8fa2f10dc5f96a12aa32b5178e3b9b60416d5 Mon Sep 17 00:00:00 2001 From: North Date: Wed, 5 Oct 2011 23:34:10 +0300 Subject: [PATCH] minor refactoring --- .../sets/dissension/HallowedFountain.java | 2 - .../sets/innistrad/CharmbreakerDevils.java | 1 + .../src/mage/sets/innistrad/Ghoulraiser.java | 1 + .../sets/innistrad/HollowhengeScavenger.java | 2 +- .../src/mage/sets/innistrad/MakeAWish.java | 1 + .../mage/sets/innistrad/MorkrutBanshee.java | 51 ++++--------------- .../mirrodinbesieged/HeroOfBladehold.java | 15 +++--- .../effects/common/BasicManaEffect.java | 1 - 8 files changed, 19 insertions(+), 55 deletions(-) diff --git a/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java b/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java index bbdffe8814..66baa3668e 100644 --- a/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java +++ b/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java @@ -30,9 +30,7 @@ package mage.sets.dissension; import java.util.UUID; import mage.Constants.CardType; -import mage.Constants.Duration; import mage.Constants.Rarity; -import mage.Constants.Zone; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; diff --git a/Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java b/Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java index 6a641ea6b3..5a135dda7a 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java +++ b/Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java @@ -116,6 +116,7 @@ class CharmbreakerDevilsEffect extends OneShotEffect { Random rnd = new Random(); Card card = cards[rnd.nextInt(cards.length)]; card.moveToZone(Zone.HAND, source.getId(), game, true); + game.informPlayers(card.getName() + "returned to the hand of" + player.getName()); return true; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java b/Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java index 3f6a27e179..1b2f380b57 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java +++ b/Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java @@ -101,6 +101,7 @@ class GhoulraiserEffect extends OneShotEffect { Random rnd = new Random(); Card card = cards[rnd.nextInt(cards.length)]; card.moveToZone(Zone.HAND, source.getId(), game, true); + game.informPlayers(card.getName() + "returned to the hand of" + player.getName()); return true; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/HollowhengeScavenger.java b/Mage.Sets/src/mage/sets/innistrad/HollowhengeScavenger.java index 5cbc9a1116..d94a5101b3 100644 --- a/Mage.Sets/src/mage/sets/innistrad/HollowhengeScavenger.java +++ b/Mage.Sets/src/mage/sets/innistrad/HollowhengeScavenger.java @@ -45,7 +45,7 @@ import java.util.UUID; */ public class HollowhengeScavenger extends CardImpl { - private final static String staticText = "Morbid - When Hollowhenge Scavenger enters the battlefield, if a creature died this turn, you gain 5 life."; + private final static String staticText = "Morbid - When {this} enters the battlefield, if a creature died this turn, you gain 5 life."; public HollowhengeScavenger(UUID ownerId) { super(ownerId, 188, "Hollowhenge Scavenger", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); diff --git a/Mage.Sets/src/mage/sets/innistrad/MakeAWish.java b/Mage.Sets/src/mage/sets/innistrad/MakeAWish.java index 21eb84501f..1977f0b5cc 100644 --- a/Mage.Sets/src/mage/sets/innistrad/MakeAWish.java +++ b/Mage.Sets/src/mage/sets/innistrad/MakeAWish.java @@ -92,6 +92,7 @@ class MakeAWishEffect extends OneShotEffect { if (card != null) { card.moveToZone(Zone.HAND, source.getId(), game, true); cards.remove(card); + game.informPlayers(card.getName() + "returned to the hand of" + player.getName()); } } return true; diff --git a/Mage.Sets/src/mage/sets/innistrad/MorkrutBanshee.java b/Mage.Sets/src/mage/sets/innistrad/MorkrutBanshee.java index 9944f2b41f..940c39664c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/MorkrutBanshee.java +++ b/Mage.Sets/src/mage/sets/innistrad/MorkrutBanshee.java @@ -27,27 +27,27 @@ */ package mage.sets.innistrad; -import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continious.BoostTargetEffect; import mage.cards.CardImpl; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeEvent; import mage.target.common.TargetCreaturePermanent; -import mage.watchers.Watcher; import java.util.UUID; +import mage.Constants.Duration; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.MorbidCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; /** * @author nantuko */ public class MorkrutBanshee extends CardImpl { + private final static String staticText = "Morbid - When {this} enters the battlefield, if a creature died this turn, target creature gets -4/-4 until end of turn."; + public MorkrutBanshee(UUID ownerId) { super(ownerId, 110, "Morkrut Banshee", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}{B}"); this.expansionSetCode = "ISD"; @@ -58,7 +58,8 @@ public class MorkrutBanshee extends CardImpl { this.toughness = new MageInt(4); // Morbid - When Morkut Banshee enters the battlefield, if a creature died this turn, target creature gets -4/-4 until end of turn. - Ability ability = new MorkrutBansheeAbility(); + TriggeredAbility triggeredAbility = new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(-4, -4, Duration.EndOfTurn)); + TriggeredAbility ability = new ConditionalTriggeredAbility(triggeredAbility, MorbidCondition.getInstance(), staticText); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } @@ -72,37 +73,3 @@ public class MorkrutBanshee extends CardImpl { return new MorkrutBanshee(this); } } - -class MorkrutBansheeAbility extends TriggeredAbilityImpl { - - public MorkrutBansheeAbility() { - super(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(-4, -4, Constants.Duration.EndOfTurn), false); - } - - public MorkrutBansheeAbility(final MorkrutBansheeAbility ability) { - super(ability); - } - - @Override - public MorkrutBansheeAbility copy() { - return new MorkrutBansheeAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getToZone().equals(Constants.Zone.BATTLEFIELD)) { - Watcher watcher = game.getState().getWatchers().get(controllerId, "Morbid"); - return watcher.conditionMet(); - } - } - return false; - - } - - @Override - public String getRule() { - return "Morbid - When Morkut Banshee enters the battlefield, if a creature died this turn, target creature gets -4/-4 until end of turn."; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/HeroOfBladehold.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/HeroOfBladehold.java index 6689195cb0..88fcee0873 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/HeroOfBladehold.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/HeroOfBladehold.java @@ -87,15 +87,12 @@ class HeroOfBladeholdEffect extends OneShotEffect { SoldierToken token = new SoldierToken(); Player player = game.getPlayer(source.getControllerId()); if (player != null) { - token.putOntoBattlefield(1, game, source.getId(), source.getControllerId()); - Permanent p = game.getPermanent(token.getLastAddedToken()); - game.getCombat().declareAttacker(p.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game); - p.setTapped(true); - - token.putOntoBattlefield(1, game, source.getId(), source.getControllerId()); - p = game.getPermanent(token.getLastAddedToken()); - game.getCombat().declareAttacker(p.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game); - p.setTapped(true); + for (int i = 0; i < 2; i++) { + token.putOntoBattlefield(1, game, source.getId(), source.getControllerId()); + Permanent p = game.getPermanent(token.getLastAddedToken()); + game.getCombat().declareAttacker(p.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game); + p.setTapped(true); + } } return true; } diff --git a/Mage/src/mage/abilities/effects/common/BasicManaEffect.java b/Mage/src/mage/abilities/effects/common/BasicManaEffect.java index d8374f132c..7948387472 100644 --- a/Mage/src/mage/abilities/effects/common/BasicManaEffect.java +++ b/Mage/src/mage/abilities/effects/common/BasicManaEffect.java @@ -4,7 +4,6 @@ import mage.ConditionalMana; import mage.Mana; import mage.abilities.Ability; import mage.game.Game; -import mage.game.events.GameEvent; public class BasicManaEffect extends ManaEffect { protected Mana mana;