From eeec615ea0b33b029b6e8d692c16e1a083e14c71 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 3 Jul 2014 15:50:38 -0500 Subject: [PATCH] - Added Bloodshed Fever, Cragganwick Cremator, Elemental Mastery, and Ember Gale. DiscardTargetEffect can now store the discarded card. --- .../mage/sets/shadowmoor/BloodshedFever.java | 79 ++++++++++ .../sets/shadowmoor/CragganwickCremator.java | 117 +++++++++++++++ .../sets/shadowmoor/ElementalMastery.java | 141 ++++++++++++++++++ .../src/mage/sets/shadowmoor/EmberGale.java | 116 ++++++++++++++ .../common/discard/DiscardTargetEffect.java | 16 ++ 5 files changed, 469 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/BloodshedFever.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/CragganwickCremator.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/ElementalMastery.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/EmberGale.java diff --git a/Mage.Sets/src/mage/sets/shadowmoor/BloodshedFever.java b/Mage.Sets/src/mage/sets/shadowmoor/BloodshedFever.java new file mode 100644 index 00000000000..50758accb77 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/BloodshedFever.java @@ -0,0 +1,79 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.AttacksEachTurnStaticAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class BloodshedFever extends CardImpl { + + public BloodshedFever(UUID ownerId) { + super(ownerId, 84, "Bloodshed Fever", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{R}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Aura"); + + this.color.setRed(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature attacks each turn if able. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new AttacksEachTurnStaticAbility(), AttachmentType.AURA, Duration.WhileOnBattlefield, "Enchanted creature attacks each turn if able"))); + } + + public BloodshedFever(final BloodshedFever card) { + super(card); + } + + @Override + public BloodshedFever copy() { + return new BloodshedFever(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/CragganwickCremator.java b/Mage.Sets/src/mage/sets/shadowmoor/CragganwickCremator.java new file mode 100644 index 00000000000..868cfd048d5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/CragganwickCremator.java @@ -0,0 +1,117 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.discard.DiscardTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public class CragganwickCremator extends CardImpl { + + public CragganwickCremator(UUID ownerId) { + super(ownerId, 87, "Cragganwick Cremator", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Giant"); + this.subtype.add("Shaman"); + + this.color.setRed(true); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + // When Cragganwick Cremator enters the battlefield, discard a card at random. If you discard a creature card this way, Cragganwick Cremator deals damage equal to that card's power to target player. + Ability ability = new EntersBattlefieldTriggeredAbility(new CragganwickCrematorEffect(), false); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + + } + + public CragganwickCremator(final CragganwickCremator card) { + super(card); + } + + @Override + public CragganwickCremator copy() { + return new CragganwickCremator(this); + } +} + +class CragganwickCrematorEffect extends OneShotEffect { + + public CragganwickCrematorEffect() { + super(Outcome.Neutral); + this.staticText = "discard a card at random. If you discard a creature card this way, deals damage equal to that card's power to target player"; + } + + public CragganwickCrematorEffect(final CragganwickCrematorEffect effect) { + super(effect); + } + + @Override + public CragganwickCrematorEffect copy() { + return new CragganwickCrematorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player you = game.getPlayer(source.getControllerId()); + Player targetedPlayer = game.getPlayer(source.getFirstTarget()); + if (you != null) { + Effect discardEffect = new DiscardTargetEffect(1, true, true); + discardEffect.setTargetPointer(new FixedTarget(you.getId())); + if (discardEffect.apply(game, source)) { + Card discardedCard = game.getCard(this.getTargetPointer().getFirst(game, source)); + if (discardedCard != null + && discardedCard.getCardType().contains(CardType.CREATURE)) { + int damage = discardedCard.getPower().getValue(); + if (targetedPlayer != null) { + targetedPlayer.damage(damage, source.getSourceId(), game, false, true); + return true; + } + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/ElementalMastery.java b/Mage.Sets/src/mage/sets/shadowmoor/ElementalMastery.java new file mode 100644 index 00000000000..f35e5119d58 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/ElementalMastery.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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public class ElementalMastery extends CardImpl { + + public ElementalMastery(UUID ownerId) { + super(ownerId, 90, "Elemental Mastery", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Aura"); + + this.color.setRed(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature has "{tap}: Put X 1/1 red Elemental creature tokens with haste onto the battlefield, where X is this creature's power. Exile them at the beginning of the next end step." + Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ElementalMasteryEffect(), new TapSourceCost()); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability2, AttachmentType.AURA))); + + } + + public ElementalMastery(final ElementalMastery card) { + super(card); + } + + @Override + public ElementalMastery copy() { + return new ElementalMastery(this); + } +} + +class ElementalMasteryEffect extends OneShotEffect { + + public ElementalMasteryEffect() { + super(Outcome.Benefit); + staticText = "Put X 1/1 red Elemental creature tokens with haste onto the battlefield, where X is this creature's power. Exile them at the beginning of the next end step"; + } + + public ElementalMasteryEffect(final ElementalMasteryEffect effect) { + super(effect); + } + + @Override + public ElementalMasteryEffect copy() { + return new ElementalMasteryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent creatureAttached = game.getPermanent(source.getSourceId()); + if (creatureAttached != null) { + int power = creatureAttached.getPower().getValue(); + for (int i = 0; i < power; i++) { + ElementalToken token = new ElementalToken(); + token.putOntoBattlefield(1, game, creatureAttached.getId(), creatureAttached.getControllerId()); + ExileTargetEffect exileEffect = new ExileTargetEffect("exile the token"); + exileEffect.setTargetPointer(new FixedTarget(token.getLastAddedToken())); + DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(exileEffect); + delayedAbility.setSourceId(creatureAttached.getId()); + delayedAbility.setControllerId(creatureAttached.getControllerId()); + game.addDelayedTriggeredAbility(delayedAbility); + } + return true; + } + return false; + } +} + +class ElementalToken extends Token { + + public ElementalToken() { + super("Elemental", "1/1 red Elemental creature token with haste"); + cardType.add(CardType.CREATURE); + subtype.add("Elemental"); + color.setRed(true); + power = new MageInt(1); + toughness = new MageInt(1); + addAbility(HasteAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/EmberGale.java b/Mage.Sets/src/mage/sets/shadowmoor/EmberGale.java new file mode 100644 index 00000000000..8dff834f788 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/EmberGale.java @@ -0,0 +1,116 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.combat.CantBlockAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPlayer; + +/** + * + * @author jeffwadsworth + */ +public class EmberGale extends CardImpl { + + public EmberGale(UUID ownerId) { + super(ownerId, 91, "Ember Gale", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{R}"); + this.expansionSetCode = "SHM"; + + this.color.setRed(true); + + // Creatures target player controls can't block this turn. Ember Gale deals 1 damage to each white and/or blue creature that player controls. + this.getSpellAbility().addTarget(new TargetPlayer()); + this.getSpellAbility().addEffect(new EmberGaleEffect()); + + } + + public EmberGale(final EmberGale card) { + super(card); + } + + @Override + public EmberGale copy() { + return new EmberGale(this); + } +} + +class EmberGaleEffect extends OneShotEffect { + + public EmberGaleEffect() { + super(Outcome.Detriment); + staticText = "Creatures target player controls can't block this turn. {this} deals 1 damage to each white and/or blue creature that player controls"; + } + + public EmberGaleEffect(final EmberGaleEffect effect) { + super(effect); + } + + @Override + public EmberGaleEffect copy() { + return new EmberGaleEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + if (targetPlayer != null) { + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(new ControllerIdPredicate(targetPlayer.getId())); + RestrictionEffect effect = new CantBlockAllEffect(filter, Duration.EndOfTurn); + game.addEffect(effect, source); + FilterPermanent filter2 = new FilterPermanent(); + filter2.add(new ControllerIdPredicate(targetPlayer.getId())); + filter2.add(Predicates.or(new ColorPredicate(ObjectColor.WHITE), + new ColorPredicate(ObjectColor.BLUE))); + filter2.add(new CardTypePredicate(CardType.CREATURE)); + for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter2, targetPlayer.getId(), game)) { + creature.damage(1, source.getSourceId(), game, true, false); + } + return true; + } + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java index d5d088faa8e..f9bdd4d4811 100644 --- a/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java @@ -32,10 +32,12 @@ import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.game.Game; import mage.players.Player; +import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; /** @@ -46,6 +48,7 @@ public class DiscardTargetEffect extends OneShotEffect { protected DynamicValue amount; protected boolean randomDiscard; + protected boolean setTargetPointer; public DiscardTargetEffect(DynamicValue amount) { this(amount, false); @@ -64,11 +67,19 @@ public class DiscardTargetEffect extends OneShotEffect { public DiscardTargetEffect(int amount, boolean randomDiscard) { this(new StaticValue(amount), randomDiscard); } + + public DiscardTargetEffect(int amount, boolean randomDiscard, boolean setTargetPointer) { + super(Outcome.Discard); + this.randomDiscard = randomDiscard; + this.amount = new StaticValue(amount); + this.setTargetPointer = setTargetPointer; + } public DiscardTargetEffect(final DiscardTargetEffect effect) { super(effect); this.amount = effect.amount.copy(); this.randomDiscard = effect.randomDiscard; + this.setTargetPointer = effect.setTargetPointer; } @Override @@ -86,6 +97,11 @@ public class DiscardTargetEffect extends OneShotEffect { Card card = player.getHand().getRandom(game); if (card != null) { player.discard(card, source, game); + if (setTargetPointer) { + for (Effect effect : source.getEffects()) { + effect.setTargetPointer(new FixedTarget(card.getId())); + } + } } } } else {