From bcc4afc048a5dd0e1b86685eb679c3126275a7b7 Mon Sep 17 00:00:00 2001 From: spjspj Date: Sat, 14 Jan 2017 20:08:07 +1100 Subject: [PATCH] spjspj - Add Razia's Purification (RAV) --- .../src/mage/cards/r/RaziasPurification.java | 118 ++++++++++++++++++ .../src/mage/sets/RavnicaCityOfGuilds.java | 1 + 2 files changed, 119 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RaziasPurification.java diff --git a/Mage.Sets/src/mage/cards/r/RaziasPurification.java b/Mage.Sets/src/mage/cards/r/RaziasPurification.java new file mode 100644 index 0000000000..1ec8465bfb --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RaziasPurification.java @@ -0,0 +1,118 @@ +/* + * 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.cards.r; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author spjspj + */ +public class RaziasPurification extends CardImpl { + + public RaziasPurification(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}{W}"); + + // Each player chooses three permanents he or she controls, then sacrifices the rest. + this.getSpellAbility().addEffect(new RaziasPurificationEffect()); + } + + public RaziasPurification(final RaziasPurification card) { + super(card); + } + + @Override + public RaziasPurification copy() { + return new RaziasPurification(this); + } +} + +class RaziasPurificationEffect extends OneShotEffect { + + public RaziasPurificationEffect() { + super(Outcome.DestroyPermanent); + staticText = "Each player chooses three permanents he or she controls, then sacrifices the rest"; + } + + public RaziasPurificationEffect(RaziasPurificationEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + List chosen = new ArrayList<>(); + + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + + Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledPermanent(), true); + + if (target1.canChoose(player.getId(), game)) { + int chosenPermanents = 0; + while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game) && chosenPermanents < 3) { + player.chooseTarget(Outcome.Benefit, target1, source, game); + for (UUID targetId : target1.getTargets()) { + Permanent p = game.getPermanent(targetId); + if (p != null) { + chosen.add(p); + chosenPermanents++; + } + } + target1.clearChosen(); + } + } + } + + for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { + if (!chosen.contains(permanent)) { + permanent.sacrifice(source.getSourceId(), game); + } + } + return true; + } + + @Override + public RaziasPurificationEffect copy() { + return new RaziasPurificationEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java b/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java index da6ff9f9b8..a731b42901 100644 --- a/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java +++ b/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java @@ -240,6 +240,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet { cards.add(new SetCardInfo("Putrefy", 221, Rarity.UNCOMMON, mage.cards.p.Putrefy.class)); cards.add(new SetCardInfo("Rain of Embers", 138, Rarity.COMMON, mage.cards.r.RainOfEmbers.class)); cards.add(new SetCardInfo("Rally the Righteous", 222, Rarity.COMMON, mage.cards.r.RallyTheRighteous.class)); + cards.add(new SetCardInfo("Razia's Purification", 224, Rarity.RARE, mage.cards.r.RaziasPurification.class)); cards.add(new SetCardInfo("Razia, Boros Archangel", 223, Rarity.RARE, mage.cards.r.RaziaBorosArchangel.class)); cards.add(new SetCardInfo("Recollect", 178, Rarity.UNCOMMON, mage.cards.r.Recollect.class)); cards.add(new SetCardInfo("Remand", 63, Rarity.UNCOMMON, mage.cards.r.Remand.class));