From cd13dcbcc488a58b421191e084e8823ecd03f9bc Mon Sep 17 00:00:00 2001 From: LoneFox Date: Mon, 29 Jun 2015 11:52:58 +0300 Subject: [PATCH] Implement cards: Crumbling Sanctuary, Ihsan's Shade, Lava Runner, and Nantuko Cultivator --- .../src/mage/sets/homelands/IhsansShade.java | 74 ++++++++++++ .../sets/masterseditionii/IhsansShade.java | 55 +++++++++ .../mercadianmasques/CrumblingSanctuary.java | 106 ++++++++++++++++ .../sets/mercadianmasques/LavaRunner.java | 108 +++++++++++++++++ .../mage/sets/torment/NantukoCultivator.java | 113 ++++++++++++++++++ 5 files changed, 456 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/homelands/IhsansShade.java create mode 100644 Mage.Sets/src/mage/sets/masterseditionii/IhsansShade.java create mode 100644 Mage.Sets/src/mage/sets/mercadianmasques/CrumblingSanctuary.java create mode 100644 Mage.Sets/src/mage/sets/mercadianmasques/LavaRunner.java create mode 100644 Mage.Sets/src/mage/sets/torment/NantukoCultivator.java diff --git a/Mage.Sets/src/mage/sets/homelands/IhsansShade.java b/Mage.Sets/src/mage/sets/homelands/IhsansShade.java new file mode 100644 index 00000000000..3e4dc11a065 --- /dev/null +++ b/Mage.Sets/src/mage/sets/homelands/IhsansShade.java @@ -0,0 +1,74 @@ +/* + * 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.homelands; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.ColorPredicate; + +/** + * + * @author LoneFox + + */ +public class IhsansShade extends CardImpl { + + private static final FilterCard filter = new FilterCard("white"); + + static { + filter.add(new ColorPredicate(ObjectColor.WHITE)); + } + + public IhsansShade(UUID ownerId) { + super(ownerId, 16, "Ihsan's Shade", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{B}"); + this.expansionSetCode = "HML"; + this.supertype.add("Legendary"); + this.subtype.add("Shade"); + this.subtype.add("Knight"); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Protection from white + this.addAbility(new ProtectionAbility(filter)); + } + + public IhsansShade(final IhsansShade card) { + super(card); + } + + @Override + public IhsansShade copy() { + return new IhsansShade(this); + } +} diff --git a/Mage.Sets/src/mage/sets/masterseditionii/IhsansShade.java b/Mage.Sets/src/mage/sets/masterseditionii/IhsansShade.java new file mode 100644 index 00000000000..c252e9874cf --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditionii/IhsansShade.java @@ -0,0 +1,55 @@ +/* + * 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.masterseditionii; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + + */ +public class IhsansShade extends mage.sets.homelands.IhsansShade { + + public IhsansShade(UUID ownerId) { + super(ownerId); + this.cardNumber = 95; + this.expansionSetCode = "ME2"; + this.rarity = Rarity.RARE; + } + + public IhsansShade(final IhsansShade card) { + super(card); + } + + @Override + public IhsansShade copy() { + return new IhsansShade(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/CrumblingSanctuary.java b/Mage.Sets/src/mage/sets/mercadianmasques/CrumblingSanctuary.java new file mode 100644 index 00000000000..69087dd02a8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mercadianmasques/CrumblingSanctuary.java @@ -0,0 +1,106 @@ +/* + * 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.mercadianmasques; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.PreventionEffectImpl; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; + +/** + * + * @author LoneFox + + */ +public class CrumblingSanctuary extends CardImpl { + + public CrumblingSanctuary(UUID ownerId) { + super(ownerId, 292, "Crumbling Sanctuary", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}"); + this.expansionSetCode = "MMQ"; + + // If damage would be dealt to a player, that player exiles that many cards from the top of his or her library instead. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CrumblingSanctuaryEffect())); + } + + public CrumblingSanctuary(final CrumblingSanctuary card) { + super(card); + } + + @Override + public CrumblingSanctuary copy() { + return new CrumblingSanctuary(this); + } +} + +class CrumblingSanctuaryEffect extends PreventionEffectImpl { + + public CrumblingSanctuaryEffect() { + super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, false, false); + staticText = "If damage would be dealt to a player, that player exiles that many cards from the top of his or her library instead."; + } + + public CrumblingSanctuaryEffect(final CrumblingSanctuaryEffect effect) { + super(effect); + } + + @Override + public CrumblingSanctuaryEffect copy() { + return new CrumblingSanctuaryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + int amount = event.getAmount(); + Player player = game.getPlayer(event.getTargetId()); + if(player != null) { + preventDamageAction(event, source, game); + player.moveCards(player.getLibrary().getTopCards(game, amount), Zone.LIBRARY, Zone.EXILED, source, game); + return true; + } + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return super.applies(event, source, game) && (game.getPlayer(event.getTargetId()) != null); + } + +} diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/LavaRunner.java b/Mage.Sets/src/mage/sets/mercadianmasques/LavaRunner.java new file mode 100644 index 00000000000..3ab5e2cfe77 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mercadianmasques/LavaRunner.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.sets.mercadianmasques; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.SacrificeEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterLandPermanent; +import mage.game.Game; +import mage.game.events.GameEvent.EventType; +import mage.game.events.GameEvent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LoneFox + + */ +public class LavaRunner extends CardImpl { + + public LavaRunner(UUID ownerId) { + super(ownerId, 200, "Lava Runner", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{R}{R}"); + this.expansionSetCode = "MMQ"; + this.subtype.add("Lizard"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Haste + this.addAbility(HasteAbility.getInstance()); + // Whenever Lava Runner becomes the target of a spell or ability, that spell or ability's controller sacrifices a land. + this.addAbility(new LavaRunnerAbility()); + } + + public LavaRunner(final LavaRunner card) { + super(card); + } + + @Override + public LavaRunner copy() { + return new LavaRunner(this); + } +} + +class LavaRunnerAbility extends TriggeredAbilityImpl { + + public LavaRunnerAbility() { + super(Zone.BATTLEFIELD, new SacrificeEffect(new FilterLandPermanent(), 1, ""), false); + } + + public LavaRunnerAbility(final LavaRunnerAbility ability) { + super(ability); + } + + @Override + public LavaRunnerAbility copy() { + return new LavaRunnerAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if(event.getTargetId().equals(this.getSourceId())) { + getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} becomes the target of a spell or ability, that spell or ability's controller sacrifices a land."; + } +} diff --git a/Mage.Sets/src/mage/sets/torment/NantukoCultivator.java b/Mage.Sets/src/mage/sets/torment/NantukoCultivator.java new file mode 100644 index 00000000000..56b910855e3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/torment/NantukoCultivator.java @@ -0,0 +1,113 @@ +/* + * 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.torment; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterLandCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +/** + * + * @author LoneFox + + */ +public class NantukoCultivator extends CardImpl { + + public NantukoCultivator(UUID ownerId) { + super(ownerId, 133, "Nantuko Cultivator", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{G}"); + this.expansionSetCode = "TOR"; + this.subtype.add("Insect"); + this.subtype.add("Druid"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Nantuko Cultivator enters the battlefield, you may discard any number of land cards. Put that many +1/+1 counters on Nantuko Cultivator and draw that many cards. + this.addAbility(new EntersBattlefieldTriggeredAbility(new NantukoCultivatorEffect(), true)); + } + + public NantukoCultivator(final NantukoCultivator card) { + super(card); + } + + @Override + public NantukoCultivator copy() { + return new NantukoCultivator(this); + } +} + +class NantukoCultivatorEffect extends OneShotEffect { + + public NantukoCultivatorEffect() { + super(Outcome.BoostCreature); + staticText = "you may discard any number of land cards. Put that many +1/+1 counters on {this} and draw that many cards."; + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if(player != null) { + TargetCardInHand toDiscard = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterLandCard()); + if(player.chooseTarget(Outcome.Discard, toDiscard, source, game)) { + int count = 0; + for(UUID targetId: toDiscard.getTargets()) { + player.discard(game.getCard(targetId), source, game); + count++; + } + Permanent permanent = game.getPermanent(source.getSourceId()); + if(permanent != null) { + permanent.addCounters(CounterType.P1P1.createInstance(count), game); + } + player.drawCards(count, game); + } + return true; + } + return false; + } + + public NantukoCultivatorEffect(final NantukoCultivatorEffect effect) { + super(effect); + } + + @Override + public NantukoCultivatorEffect copy() { + return new NantukoCultivatorEffect(this); + } + +}