From ef79d70620110a6a80f2950b2aadfe0278972dc9 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 4 Mar 2015 17:40:08 -0600 Subject: [PATCH] - Added Jaws of Stone, Knollspine Dragon, Initimidator Initiate. There are 2 more cards in Shadowmoor in anyone wants to finish knocking out the set. --- .../mage/sets/mirrodin/ExtraplanarLens.java | 5 +- .../sets/shadowmoor/IntimidatorInitiate.java | 79 ++++++++++++ .../src/mage/sets/shadowmoor/JawsOfStone.java | 76 ++++++++++++ .../sets/shadowmoor/KnollspineDragon.java | 116 ++++++++++++++++++ .../src/mage/sets/shadowmoor/Valleymaker.java | 3 +- .../common/SimpleActivatedAbility.java | 5 - ...fDamageAPlayerReceivedThisTurnWatcher.java | 94 ++++++++++++++ 7 files changed, 369 insertions(+), 9 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/IntimidatorInitiate.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/JawsOfStone.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/KnollspineDragon.java create mode 100644 Mage/src/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java diff --git a/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java b/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java index dc703c4389b..26fabac7db1 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java @@ -29,11 +29,11 @@ package mage.sets.mirrodin; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AddManaOfAnyTypeProducedEffect; +import mage.abilities.mana.TriggeredManaAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; @@ -125,11 +125,10 @@ class ExtraplanarLensImprintEffect extends OneShotEffect { } -class ExtraplanarLensTriggeredAbility extends TriggeredAbilityImpl { +class ExtraplanarLensTriggeredAbility extends TriggeredManaAbility { public ExtraplanarLensTriggeredAbility() { super(Zone.BATTLEFIELD, new AddManaOfAnyTypeProducedEffect()); - this.usesStack = false; } public ExtraplanarLensTriggeredAbility(final ExtraplanarLensTriggeredAbility ability) { diff --git a/Mage.Sets/src/mage/sets/shadowmoor/IntimidatorInitiate.java b/Mage.Sets/src/mage/sets/shadowmoor/IntimidatorInitiate.java new file mode 100644 index 00000000000..4fce9d48f41 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/IntimidatorInitiate.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.MageInt; +import mage.ObjectColor; +import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.combat.CantBlockTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.ColorPredicate; + +/** + * + * @author jeffwadsworth + */ +public class IntimidatorInitiate extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("red spell"); + + static { + filter.add(new ColorPredicate(ObjectColor.RED)); + } + + private static final String rule = "Whenever a player casts a red spell, you may pay {1}. If you do, target creature can't block this turn"; + + public IntimidatorInitiate(UUID ownerId) { + super(ownerId, 96, "Intimidator Initiate", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Goblin"); + this.subtype.add("Shaman"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever a player casts a red spell, you may pay {1}. If you do, target creature can't block this turn. + this.addAbility(new SpellCastAllTriggeredAbility(new DoIfCostPaid(new CantBlockTargetEffect(Duration.EndOfTurn), new GenericManaCost(1)), filter, true, rule)); + + } + + public IntimidatorInitiate(final IntimidatorInitiate card) { + super(card); + } + + @Override + public IntimidatorInitiate copy() { + return new IntimidatorInitiate(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/JawsOfStone.java b/Mage.Sets/src/mage/sets/shadowmoor/JawsOfStone.java new file mode 100644 index 00000000000..016c4217779 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/JawsOfStone.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.shadowmoor; + +import java.util.UUID; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageMultiEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.common.TargetCreatureOrPlayerAmount; + +/** + * + * @author jeffwadsworth + */ +public class JawsOfStone extends CardImpl { + + static final private FilterControlledLandPermanent filter = new FilterControlledLandPermanent("mountains you control"); + + static { + filter.add(new SubtypePredicate("Mountain")); + } + + static final private String rule = "{this} deals X damage divided as you choose among any number of target creatures and/or players, where X is the number of Mountains you control as you cast {this}"; + + public JawsOfStone(UUID ownerId) { + super(ownerId, 97, "Jaws of Stone", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{5}{R}"); + this.expansionSetCode = "SHM"; + + // Jaws of Stone deals X damage divided as you choose among any number of target creatures and/or players, where X is the number of Mountains you control as you cast Jaws of Stone. + PermanentsOnBattlefieldCount mountains = new PermanentsOnBattlefieldCount(filter, null); + Effect effect = new DamageMultiEffect(mountains); + effect.setText(rule); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreatureOrPlayerAmount(mountains)); + + } + + public JawsOfStone(final JawsOfStone card) { + super(card); + } + + @Override + public JawsOfStone copy() { + return new JawsOfStone(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/KnollspineDragon.java b/Mage.Sets/src/mage/sets/shadowmoor/KnollspineDragon.java new file mode 100644 index 00000000000..6abdaa0a548 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/KnollspineDragon.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.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.discard.DiscardHandControllerEffect; +import mage.abilities.keyword.FlyingAbility; +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.common.TargetOpponent; +import mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher; + +/** + * + * @author jeffwadsworth + */ +public class KnollspineDragon extends CardImpl { + + public KnollspineDragon(UUID ownerId) { + super(ownerId, 98, "Knollspine Dragon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}{R}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Dragon"); + this.power = new MageInt(7); + this.toughness = new MageInt(5); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Knollspine Dragon enters the battlefield, you may discard your hand and draw cards equal to the damage dealt to target opponent this turn. + Ability ability = new EntersBattlefieldTriggeredAbility(new KnollspineDragonEffect(), true); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability, new AmountOfDamageAPlayerReceivedThisTurnWatcher()); + + } + + public KnollspineDragon(final KnollspineDragon card) { + super(card); + } + + @Override + public KnollspineDragon copy() { + return new KnollspineDragon(this); + } +} + +class KnollspineDragonEffect extends OneShotEffect { + + public KnollspineDragonEffect() { + super(Outcome.Neutral); + staticText = "you may discard your hand and draw cards equal to the damage dealt to target opponent this turn"; + } + + public KnollspineDragonEffect(KnollspineDragonEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player targetOpponent = game.getPlayer(targetPointer.getFirst(game, source)); + if (controller != null) { + new DiscardHandControllerEffect().apply(game, source); + if (targetOpponent != null) { + AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn"); + if (watcher != null) { + int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId()); + controller.drawCards(drawAmount, game); + game.informPlayers(controller.getName() + "draws " + drawAmount + " cards"); + return true; + } + } + game.informPlayers(controller.getName() + "drew no cards"); + return true; + } + return false; + } + + @Override + public KnollspineDragonEffect copy() { + return new KnollspineDragonEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java b/Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java index 3bf42bef6b4..8cc7c134905 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java @@ -36,6 +36,7 @@ import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect; import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; @@ -74,7 +75,7 @@ public class Valleymaker extends CardImpl { this.addAbility(ability); // {tap}, Sacrifice a Forest: Choose a player. That player adds {G}{G}{G} to his or her mana pool. - Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(new Mana(0,3,0,0,0,0,0), "chosen player"), new TapSourceCost(), false); + Ability ability2 = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(new Mana(0,3,0,0,0,0,0), "chosen player"), new TapSourceCost()); ability2.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter2))); ability2.addTarget(new TargetPlayer(1, 1, true)); this.addAbility(ability2); diff --git a/Mage/src/mage/abilities/common/SimpleActivatedAbility.java b/Mage/src/mage/abilities/common/SimpleActivatedAbility.java index 980428b840b..9b9b93d93d4 100644 --- a/Mage/src/mage/abilities/common/SimpleActivatedAbility.java +++ b/Mage/src/mage/abilities/common/SimpleActivatedAbility.java @@ -52,11 +52,6 @@ public class SimpleActivatedAbility extends ActivatedAbilityImpl { public SimpleActivatedAbility(Zone zone, Effect effect, Cost cost) { super(zone, effect, cost); } - - public SimpleActivatedAbility(Zone zone, Effect effect, Cost cost, boolean usesStack) { - super(zone, effect, cost); - this.usesStack = usesStack; - } public SimpleActivatedAbility(SimpleActivatedAbility ability) { super(ability); diff --git a/Mage/src/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java b/Mage/src/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java new file mode 100644 index 00000000000..027063ccfaa --- /dev/null +++ b/Mage/src/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java @@ -0,0 +1,94 @@ +/* + * 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.watchers.common; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.UUID; +import mage.constants.WatcherScope; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.watchers.Watcher; + +/** + * + * @author jeffwadsworth + * + * Amount of damage received by a player this turn + * + */ +public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher { + + private final Map amountOfDamageReceivedThisTurn = new HashMap<>(); + + public AmountOfDamageAPlayerReceivedThisTurnWatcher() { + super("AmountOfDamageReceivedThisTurn", WatcherScope.GAME); + } + + public AmountOfDamageAPlayerReceivedThisTurnWatcher(final AmountOfDamageAPlayerReceivedThisTurnWatcher watcher) { + super(watcher); + for (Entry entry : watcher.amountOfDamageReceivedThisTurn.entrySet()) { + amountOfDamageReceivedThisTurn.put(entry.getKey(), entry.getValue()); + } + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { + UUID playerId = event.getTargetId(); + if (playerId != null) { + Integer amount = amountOfDamageReceivedThisTurn.get(playerId); + if (amount == null) { + amount = Integer.valueOf(event.getAmount()); + } else { + amount = Integer.valueOf(amount + event.getAmount()); + } + amountOfDamageReceivedThisTurn.put(playerId, amount); + } + } + } + + public int getAmountOfDamageReceivedThisTurn(UUID playerId) { + Integer amount = amountOfDamageReceivedThisTurn.get(playerId); + if (amount != null) { + return amount; + } + return 0; + } + + @Override + public void reset() { + amountOfDamageReceivedThisTurn.clear(); + } + + @Override + public AmountOfDamageAPlayerReceivedThisTurnWatcher copy() { + return new AmountOfDamageAPlayerReceivedThisTurnWatcher(this); + } +}