From 126d628d63bb6ea945cfedfb405eab6484067e06 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 6 Apr 2014 17:26:54 +0200 Subject: [PATCH] Added Infernal Tudor, Hanna Ships Navigator, Hazezon Tamar. --- .../mage/sets/dissension/InfernalTutor.java | 126 ++++++++++++++++ .../mage/sets/dissension/RakdosPitDragon.java | 25 +++- .../sets/invasion/HannaShipsNavigator.java | 88 +++++++++++ .../src/mage/sets/legends/HazezonTamar.java | 141 ++++++++++++++++++ .../effects/common/CreateTokenEffect.java | 2 +- .../effects/common/ExileAllEffect.java | 16 +- .../search/SearchLibraryPutInHandEffect.java | 2 +- Mage/src/mage/constants/AbilityWord.java | 1 + Mage/src/mage/players/PlayerImpl.java | 2 + 9 files changed, 389 insertions(+), 14 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/dissension/InfernalTutor.java create mode 100644 Mage.Sets/src/mage/sets/invasion/HannaShipsNavigator.java create mode 100644 Mage.Sets/src/mage/sets/legends/HazezonTamar.java diff --git a/Mage.Sets/src/mage/sets/dissension/InfernalTutor.java b/Mage.Sets/src/mage/sets/dissension/InfernalTutor.java new file mode 100644 index 00000000000..e28c37f1c85 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dissension/InfernalTutor.java @@ -0,0 +1,126 @@ +/* + * 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.sets.dissension; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.condition.common.HellbentCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInHand; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ +public class InfernalTutor extends CardImpl { + + public InfernalTutor(UUID ownerId) { + super(ownerId, 46, "Infernal Tutor", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{B}"); + this.expansionSetCode = "DIS"; + + this.color.setBlack(true); + + // Reveal a card from your hand. Search your library for a card with the same name as that card, reveal it, put it into your hand, then shuffle your library. + this.getSpellAbility().addEffect(new InfernalTutorEffect()); + // Hellbent - If you have no cards in hand, instead search your library for a card, put it into your hand, then shuffle your library. + Effect effect = new ConditionalOneShotEffect( + new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterCard()), false, true), + HellbentCondition.getInstance(), + "

Hellbent - If you have no cards in hand, instead search your library for a card, put it into your hand, then shuffle your library"); + this.getSpellAbility().addEffect(effect); + + } + + public InfernalTutor(final InfernalTutor card) { + super(card); + } + + @Override + public InfernalTutor copy() { + return new InfernalTutor(this); + } +} + +class InfernalTutorEffect extends OneShotEffect { + + public InfernalTutorEffect() { + super(Outcome.Benefit); + this.staticText = "Reveal a card from your hand. Search your library for a card with the same name as that card, reveal it, put it into your hand, then shuffle your library"; + } + + public InfernalTutorEffect(final InfernalTutorEffect effect) { + super(effect); + } + + @Override + public InfernalTutorEffect copy() { + return new InfernalTutorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Card sourceCard = game.getCard(source.getSourceId()); + if (controller != null) { + if (controller.getHand().size() > 0) { + Card cardToReveal = null; + if (controller.getHand().size() > 1) { + Target target = new TargetCardInHand(new FilterCard()); + target.setRequired(true); + target.setNotTarget(true); + if (controller.chooseTarget(outcome, target, source, game)) { + cardToReveal = game.getCard(target.getFirstTarget()); + } + } else { + cardToReveal = controller.getHand().getRandom(game); + } + if (cardToReveal != null) { + controller.revealCards(sourceCard.getName(), new CardsImpl(cardToReveal), game); + FilterCard filterCard = new FilterCard(new StringBuilder("card named ").append(cardToReveal.getName()).toString()); + return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filterCard), true, true).apply(game, source); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/dissension/RakdosPitDragon.java b/Mage.Sets/src/mage/sets/dissension/RakdosPitDragon.java index 04322658486..53b9701913e 100644 --- a/Mage.Sets/src/mage/sets/dissension/RakdosPitDragon.java +++ b/Mage.Sets/src/mage/sets/dissension/RakdosPitDragon.java @@ -29,11 +29,6 @@ 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.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; @@ -45,6 +40,10 @@ import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.DoubleStrikeAbility; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; /** * @@ -59,9 +58,19 @@ public class RakdosPitDragon extends CardImpl { this.color.setRed(true); this.power = new MageInt(3); this.toughness = new MageInt(3); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{R}{R}"))); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}"))); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield), HellbentCondition.getInstance(), "Hellbent - Rakdos Pit Dragon has double strike as long as you have no cards in hand"))); + // {R}{R}: Rakdos Pit Dragon gains flying until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, + new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), + new ManaCostsImpl("{R}{R}"))); + // {R}: Rakdos Pit Dragon gets +1/+0 until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, + new BoostSourceEffect(1, 0, Duration.EndOfTurn), + new ManaCostsImpl("{R}"))); + // Hellbent — Rakdos Pit Dragon has double strike as long as you have no cards in hand. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( + new GainAbilitySourceEffect(DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield), + HellbentCondition.getInstance(), + "Hellbent - Rakdos Pit Dragon has double strike as long as you have no cards in hand"))); } public RakdosPitDragon (final RakdosPitDragon card) { diff --git a/Mage.Sets/src/mage/sets/invasion/HannaShipsNavigator.java b/Mage.Sets/src/mage/sets/invasion/HannaShipsNavigator.java new file mode 100644 index 00000000000..0c784b54d3c --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/HannaShipsNavigator.java @@ -0,0 +1,88 @@ +/* + * 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.sets.invasion; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.other.OwnerPredicate; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author LevelX2 + */ +public class HannaShipsNavigator extends CardImpl { + + private static final FilterCard filter = new FilterCard("artifact or enchantment card from your graveyard"); + + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT))); + filter.add(new OwnerPredicate(TargetController.YOU)); + } + + public HannaShipsNavigator(UUID ownerId) { + super(ownerId, 249, "Hanna, Ship's Navigator", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}{U}"); + this.expansionSetCode = "INV"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Artificer"); + + this.color.setBlue(true); + this.color.setWhite(true); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // {1}{W}{U}, {tap}: Return target artifact or enchantment card from your graveyard to your hand. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToHandTargetEffect(), new ManaCostsImpl("{1}{W}{U}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetCardInYourGraveyard(filter, true)); + this.addAbility(ability); + } + + public HannaShipsNavigator(final HannaShipsNavigator card) { + super(card); + } + + @Override + public HannaShipsNavigator copy() { + return new HannaShipsNavigator(this); + } +} diff --git a/Mage.Sets/src/mage/sets/legends/HazezonTamar.java b/Mage.Sets/src/mage/sets/legends/HazezonTamar.java new file mode 100644 index 00000000000..58358d0bde0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/HazezonTamar.java @@ -0,0 +1,141 @@ +/* + * 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.sets.legends; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ExileAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.token.Token; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class HazezonTamar extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sand Warriors"); + + static { + filter.add(new SubtypePredicate("Sand")); + filter.add(new SubtypePredicate("Warrior")); + } + + public HazezonTamar(UUID ownerId) { + super(ownerId, 270, "Hazezon Tamar", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{R}{G}{W}"); + this.expansionSetCode = "LEG"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Warrior"); + + this.color.setRed(true); + this.color.setGreen(true); + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // When Hazezon Tamar enters the battlefield, put X 1/1 Sand Warrior creature tokens that are red, green, and white onto the battlefield at the beginning of your next upkeep, where X is the number of lands you control at that time. + this.addAbility(new EntersBattlefieldTriggeredAbility(new HazezonTamarEntersEffect(), false)); + // When Hazezon leaves the battlefield, exile all Sand Warriors. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new ExileAllEffect(filter), false)); + } + + public HazezonTamar(final HazezonTamar card) { + super(card); + } + + @Override + public HazezonTamar copy() { + return new HazezonTamar(this); + } +} + +class HazezonTamarEntersEffect extends OneShotEffect { + + public HazezonTamarEntersEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "put X 1/1 Sand Warrior creature tokens that are red, green, and white onto the battlefield at the beginning of your next upkeep, where X is the number of lands you control at that time"; + } + + public HazezonTamarEntersEffect(final HazezonTamarEntersEffect effect) { + super(effect); + } + + @Override + public HazezonTamarEntersEffect copy() { + return new HazezonTamarEntersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Effect effect = new CreateTokenEffect(new HazezonTamarSandWarrior(), new PermanentsOnBattlefieldCount(new FilterControlledLandPermanent())); + effect.setText("put X 1/1 Sand Warrior creature tokens that are red, green, and white onto the battlefield, where X is the number of lands you control at that time"); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(effect); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } + return false; + } +} + +class HazezonTamarSandWarrior extends Token { + + public HazezonTamarSandWarrior() { + super("Sand Warrior", "1/1 Sand Warrior creature tokens that are red, green, and white"); + cardType.add(CardType.CREATURE); + color.setRed(true); + color.setGreen(true); + color.setWhite(true); + subtype.add("Sand"); + subtype.add("Warrior"); + power = new MageInt(1); + toughness = new MageInt(1); + } + +} diff --git a/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java index f4f303d8e47..7bac2ae0cfb 100644 --- a/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java @@ -29,11 +29,11 @@ package mage.abilities.effects.common; import java.util.UUID; -import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.token.Token; import mage.util.CardUtil; diff --git a/Mage/src/mage/abilities/effects/common/ExileAllEffect.java b/Mage/src/mage/abilities/effects/common/ExileAllEffect.java index 56b901eef40..456451acd32 100644 --- a/Mage/src/mage/abilities/effects/common/ExileAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/ExileAllEffect.java @@ -33,9 +33,11 @@ import java.util.UUID; import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; +import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.players.Player; /** * @@ -72,11 +74,17 @@ public class ExileAllEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getId(), game); - for (Permanent permanent: permanents) { - permanent.moveToExile(exileId, exileZone, source.getSourceId(), game); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); + for (Permanent permanent: permanents) { + controller.moveCardToExileWithInfo(permanent, exileId, exileZone, source.getSourceId(), game, Zone.BATTLEFIELD); + } + return true; } - return true; + return false; + + } private void setText() { diff --git a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index 0382db9234b..507c0260cf0 100644 --- a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -95,7 +95,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect> implements Player, Ser //20091005 - 701.14c Library searchedLibrary = null; if (targetPlayerId.equals(playerId)) { + game.informPlayers(new StringBuilder(getName()).append(" searches his or her library").toString()); searchedLibrary = library; } else { Player targetPlayer = game.getPlayer(targetPlayerId); if (targetPlayer != null) { + game.informPlayers(new StringBuilder(getName()).append(" searches the library of ").append(targetPlayer.getName()).toString()); searchedLibrary = targetPlayer.getLibrary(); } }