diff --git a/Mage.Sets/src/mage/sets/morningtide/UnstoppableAsh.java b/Mage.Sets/src/mage/sets/morningtide/UnstoppableAsh.java index 72d7ae4002..72b1097dba 100644 --- a/Mage.Sets/src/mage/sets/morningtide/UnstoppableAsh.java +++ b/Mage.Sets/src/mage/sets/morningtide/UnstoppableAsh.java @@ -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; /** * diff --git a/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java b/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java index 916322cc5a..5e117b2482 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java @@ -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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/MerfolkObserver.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MerfolkObserver.java index a975724228..cac4c81285 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/MerfolkObserver.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MerfolkObserver.java @@ -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; - } -} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java index a2e106a892..d8fa6b881b 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java @@ -107,4 +107,10 @@ class MoreCardsInHandThanOpponentsCondition implements Condition { } return true; } + + @Override + public String toString() { + return "you have more cards in hand than each opponent"; + } + } diff --git a/Mage/src/mage/abilities/decorator/ConditionalActivatedAbility.java b/Mage/src/mage/abilities/decorator/ConditionalActivatedAbility.java index a9b57f91c1..457722a855 100644 --- a/Mage/src/mage/abilities/decorator/ConditionalActivatedAbility.java +++ b/Mage/src/mage/abilities/decorator/ConditionalActivatedAbility.java @@ -22,11 +22,16 @@ import mage.game.Game; */ public class ConditionalActivatedAbility extends ActivatedAbilityImpl { + private static final Effects emptyEffects = new Effects(); + private final Condition condition; private String ruleText = null; - private static final Effects emptyEffects = new Effects(); - + public ConditionalActivatedAbility(Zone zone, Effect effect, Cost cost, Condition condition) { + super(zone, effect, cost); + this.condition = condition; + } + public ConditionalActivatedAbility(Zone zone, Effect effect, ManaCosts cost, Condition condition, String rule) { super(zone, effect, cost); this.condition = condition; diff --git a/Mage/src/mage/abilities/effects/common/LookLibraryTopCardTargetPlayerEffect.java b/Mage/src/mage/abilities/effects/common/LookLibraryTopCardTargetPlayerEffect.java new file mode 100644 index 0000000000..fda6b269f3 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/LookLibraryTopCardTargetPlayerEffect.java @@ -0,0 +1,76 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.effects.common; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardsImpl; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ + +public class LookLibraryTopCardTargetPlayerEffect extends OneShotEffect { + + public LookLibraryTopCardTargetPlayerEffect() { + super(Outcome.Benefit); + this.staticText = "look at the top card of target player's library"; + } + + public LookLibraryTopCardTargetPlayerEffect(final LookLibraryTopCardTargetPlayerEffect effect) { + super(effect); + } + + @Override + public LookLibraryTopCardTargetPlayerEffect copy() { + return new LookLibraryTopCardTargetPlayerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (player != null && targetPlayer != null && sourceObject != null) { + Card card = targetPlayer.getLibrary().getFromTop(game); + if (card != null) { + CardsImpl cards = new CardsImpl(); + cards.add(card); + player.lookAtCards(sourceObject.getLogName(), cards, game); + } + return true; + } + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java b/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java index 3b6e22f950..5cd2220158 100644 --- a/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java @@ -82,7 +82,15 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl { } else { sb.append("Prevent the next ").append(amountToPrevent).append(" damage that would be dealt to target "); } - sb.append(mode.getTargets().get(0).getTargetName()).append(" ").append(duration.toString()); + sb.append(mode.getTargets().get(0).getTargetName()); + if (!duration.toString().isEmpty()) { + sb.append(" "); + if (duration.equals(Duration.EndOfTurn)) { + sb.append("this turn"); + } else { + sb.append(duration.toString()); + } + } return sb.toString(); }