From 0389f8249c7be74db4a31d656a8f9ac9af613e58 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 1 Nov 2013 17:05:38 +0100 Subject: [PATCH] [C13] Added 7 cards. --- .../sets/commander2013/NayaSoulbeast.java | 170 ++++++++++++++++++ .../sets/commander2013/RavenousBaloth.java | 52 ++++++ .../src/mage/sets/commander2013/Restore.java | 101 +++++++++++ .../mage/sets/commander2013/TerraRavager.java | 110 ++++++++++++ .../mage/sets/commander2013/WarCadence.java | 126 +++++++++++++ .../sets/commander2013/WidespreadPanic.java | 138 ++++++++++++++ .../mage/sets/commander2013/WitchHunt.java | 111 ++++++++++++ .../sets/mercadianmasques/WarCadence.java | 52 ++++++ .../mage/sets/onslaught/RavenousBaloth.java | 76 ++++++++ 9 files changed, 936 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java create mode 100644 Mage.Sets/src/mage/sets/commander2013/RavenousBaloth.java create mode 100644 Mage.Sets/src/mage/sets/commander2013/Restore.java create mode 100644 Mage.Sets/src/mage/sets/commander2013/TerraRavager.java create mode 100644 Mage.Sets/src/mage/sets/commander2013/WarCadence.java create mode 100644 Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java create mode 100644 Mage.Sets/src/mage/sets/commander2013/WitchHunt.java create mode 100644 Mage.Sets/src/mage/sets/mercadianmasques/WarCadence.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/RavenousBaloth.java diff --git a/Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java b/Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java new file mode 100644 index 00000000000..f04efed3a88 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java @@ -0,0 +1,170 @@ +/* + * 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.commander2013; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class NayaSoulbeast extends CardImpl { + + public NayaSoulbeast(UUID ownerId) { + super(ownerId, 157, "Naya Soulbeast", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{6}{G}{G}"); + this.expansionSetCode = "C13"; + this.subtype.add("Beast"); + + this.color.setGreen(true); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + // When you cast Naya Soulbeast, each player reveals the top card of his or her library. Naya Soulbeast enters the battlefield with X +1/+1 counters on it, where X is the total converted mana cost of all cards revealed this way. + Ability ability = new CastSourceTriggeredAbility(new NayaSoulbeastCastEffect(), false); + ability.addEffect(new NayaSoulbeastReplacementEffect()); + this.addAbility(ability); + } + + public NayaSoulbeast(final NayaSoulbeast card) { + super(card); + } + + @Override + public NayaSoulbeast copy() { + return new NayaSoulbeast(this); + } +} + +class NayaSoulbeastCastEffect extends OneShotEffect { + + public NayaSoulbeastCastEffect() { + super(Outcome.Benefit); + this.staticText = "each player reveals the top card of his or her library"; + } + + public NayaSoulbeastCastEffect(final NayaSoulbeastCastEffect effect) { + super(effect); + } + + @Override + public NayaSoulbeastCastEffect copy() { + return new NayaSoulbeastCastEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int cmc = 0; + for (UUID playerId :controller.getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) { + if (player.getLibrary().size() > 0) { + Card card = player.getLibrary().getFromTop(game); + cmc += card.getManaCost().convertedManaCost(); + player.revealCards(new StringBuilder("Naya Soulbeast (").append(player.getName()).append(")").toString(), new CardsImpl(card), game); + } + } + } + for (Effect effect : source.getEffects()) { + if (effect instanceof NayaSoulbeastReplacementEffect) { + effect.setValue("NayaSoulbeastCounters", new Integer(cmc)); + } + } + return true; + } + return false; + } +} + +class NayaSoulbeastReplacementEffect extends ReplacementEffectImpl { + + public static final String SOURCE_CAST_SPELL_ABILITY = "sourceCastSpellAbility"; + + public NayaSoulbeastReplacementEffect() { + super(Duration.OneUse, Outcome.BoostCreature, true); + staticText = "{this} enters the battlefield with X +1/+1 counters on it, where X is the total converted mana cost of all cards revealed this way"; + } + + public NayaSoulbeastReplacementEffect(final NayaSoulbeastReplacementEffect effect) { + super(effect); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { + if (event.getTargetId().equals(source.getSourceId())) { + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Object object = this.getValue("NayaSoulbeastCounters"); + if (object instanceof Integer) { + int amount = ((Integer)object).intValue(); + new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount)).apply(game, source); + } + return false; + } + + @Override + public NayaSoulbeastReplacementEffect copy() { + return new NayaSoulbeastReplacementEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/commander2013/RavenousBaloth.java b/Mage.Sets/src/mage/sets/commander2013/RavenousBaloth.java new file mode 100644 index 00000000000..f99d9f54724 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/RavenousBaloth.java @@ -0,0 +1,52 @@ +/* + * 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.commander2013; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class RavenousBaloth extends mage.sets.onslaught.RavenousBaloth { + + public RavenousBaloth(UUID ownerId) { + super(ownerId); + this.cardNumber = 165; + this.expansionSetCode = "C13"; + } + + public RavenousBaloth(final RavenousBaloth card) { + super(card); + } + + @Override + public RavenousBaloth copy() { + return new RavenousBaloth(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/Restore.java b/Mage.Sets/src/mage/sets/commander2013/Restore.java new file mode 100644 index 00000000000..a6c3bb19410 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/Restore.java @@ -0,0 +1,101 @@ +/* + * 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.commander2013; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterLandCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInGraveyard; + +/** + * + * @author LevelX2 + */ +public class Restore extends CardImpl { + + private static final FilterLandCard filter = new FilterLandCard(); + + public Restore(UUID ownerId) { + super(ownerId, 167, "Restore", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{1}{G}"); + this.expansionSetCode = "C13"; + + this.color.setGreen(true); + + // Put target land card from a graveyard onto the battlefield under your control. + this.getSpellAbility().addEffect(new RestoreEffect()); + Target target = new TargetCardInGraveyard(filter); + target.setRequired(true); + this.getSpellAbility().addTarget(target); + } + + public Restore(final Restore card) { + super(card); + } + + @Override + public Restore copy() { + return new Restore(this); + } +} + +class RestoreEffect extends OneShotEffect { + + public RestoreEffect() { + super(Outcome.PutLandInPlay); + this.staticText = "Put target land card from a graveyard onto the battlefield under your control"; + } + + public RestoreEffect(final RestoreEffect effect) { + super(effect); + } + + @Override + public RestoreEffect copy() { + return new RestoreEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Card land = game.getCard(this.getTargetPointer().getFirst(game, source)); + if (controller != null && game.getState().getZone(land.getId()).equals(Zone.GRAVEYARD)) { + return land.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId()); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/TerraRavager.java b/Mage.Sets/src/mage/sets/commander2013/TerraRavager.java new file mode 100644 index 00000000000..cabc9ae3a46 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/TerraRavager.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.sets.commander2013; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterLandPermanent; +import mage.game.Game; +import mage.game.combat.CombatGroup; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class TerraRavager extends CardImpl { + + public TerraRavager(UUID ownerId) { + super(ownerId, 126, "Terra Ravager", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); + this.expansionSetCode = "C13"; + this.subtype.add("Elemental"); + this.subtype.add("Beast"); + + this.color.setRed(true); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Whenever Terra Ravager attacks, it gets +X/+0 until end of turn, where X is the number of lands defending player controls. + this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(new TerraRavagerLandCount(), new StaticValue(0), Duration.EndOfTurn, true), false)); + } + + public TerraRavager(final TerraRavager card) { + super(card); + } + + @Override + public TerraRavager copy() { + return new TerraRavager(this); + } +} + +class TerraRavagerLandCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility) { + for (CombatGroup group :game.getCombat().getGroups()) { + if (group.getAttackers().contains(sourceAbility.getSourceId())) { + UUID defenderId = group.getDefenderId(); + if (group.isDefenderIsPlaneswalker()) { + Permanent permanent = game.getPermanent(defenderId); + if (permanent != null) { + defenderId = permanent.getControllerId(); + } + } + return game.getBattlefield().countAll(new FilterLandPermanent(), defenderId, game); + + } + } + return 0; + } + + @Override + public DynamicValue copy() { + return new TerraRavagerLandCount(); + } + + @Override + public String toString() { + return "X"; + } + + @Override + public String getMessage() { + return "land defending player controls"; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/WarCadence.java b/Mage.Sets/src/mage/sets/commander2013/WarCadence.java new file mode 100644 index 00000000000..4d02cf13259 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/WarCadence.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.commander2013; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class WarCadence extends CardImpl { + + public WarCadence(UUID ownerId) { + super(ownerId, 128, "War Cadence", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + this.expansionSetCode = "C13"; + + this.color.setRed(true); + + // {X}{R}: This turn, creatures can't block unless their controller pays {X} for each blocking creature he or she controls. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WarCadenceReplacementEffect(), new ManaCostsImpl("{X}{R}") )); + + } + + public WarCadence(final WarCadence card) { + super(card); + } + + @Override + public WarCadence copy() { + return new WarCadence(this); + } +} + +class WarCadenceReplacementEffect extends ReplacementEffectImpl { + + DynamicValue xCosts = new ManacostVariableValue(); + + WarCadenceReplacementEffect ( ) { + super(Duration.EndOfTurn, Outcome.Neutral); + staticText = "This turn, creatures can't block unless their controller pays {X} for each blocking creature he or she controls"; + } + + WarCadenceReplacementEffect ( WarCadenceReplacementEffect effect ) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Player player = game.getPlayer(event.getPlayerId()); + if (player != null) { + int amount = xCosts.calculate(game, source); + if (amount > 0) { + String mana = new StringBuilder("{").append(amount).append("}").toString(); + ManaCostsImpl cost = new ManaCostsImpl(mana); + if ( cost.canPay(source.getSourceId(), event.getPlayerId(), game) && + player.chooseUse(Outcome.Benefit, new StringBuilder("Pay ").append(mana).append(" to declare blocker?").toString(), game) ) { + if (cost.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) { + return false; + } + } + return true; + } + } + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType().equals(GameEvent.EventType.DECLARE_BLOCKER)) { + return true; + } + return false; + } + + @Override + public WarCadenceReplacementEffect copy() { + return new WarCadenceReplacementEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java b/Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java new file mode 100644 index 00000000000..04fa4310c43 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java @@ -0,0 +1,138 @@ +/* + * 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.commander2013; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; +import mage.target.common.TargetCardInHand; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LevelX2 + */ +public class WidespreadPanic extends CardImpl { + + public WidespreadPanic(UUID ownerId) { + super(ownerId, 131, "Widespread Panic", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + this.expansionSetCode = "C13"; + + this.color.setRed(true); + + // Whenever a spell or ability causes its controller to shuffle his or her library, that player puts a card from his or her hand on top of his or her library. + this.addAbility(new WidespreadPanicTriggeredAbility()); + } + + public WidespreadPanic(final WidespreadPanic card) { + super(card); + } + + @Override + public WidespreadPanic copy() { + return new WidespreadPanic(this); + } +} + +class WidespreadPanicTriggeredAbility extends TriggeredAbilityImpl { + + public WidespreadPanicTriggeredAbility() { + super(Zone.BATTLEFIELD, new WidespreadPanicEffect(), false); + } + + public WidespreadPanicTriggeredAbility(final WidespreadPanicTriggeredAbility ability) { + super(ability); + } + + @Override + public WidespreadPanicTriggeredAbility copy() { + return new WidespreadPanicTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType().equals(GameEvent.EventType.LIBRARY_SHUFFLED)) { + for(Effect effect :this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return new StringBuilder("Whenever a spell or ability causes its controller to shuffle his or her library, ").append(super.getRule()).toString(); + } +} + +class WidespreadPanicEffect extends OneShotEffect { + + public WidespreadPanicEffect() { + super(Outcome.Detriment); + this.staticText = "that player puts a card from his or her hand on top of his or her library"; + } + + public WidespreadPanicEffect(final WidespreadPanicEffect effect) { + super(effect); + } + + @Override + public WidespreadPanicEffect copy() { + return new WidespreadPanicEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player shuffler = game.getPlayer(this.getTargetPointer().getFirst(game, source)); + if (shuffler != null) { + if (shuffler.getHand().size() > 0) { + TargetCardInHand target = new TargetCardInHand(); + target.setTargetName("a card from your hand to put on top of your library"); + shuffler.choose(Outcome.Detriment, target, source.getSourceId(), game); + Card card = shuffler.getHand().get(target.getFirstTarget(), game); + if (card != null) { + return card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/WitchHunt.java b/Mage.Sets/src/mage/sets/commander2013/WitchHunt.java new file mode 100644 index 00000000000..40cc11a8884 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/WitchHunt.java @@ -0,0 +1,111 @@ +/* + * 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.commander2013; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.DamageControllerEffect; +import mage.abilities.effects.common.continious.PlayersCantGainLifeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.Target; +import mage.target.common.TargetOpponent; + +/** + * + * @author LevelX2 + */ +public class WitchHunt extends CardImpl { + + public WitchHunt(UUID ownerId) { + super(ownerId, 133, "Witch Hunt", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}"); + this.expansionSetCode = "C13"; + + this.color.setRed(true); + + // Players can't gain life. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayersCantGainLifeEffect())); + // At the beginning of your upkeep, Witch Hunt deals 4 damage to you. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageControllerEffect(4), TargetController.YOU, false)); + // At the beginning of your end step, target opponent chosen at random gains control of Witch Hunt. + Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new WitchHuntEffect(), TargetController.YOU, null, false); + Target target = new TargetOpponent(true); + target.setRandom(true); + ability.addTarget(target); + this.addAbility(ability); + } + + public WitchHunt(final WitchHunt card) { + super(card); + } + + @Override + public WitchHunt copy() { + return new WitchHunt(this); + } +} + +class WitchHuntEffect extends ContinuousEffectImpl { + + public WitchHuntEffect() { + super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl); + staticText = "target opponent chosen at random gains control of {this}"; + } + + public WitchHuntEffect(final WitchHuntEffect effect) { + super(effect); + } + + @Override + public WitchHuntEffect copy() { + return new WitchHuntEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + return permanent.changeControllerId(this.getTargetPointer().getFirst(game, source), game); + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/WarCadence.java b/Mage.Sets/src/mage/sets/mercadianmasques/WarCadence.java new file mode 100644 index 00000000000..a0e1a462661 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mercadianmasques/WarCadence.java @@ -0,0 +1,52 @@ +/* + * 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; + +/** + * + * @author LevelX2 + */ +public class WarCadence extends mage.sets.commander2013.WarCadence { + + public WarCadence(UUID ownerId) { + super(ownerId); + this.cardNumber = 224; + this.expansionSetCode = "MMQ"; + } + + public WarCadence(final WarCadence card) { + super(card); + } + + @Override + public WarCadence copy() { + return new WarCadence(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/RavenousBaloth.java b/Mage.Sets/src/mage/sets/onslaught/RavenousBaloth.java new file mode 100644 index 00000000000..aa6f3547387 --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/RavenousBaloth.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.sets.onslaught; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class RavenousBaloth extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a Beast"); + static { + filter.add(new SubtypePredicate("Beast")); + } + + public RavenousBaloth(UUID ownerId) { + super(ownerId, 278, "Ravenous Baloth", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.expansionSetCode = "ONS"; + this.subtype.add("Beast"); + + this.color.setGreen(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Sacrifice a Beast: You gain 4 life. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(4), + new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,filter,true,true)))); + } + + public RavenousBaloth(final RavenousBaloth card) { + super(card); + } + + @Override + public RavenousBaloth copy() { + return new RavenousBaloth(this); + } +}