diff --git a/Mage.Sets/src/mage/sets/magic2010/Ponder.java b/Mage.Sets/src/mage/sets/magic2010/Ponder.java new file mode 100644 index 0000000000..477219e78b --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2010/Ponder.java @@ -0,0 +1,130 @@ +/* + * 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.magic2010; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; + +/** + * @author nantuko + */ +public class Ponder extends CardImpl { + + public Ponder(UUID ownerId) { + super(ownerId, 68, "Ponder", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{U}"); + this.expansionSetCode = "M10"; + + this.color.setBlue(true); + + // Look at the top three cards of your library, then put them back in any order. You may shuffle your library. + this.getSpellAbility().addEffect(new PonderEffect()); + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardControllerEffect(1)); + } + + public Ponder(final Ponder card) { + super(card); + } + + @Override + public Ponder copy() { + return new Ponder(this); + } +} + +class PonderEffect extends OneShotEffect { + + protected static FilterCard filter = new FilterCard("card to put on the top of your library"); + + public PonderEffect() { + super(Constants.Outcome.Benefit); + staticText = "Look at the top three cards of your library, then put them back in any order. You may shuffle your library"; + } + + public PonderEffect(final PonderEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Cards cards = new CardsImpl(Constants.Zone.PICK); + int count = Math.min(3, player.getLibrary().size()); + if (count == 0) { + return false; + } + for (int i = 0; i < count; i++) { + Card card = player.getLibrary().removeFromTop(game); + if (card != null) { + cards.add(card); + } + game.setZone(card.getId(), Constants.Zone.PICK); + } + if (cards.size() > 1) { + TargetCard target2 = new TargetCard(Constants.Zone.PICK, filter); + target2.setRequired(true); + while (cards.size() > 1) { + player.choose(Constants.Outcome.Benefit, cards, target2, game); + Card card = cards.get(target2.getFirstTarget(), game); + if (card != null) { + cards.remove(card); + card.moveToZone(Constants.Zone.LIBRARY, source.getId(), game, true); + } + target2.clearChosen(); + } + } + if (cards.size() == 1) { + Card card = cards.get(cards.iterator().next(), game); + card.moveToZone(Constants.Zone.LIBRARY, source.getId(), game, true); + } + if (player.chooseUse(Constants.Outcome.Benefit, "Shuffle you library?", game)) { + player.shuffleLibrary(game); + } + return true; + } + + @Override + public PonderEffect copy() { + return new PonderEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/magic2012/PersonalSanctuary.java b/Mage.Sets/src/mage/sets/magic2012/PersonalSanctuary.java new file mode 100644 index 0000000000..578f66934c --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2012/PersonalSanctuary.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.magic2012; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.PreventionEffectImpl; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author nantuko + */ +public class PersonalSanctuary extends CardImpl { + + public PersonalSanctuary(UUID ownerId) { + super(ownerId, 30, "Personal Sanctuary", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); + this.expansionSetCode = "M12"; + + this.color.setWhite(true); + + // During your turn, prevent all damage that would be dealt to you. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new PersonalSanctuaryEffect())); + } + + public PersonalSanctuary(final PersonalSanctuary card) { + super(card); + } + + @Override + public PersonalSanctuary copy() { + return new PersonalSanctuary(this); + } +} + +class PersonalSanctuaryEffect extends PreventionEffectImpl { + + public PersonalSanctuaryEffect() { + super(Constants.Duration.WhileOnBattlefield); + staticText = "During your turn, prevent all damage that would be dealt to you"; + } + + public PersonalSanctuaryEffect(PersonalSanctuaryEffect effect) { + super(effect); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false); + if (!game.replaceEvent(preventEvent)) { + int damage = event.getAmount(); + event.setAmount(0); + game.informPlayers("Damage has been prevented: " + damage); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage)); + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)) { + if (event.getTargetId().equals(source.getControllerId()) && game.getActivePlayerId().equals(source.getControllerId())) + return super.applies(event, source, game); + } + return false; + } + + @Override + public PersonalSanctuaryEffect copy() { + return new PersonalSanctuaryEffect(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magic2012/Ponder.java b/Mage.Sets/src/mage/sets/magic2012/Ponder.java new file mode 100644 index 0000000000..2707f740c2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2012/Ponder.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.magic2012; + +import java.util.UUID; + +/** + * + * @author nantuko + */ +public class Ponder extends mage.sets.magic2010.Ponder { + + public Ponder(UUID ownerId) { + super(ownerId); + this.cardNumber = 73; + this.expansionSetCode = "M12"; + } + + public Ponder(final Ponder card) { + super(card); + } + + @Override + public Ponder copy() { + return new Ponder(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2012/StonehornDignitary.java b/Mage.Sets/src/mage/sets/magic2012/StonehornDignitary.java new file mode 100644 index 0000000000..8c5a1ef62d --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2012/StonehornDignitary.java @@ -0,0 +1,106 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magic2012; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.combat.Combat; +import mage.game.turn.CombatPhase; +import mage.game.turn.TurnMod; +import mage.target.Target; +import mage.target.common.TargetOpponent; + +/** + * + * @author nantuko + */ +public class StonehornDignitary extends CardImpl { + + public StonehornDignitary(UUID ownerId) { + super(ownerId, 37, "Stonehorn Dignitary", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{W}"); + this.expansionSetCode = "M12"; + this.subtype.add("Rhino"); + this.subtype.add("Soldier"); + + this.color.setWhite(true); + this.power = new MageInt(1); + this.toughness = new MageInt(4); + + // When Stonehorn Dignitary enters the battlefield, target opponent skips his or her next combat phase. + Ability ability = new EntersBattlefieldTriggeredAbility(new SkipNextCombatEffect()); + Target target = new TargetOpponent(); + target.setRequired(true); + ability.addTarget(target); + this.addAbility(ability); + } + + public StonehornDignitary(final StonehornDignitary card) { + super(card); + } + + @Override + public StonehornDignitary copy() { + return new StonehornDignitary(this); + } +} + +class SkipNextCombatEffect extends OneShotEffect { + + public SkipNextCombatEffect() { + super(Constants.Outcome.Detriment); + staticText = "target opponent skips his or her next combat phase"; + } + + public SkipNextCombatEffect(SkipNextCombatEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID targetId = source.getFirstTarget(); + if (targetId != null) { + game.getState().getTurnMods().add(new TurnMod(targetId, Constants.TurnPhase.COMBAT, null, true)); + return true; + } + return false; + } + + @Override + public SkipNextCombatEffect copy() { + return new SkipNextCombatEffect(); + } +}