minor refactoring

This commit is contained in:
North 2011-10-05 23:34:10 +03:00
parent a04b7d2abe
commit 20d8fa2f10
8 changed files with 19 additions and 55 deletions

View file

@ -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;

View file

@ -116,6 +116,7 @@ class CharmbreakerDevilsEffect extends OneShotEffect<CharmbreakerDevilsEffect> {
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;
}
}

View file

@ -101,6 +101,7 @@ class GhoulraiserEffect extends OneShotEffect<GhoulraiserEffect> {
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;
}
}

View file

@ -45,7 +45,7 @@ import java.util.UUID;
*/
public class HollowhengeScavenger extends CardImpl<HollowhengeScavenger> {
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}");

View file

@ -92,6 +92,7 @@ class MakeAWishEffect extends OneShotEffect<MakeAWishEffect> {
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;

View file

@ -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<MorkrutBanshee> {
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<MorkrutBanshee> {
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<MorkrutBanshee> {
return new MorkrutBanshee(this);
}
}
class MorkrutBansheeAbility extends TriggeredAbilityImpl<MorkrutBansheeAbility> {
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.";
}
}

View file

@ -87,15 +87,12 @@ class HeroOfBladeholdEffect extends OneShotEffect<HeroOfBladeholdEffect> {
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;
}

View file

@ -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<BasicManaEffect> {
protected Mana mana;