From 9f2f7673c69f32671cdfedfa790a6556df4c8d94 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 21 Mar 2018 00:09:20 +0100 Subject: [PATCH] [ODY] Added Natuko Shrine and Rites of Spring. --- Mage.Sets/src/mage/cards/n/NantukoShrine.java | 110 ++++++++++++++++++ Mage.Sets/src/mage/cards/r/Recollect.java | 3 +- Mage.Sets/src/mage/cards/r/RitesOfSpring.java | 108 +++++++++++++++++ Mage.Sets/src/mage/cards/s/SacredRites.java | 29 +++-- Mage.Sets/src/mage/sets/Odyssey.java | 2 + 5 files changed, 235 insertions(+), 17 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/n/NantukoShrine.java create mode 100644 Mage.Sets/src/mage/cards/r/RitesOfSpring.java diff --git a/Mage.Sets/src/mage/cards/n/NantukoShrine.java b/Mage.Sets/src/mage/cards/n/NantukoShrine.java new file mode 100644 index 00000000000..293aae002f7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NantukoShrine.java @@ -0,0 +1,110 @@ +/* + * 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.cards.n; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SetTargetPointer; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.Game; +import mage.game.permanent.token.SquirrelToken; +import mage.game.stack.Spell; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class NantukoShrine extends CardImpl { + + public NantukoShrine(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}"); + + // Whenever a player casts a spell, that player puts X 1/1 green Squirrel creature tokens onto the battlefield, where X is the number of cards in all graveyards with the same name as that spell. + this.addAbility(new SpellCastAllTriggeredAbility(new NantukoShrineEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.SPELL)); + } + + public NantukoShrine(final NantukoShrine card) { + super(card); + } + + @Override + public NantukoShrine copy() { + return new NantukoShrine(this); + } +} + +class NantukoShrineEffect extends OneShotEffect { + + public NantukoShrineEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "that player puts X 1/1 green Squirrel creature tokens onto the battlefield, where X is the number of cards in all graveyards with the same name as that spell"; + } + + public NantukoShrineEffect(final NantukoShrineEffect effect) { + super(effect); + } + + @Override + public NantukoShrineEffect copy() { + return new NantukoShrineEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); + if (spell != null) { + Player controller = game.getPlayer(spell.getControllerId()); + if (controller != null) { + int count = 0; + String name = spell.getName(); + FilterCard filterCardName = new FilterCard(); + filterCardName.add(new NamePredicate(name)); + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + count += player.getGraveyard().count(filterCardName, game); + } + } + if (count > 0) { + new SquirrelToken().putOntoBattlefield(count, game, source.getSourceId(), spell.getControllerId()); + } + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/r/Recollect.java b/Mage.Sets/src/mage/cards/r/Recollect.java index 5fff4d900c9..ede044da248 100644 --- a/Mage.Sets/src/mage/cards/r/Recollect.java +++ b/Mage.Sets/src/mage/cards/r/Recollect.java @@ -41,8 +41,7 @@ import mage.target.common.TargetCardInYourGraveyard; public class Recollect extends CardImpl { public Recollect(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); // Return target card from your graveyard to your hand. this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); diff --git a/Mage.Sets/src/mage/cards/r/RitesOfSpring.java b/Mage.Sets/src/mage/cards/r/RitesOfSpring.java new file mode 100644 index 00000000000..f755fc271f5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RitesOfSpring.java @@ -0,0 +1,108 @@ +/* + * 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.cards.r; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +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 RitesOfSpring extends CardImpl { + + public RitesOfSpring(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); + + // Discard any number of cards. Search your library for up to that many basic land cards, reveal those cards, and put them into your hand. Then shuffle your library. + getSpellAbility().addEffect(new RitesOfSpringEffect()); + } + + public RitesOfSpring(final RitesOfSpring card) { + super(card); + } + + @Override + public RitesOfSpring copy() { + return new RitesOfSpring(this); + } +} + +class RitesOfSpringEffect extends OneShotEffect { + + public RitesOfSpringEffect() { + super(Outcome.DrawCard); + this.staticText = "Discard any number of cards. Search your library for up to that many basic land cards, reveal those cards, and put them into your hand. Then shuffle your library."; + } + + public RitesOfSpringEffect(final RitesOfSpringEffect effect) { + super(effect); + } + + @Override + public RitesOfSpringEffect copy() { + return new RitesOfSpringEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Target target = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCard("cards to discard")); + while (controller.canRespond() && !target.isChosen()) { + target.choose(Outcome.BoostCreature, controller.getId(), source.getSourceId(), game); + } + int numDiscarded = 0; + for (UUID targetId : target.getTargets()) { + Card card = controller.getHand().get(targetId, game); + if (controller.discard(card, source, game)) { + numDiscarded++; + } + } + game.applyEffects(); + return new SearchLibraryPutInHandEffect( + new TargetCardInLibrary(0, numDiscarded, StaticFilters.FILTER_BASIC_LAND_CARD), true, true) + .apply(game, source); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/s/SacredRites.java b/Mage.Sets/src/mage/cards/s/SacredRites.java index 24a8e83a9bd..cee635e973d 100644 --- a/Mage.Sets/src/mage/cards/s/SacredRites.java +++ b/Mage.Sets/src/mage/cards/s/SacredRites.java @@ -50,8 +50,7 @@ import mage.target.common.TargetCardInHand; public class SacredRites extends CardImpl { public SacredRites(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}"); - + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}"); // Discard any number of cards. Creatures you control get +0/+1 until end of turn for each card discarded this way. this.getSpellAbility().addEffect(new SacredRitesEffect()); @@ -68,36 +67,36 @@ public class SacredRites extends CardImpl { } class SacredRitesEffect extends OneShotEffect { - + SacredRitesEffect() { super(Outcome.Benefit); this.staticText = "Discard any number of cards. Creatures you control get +0/+1 until end of turn for each card discarded this way."; } - + SacredRitesEffect(final SacredRitesEffect effect) { super(effect); } - + @Override public SacredRitesEffect copy() { return new SacredRitesEffect(this); } - + @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { Target target = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCard("cards to discard")); - while (player.canRespond() && !target.isChosen()) { - target.choose(Outcome.BoostCreature, player.getId(), source.getSourceId(), game); + while (controller.canRespond() && !target.isChosen()) { + target.choose(Outcome.BoostCreature, controller.getId(), source.getSourceId(), game); } int numDiscarded = 0; - for (UUID targetId : target.getTargets()) { - Card card = player.getHand().get(targetId, game); - if (player.discard(card, source, game)) { - numDiscarded++; - } + for (UUID targetId : target.getTargets()) { + Card card = controller.getHand().get(targetId, game); + if (controller.discard(card, source, game)) { + numDiscarded++; } + } game.addEffect(new BoostControlledEffect(0, numDiscarded, Duration.EndOfTurn), source); return true; } diff --git a/Mage.Sets/src/mage/sets/Odyssey.java b/Mage.Sets/src/mage/sets/Odyssey.java index 56dce0d7852..6fc04d255cd 100644 --- a/Mage.Sets/src/mage/sets/Odyssey.java +++ b/Mage.Sets/src/mage/sets/Odyssey.java @@ -250,6 +250,7 @@ public class Odyssey extends ExpansionSet { cards.add(new SetCardInfo("Nantuko Disciple", 253, Rarity.COMMON, mage.cards.n.NantukoDisciple.class)); cards.add(new SetCardInfo("Nantuko Elder", 254, Rarity.UNCOMMON, mage.cards.n.NantukoElder.class)); cards.add(new SetCardInfo("Nantuko Mentor", 255, Rarity.RARE, mage.cards.n.NantukoMentor.class)); + cards.add(new SetCardInfo("Nantuko Shrine", 256, Rarity.RARE, mage.cards.n.NantukoShrine.class)); cards.add(new SetCardInfo("Need for Speed", 209, Rarity.RARE, mage.cards.n.NeedForSpeed.class)); cards.add(new SetCardInfo("Nefarious Lich", 153, Rarity.RARE, mage.cards.n.NefariousLich.class)); cards.add(new SetCardInfo("New Frontiers", 257, Rarity.RARE, mage.cards.n.NewFrontiers.class)); @@ -301,6 +302,7 @@ public class Odyssey extends ExpansionSet { cards.add(new SetCardInfo("Resilient Wanderer", 43, Rarity.UNCOMMON, mage.cards.r.ResilientWanderer.class)); cards.add(new SetCardInfo("Rites of Initiation", 217, Rarity.COMMON, mage.cards.r.RitesOfInitiation.class)); cards.add(new SetCardInfo("Rites of Refusal", 99, Rarity.COMMON, mage.cards.r.RitesOfRefusal.class)); + cards.add(new SetCardInfo("Rites of Spring", 265, Rarity.COMMON, mage.cards.r.RitesOfSpring.class)); cards.add(new SetCardInfo("Roar of the Wurm", 266, Rarity.UNCOMMON, mage.cards.r.RoarOfTheWurm.class)); cards.add(new SetCardInfo("Rotting Giant", 158, Rarity.UNCOMMON, mage.cards.r.RottingGiant.class)); cards.add(new SetCardInfo("Sacred Rites", 44, Rarity.COMMON, mage.cards.s.SacredRites.class));