Some minor changes to cards and framework classes.

This commit is contained in:
LevelX2 2014-12-16 18:01:56 +01:00
parent 1141e4c2fa
commit a12fa6e3a1
7 changed files with 113 additions and 52 deletions

View file

@ -29,23 +29,18 @@ package mage.sets.morningtide;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.keyword.ChampionAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*

View file

@ -41,6 +41,7 @@ import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
@ -75,10 +76,19 @@ public class SwordOfWarAndPeace extends CardImpl {
super(ownerId, 161, "Sword of War and Peace", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "NPH";
this.subtype.add("Equipment");
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new ProtectionAbility(filter), AttachmentType.EQUIPMENT)));
// Equipped creature gets +2/+2 and has protection from red and from white.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2));
Effect effect = new GainAbilityAttachedEffect(new ProtectionAbility(filter), AttachmentType.EQUIPMENT);
effect.setText("and has protection from red and from white");
ability.addEffect(effect);
this.addAbility(ability);
// Whenever equipped creature deals combat damage to a player, Sword of War and Peace deals damage to that player equal to the number of cards in his or her hand and you gain 1 life for each card in your hand.
this.addAbility(new SwordOfWarAndPeaceAbility());
// Equip {2}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
}
public SwordOfWarAndPeace (final SwordOfWarAndPeace card) {

View file

@ -29,17 +29,11 @@ package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.LookLibraryTopCardTargetPlayerEffect;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
/**
@ -59,7 +53,7 @@ public class MerfolkObserver extends CardImpl {
this.toughness = new MageInt(1);
// When Merfolk Observer enters the battlefield, look at the top card of target player's library.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new MerfolkObserverEffect());
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new LookLibraryTopCardTargetPlayerEffect());
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
@ -73,36 +67,3 @@ public class MerfolkObserver extends CardImpl {
return new MerfolkObserver(this);
}
}
class MerfolkObserverEffect extends OneShotEffect {
public MerfolkObserverEffect() {
super(Outcome.Benefit);
this.staticText = "look at the top card of target player's library";
}
public MerfolkObserverEffect(final MerfolkObserverEffect effect) {
super(effect);
}
@Override
public MerfolkObserverEffect copy() {
return new MerfolkObserverEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (player != null && targetPlayer != null) {
Card card = targetPlayer.getLibrary().getFromTop(game);
if (card != null) {
CardsImpl cards = new CardsImpl();
cards.add(card);
player.lookAtCards("Merfolk Observer", cards, game);
}
return true;
}
return false;
}
}

View file

@ -107,4 +107,10 @@ class MoreCardsInHandThanOpponentsCondition implements Condition {
}
return true;
}
@Override
public String toString() {
return "you have more cards in hand than each opponent";
}
}