From 794995f9f0c4c9d6b4a11aacb1ebb758bb94091e Mon Sep 17 00:00:00 2001 From: Michael Ludwig Date: Sun, 14 Jul 2013 02:40:35 -0400 Subject: [PATCH] Added Edric, Spymaster of Trest and Wheel of Fortune. Added DiscardHandAllEffect for future use. --- .../sets/commander/EdricSpymasterOfTrest.java | 109 ++++++++++++++++++ .../sets/limitedalpha/WheelOfFortune.java | 61 ++++++++++ .../mage/sets/limitedbeta/WheelOfFortune.java | 51 ++++++++ .../sets/revisededition/WheelOfFortune.java | 51 ++++++++ .../sets/unlimitededition/WheelOfFortune.java | 51 ++++++++ .../src/mage/sets/zendikar/ChandraAblaze.java | 35 +----- .../common/discard/DiscardHandAllEffect.java | 72 ++++++++++++ 7 files changed, 397 insertions(+), 33 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java create mode 100644 Mage.Sets/src/mage/sets/limitedalpha/WheelOfFortune.java create mode 100644 Mage.Sets/src/mage/sets/limitedbeta/WheelOfFortune.java create mode 100644 Mage.Sets/src/mage/sets/revisededition/WheelOfFortune.java create mode 100644 Mage.Sets/src/mage/sets/unlimitededition/WheelOfFortune.java create mode 100644 Mage/src/mage/abilities/effects/common/discard/DiscardHandAllEffect.java diff --git a/Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java b/Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java new file mode 100644 index 0000000000..23015a1896 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java @@ -0,0 +1,109 @@ +/* + * 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.commander; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.target.targetpointer.FixedTarget; + +/** + * @author mluds + */ +public class EdricSpymasterOfTrest extends CardImpl { + + public EdricSpymasterOfTrest(UUID ownerId) { + super(ownerId, 196, "Edric, Spymaster of Trest", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G}{U}"); + this.expansionSetCode = "CMD"; + this.supertype.add("Legendary"); + this.subtype.add("Elf"); + this.subtype.add("Rogue"); + + this.color.setBlue(true); + this.color.setGreen(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Whenever a creature deals combat damage to one of your opponents, its controller may draw a card. + this.addAbility(new EdricSpymasterOfTrestTriggeredAbility()); + } + + public EdricSpymasterOfTrest(final EdricSpymasterOfTrest card) { + super(card); + } + + @Override + public EdricSpymasterOfTrest copy() { + return new EdricSpymasterOfTrest(this); + } + + public static class EdricSpymasterOfTrestTriggeredAbility extends TriggeredAbilityImpl { + + public EdricSpymasterOfTrestTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardTargetEffect(1), true); + } + + public EdricSpymasterOfTrestTriggeredAbility(final EdricSpymasterOfTrestTriggeredAbility ability) { + super(ability); + } + + @Override + public EdricSpymasterOfTrestTriggeredAbility copy() { + return new EdricSpymasterOfTrestTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + + if (event.getType().equals(EventType.DAMAGED_PLAYER) && + ((DamagedPlayerEvent) event).isCombatDamage() && + game.getOpponents(this.controllerId).contains(((DamagedPlayerEvent) event).getPlayerId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getPermanent(event.getSourceId()).getControllerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever a creature deals combat damage to one of your opponents, its controller may draw a card"; + } + } +} diff --git a/Mage.Sets/src/mage/sets/limitedalpha/WheelOfFortune.java b/Mage.Sets/src/mage/sets/limitedalpha/WheelOfFortune.java new file mode 100644 index 0000000000..299fe0c581 --- /dev/null +++ b/Mage.Sets/src/mage/sets/limitedalpha/WheelOfFortune.java @@ -0,0 +1,61 @@ +/* + * 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.limitedalpha; + +import java.util.UUID; +import mage.abilities.effects.common.DrawCardAllEffect; +import mage.abilities.effects.common.discard.DiscardHandAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * @author mluds + */ +public class WheelOfFortune extends CardImpl { + + public WheelOfFortune(UUID ownerId) { + super(ownerId, 184, "Wheel of Fortune", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{R}"); + this.expansionSetCode = "LEA"; + + this.color.setRed(true); + + // Each player discards his or her hand and draws seven cards. + this.getSpellAbility().addEffect(new DiscardHandAllEffect()); + this.getSpellAbility().addEffect(new DrawCardAllEffect(7)); + } + + public WheelOfFortune(final WheelOfFortune card) { + super(card); + } + + @Override + public WheelOfFortune copy() { + return new WheelOfFortune(this); + } +} diff --git a/Mage.Sets/src/mage/sets/limitedbeta/WheelOfFortune.java b/Mage.Sets/src/mage/sets/limitedbeta/WheelOfFortune.java new file mode 100644 index 0000000000..62dd279555 --- /dev/null +++ b/Mage.Sets/src/mage/sets/limitedbeta/WheelOfFortune.java @@ -0,0 +1,51 @@ +/* + * 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.limitedbeta; + +import java.util.UUID; + +/** + * @author mluds + */ +public class WheelOfFortune extends mage.sets.limitedalpha.WheelOfFortune { + + public WheelOfFortune(UUID ownerId) { + super(ownerId); + this.cardNumber = 185; + this.expansionSetCode = "LEB"; + } + + public WheelOfFortune(final WheelOfFortune card) { + super(card); + } + + @Override + public WheelOfFortune copy() { + return new WheelOfFortune(this); + } +} diff --git a/Mage.Sets/src/mage/sets/revisededition/WheelOfFortune.java b/Mage.Sets/src/mage/sets/revisededition/WheelOfFortune.java new file mode 100644 index 0000000000..1b082d7b7c --- /dev/null +++ b/Mage.Sets/src/mage/sets/revisededition/WheelOfFortune.java @@ -0,0 +1,51 @@ +/* + * 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.revisededition; + +import java.util.UUID; + +/** + * @author mluds + */ +public class WheelOfFortune extends mage.sets.limitedalpha.WheelOfFortune { + + public WheelOfFortune(UUID ownerId) { + super(ownerId); + this.cardNumber = 184; + this.expansionSetCode = "3ED"; + } + + public WheelOfFortune(final WheelOfFortune card) { + super(card); + } + + @Override + public WheelOfFortune copy() { + return new WheelOfFortune(this); + } +} diff --git a/Mage.Sets/src/mage/sets/unlimitededition/WheelOfFortune.java b/Mage.Sets/src/mage/sets/unlimitededition/WheelOfFortune.java new file mode 100644 index 0000000000..9cd49a2515 --- /dev/null +++ b/Mage.Sets/src/mage/sets/unlimitededition/WheelOfFortune.java @@ -0,0 +1,51 @@ +/* + * 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.unlimitededition; + +import java.util.UUID; + +/** + * @author mluds + */ +public class WheelOfFortune extends mage.sets.limitedalpha.WheelOfFortune { + + public WheelOfFortune(UUID ownerId) { + super(ownerId); + this.cardNumber = 184; + this.expansionSetCode = "2ED"; + } + + public WheelOfFortune(final WheelOfFortune card) { + super(card); + } + + @Override + public WheelOfFortune copy() { + return new WheelOfFortune(this); + } +} diff --git a/Mage.Sets/src/mage/sets/zendikar/ChandraAblaze.java b/Mage.Sets/src/mage/sets/zendikar/ChandraAblaze.java index 0a5d005b37..ded047b432 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ChandraAblaze.java +++ b/Mage.Sets/src/mage/sets/zendikar/ChandraAblaze.java @@ -39,6 +39,7 @@ import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardAllEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.discard.DiscardHandAllEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.counters.CounterType; @@ -74,7 +75,7 @@ public class ChandraAblaze extends CardImpl { ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); // -2: Each player discards his or her hand, then draws three cards. - ability = new LoyaltyAbility(new ChandraAblazeEffect3(), -2); + ability = new LoyaltyAbility(new DiscardHandAllEffect(), -2); ability.addEffect(new ChandraAblazeEffect4()); this.addAbility(ability); // -7: Cast any number of red instant and/or sorcery cards from your graveyard without paying their mana costs. @@ -162,38 +163,6 @@ class ChandraAblazeEffect2 extends OneShotEffect { } } -class ChandraAblazeEffect3 extends OneShotEffect { - - public ChandraAblazeEffect3() { - super(Outcome.Benefit); - this.staticText = "Each player discards his or her hand"; - } - - public ChandraAblazeEffect3(final ChandraAblazeEffect3 effect) { - super(effect); - } - - @Override - public ChandraAblazeEffect3 copy() { - return new ChandraAblazeEffect3(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player sourcePlayer = game.getPlayer(source.getControllerId()); - for (UUID playerId : sourcePlayer.getInRange()) { - Player player = game.getPlayer(playerId); - if (player != null) { - Set cards = player.getHand().getCards(game); - for (Card card : cards) { - player.discard(card, source, game); - } - } - } - return true; - } -} - class ChandraAblazeEffect4 extends DrawCardAllEffect { public ChandraAblazeEffect4() { diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardHandAllEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardHandAllEffect.java new file mode 100644 index 0000000000..0e89973faa --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardHandAllEffect.java @@ -0,0 +1,72 @@ +/* + * 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.abilities.effects.common.discard; + +import java.util.Set; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +/** + * @author mluds + */ +public class DiscardHandAllEffect extends OneShotEffect { + + public DiscardHandAllEffect() { + super(Outcome.Discard); + this.staticText = "Each player discards his or her hand"; + } + + public DiscardHandAllEffect(final DiscardHandAllEffect effect) { + super(effect); + } + + @Override + public DiscardHandAllEffect copy() { + return new DiscardHandAllEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player sourcePlayer = game.getPlayer(source.getControllerId()); + for (UUID playerId : sourcePlayer.getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) { + Set cards = player.getHand().getCards(game); + for (Card card : cards) { + player.discard(card, source, game); + } + } + } + return true; + } +}