From 103f2f48832217f31df6086e25ce7bb9d2f137af Mon Sep 17 00:00:00 2001 From: emerald000 Date: Thu, 5 Feb 2015 18:43:34 -0500 Subject: [PATCH] Added Phantom Flock and Realm Seekers. --- .../mage/sets/conspiracy/RealmSeekers.java | 84 ++++++++++ .../src/mage/sets/judgment/PhantomFlock.java | 151 ++++++++++++++++++ .../sets/urzaslegacy/MultaniMaroSorcerer.java | 43 +---- .../sets/vintagemasters/RealmSeekers.java | 52 ++++++ .../common/CardsInAllHandsCount.java | 70 ++++++++ 5 files changed, 361 insertions(+), 39 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/conspiracy/RealmSeekers.java create mode 100644 Mage.Sets/src/mage/sets/judgment/PhantomFlock.java create mode 100644 Mage.Sets/src/mage/sets/vintagemasters/RealmSeekers.java create mode 100644 Mage/src/mage/abilities/dynamicvalue/common/CardsInAllHandsCount.java diff --git a/Mage.Sets/src/mage/sets/conspiracy/RealmSeekers.java b/Mage.Sets/src/mage/sets/conspiracy/RealmSeekers.java new file mode 100644 index 00000000000..49c343b7ece --- /dev/null +++ b/Mage.Sets/src/mage/sets/conspiracy/RealmSeekers.java @@ -0,0 +1,84 @@ +/* + * 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.conspiracy; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveCountersSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.CardsInAllHandsCount; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterLandCard; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author emerald000 + */ +public class RealmSeekers extends CardImpl { + + public RealmSeekers(UUID ownerId) { + super(ownerId, 38, "Realm Seekers", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); + this.expansionSetCode = "CNS"; + this.subtype.add("Elf"); + this.subtype.add("Scout"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Realm Seekers enters the battlefield with X +1/+1 counters on it, where X is the total number of cards in all players' hands. + this.addAbility(new EntersBattlefieldAbility( + new AddCountersSourceEffect( + CounterType.P1P1.createInstance(), + new CardsInAllHandsCount(), + false), + "with X +1/+1 counters on it, where X is the total number of cards in all players' hands")); + + // {2}{G}, Remove a +1/+1 counter from Realm Seekers: Search your library for a land card, reveal it, put it into your hand, then shuffle your library. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterLandCard()), true), new ManaCostsImpl<>("{2}{G}")); + ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance())); + this.addAbility(ability); + } + + public RealmSeekers(final RealmSeekers card) { + super(card); + } + + @Override + public RealmSeekers copy() { + return new RealmSeekers(this); + } +} diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java b/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java new file mode 100644 index 00000000000..e52cd707ad1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java @@ -0,0 +1,151 @@ +/* + * 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.judgment; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.PhaseStep; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.turn.Step; + +/** + * + * @author emerald000 + */ +public class PhantomFlock extends CardImpl { + + public PhantomFlock(UUID ownerId) { + super(ownerId, 16, "Phantom Flock", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{W}{W}"); + this.expansionSetCode = "JUD"; + this.subtype.add("Bird"); + this.subtype.add("Soldier"); + this.subtype.add("Spirit"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Phantom Flock enters the battlefield with three +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)))); + + // If damage would be dealt to Phantom Flock, prevent that damage. Remove a +1/+1 counter from Phantom Flock. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomFlockPreventionEffect())); + } + + public PhantomFlock(final PhantomFlock card) { + super(card); + } + + @Override + public PhantomFlock copy() { + return new PhantomFlock(this); + } +} + +class PhantomFlockPreventionEffect extends PreventionEffectImpl { + + // remember turn and phase step to check if counter in this step was already removed + private int turn = 0; + private Step combatPhaseStep = null; + + PhantomFlockPreventionEffect() { + super(Duration.WhileOnBattlefield); + staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; + } + + PhantomFlockPreventionEffect(final PhantomFlockPreventionEffect effect) { + super(effect); + this.turn = effect.turn; + this.combatPhaseStep = effect.combatPhaseStep; + } + + @Override + public PhantomFlockPreventionEffect copy() { + return new PhantomFlockPreventionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + preventDamageAction(event, source, game); + + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + boolean removeCounter = true; + // check if in the same combat damage step already a counter was removed + if (game.getTurn().getPhase().getStep().getType().equals(PhaseStep.COMBAT_DAMAGE)) { + if (game.getTurnNum() == turn + && game.getTurn().getStep().equals(combatPhaseStep)) { + removeCounter = false; + } else { + turn = game.getTurnNum(); + combatPhaseStep = game.getTurn().getStep(); + } + } + + if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); + permanent.removeCounters(CounterType.P1P1.createInstance(), game); + sb.append("Removed a +1/+1 counter "); + game.informPlayers(sb.toString()); + } + } + + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (super.applies(event, source, game)) { + if (event.getTargetId().equals(source.getSourceId())) { + return true; + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java b/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java index 9dd29ecf2f6..cc9a899e45d 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java @@ -27,11 +27,10 @@ */ package mage.sets.urzaslegacy; +import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.Effect; +import mage.abilities.dynamicvalue.common.CardsInAllHandsCount; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.abilities.keyword.ShroudAbility; import mage.cards.CardImpl; @@ -39,10 +38,6 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; -import mage.players.Player; - -import java.util.UUID; /** * @@ -56,14 +51,14 @@ public class MultaniMaroSorcerer extends CardImpl { this.supertype.add("Legendary"); this.subtype.add("Elemental"); - this.color.setGreen(true); this.power = new MageInt(0); this.toughness = new MageInt(0); // Shroud this.addAbility(ShroudAbility.getInstance()); + // Multani, Maro-Sorcerer's power and toughness are each equal to the total number of cards in all players' hands. - this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new CardsInHandCount(), Duration.EndOfGame))); + this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new CardsInAllHandsCount(), Duration.EndOfGame))); } public MultaniMaroSorcerer(final MultaniMaroSorcerer card) { @@ -75,33 +70,3 @@ public class MultaniMaroSorcerer extends CardImpl { return new MultaniMaroSorcerer(this); } } - -class CardsInHandCount implements DynamicValue { - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - int count = 0; - for (UUID playerId: game.getPlayer(sourceAbility.getControllerId()).getInRange()) { - Player player = game.getPlayer(playerId); - if (player != null) - { - count += player.getHand().size(); - } - } - return count; - } - - @Override - public DynamicValue copy() { - return new CardsInHandCount(); - } - - @Override - public String getMessage() { - return "the total number of cards in all players' hands"; - } - - @Override - public String toString() { - return "1"; - } -} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/RealmSeekers.java b/Mage.Sets/src/mage/sets/vintagemasters/RealmSeekers.java new file mode 100644 index 00000000000..f6b2ab59f9f --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/RealmSeekers.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.vintagemasters; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class RealmSeekers extends mage.sets.conspiracy.RealmSeekers { + + public RealmSeekers(UUID ownerId) { + super(ownerId); + this.cardNumber = 226; + this.expansionSetCode = "VMA"; + } + + public RealmSeekers(final RealmSeekers card) { + super(card); + } + + @Override + public RealmSeekers copy() { + return new RealmSeekers(this); + } +} diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllHandsCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllHandsCount.java new file mode 100644 index 00000000000..143e8f01135 --- /dev/null +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllHandsCount.java @@ -0,0 +1,70 @@ +/* + * 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.dynamicvalue.common; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class CardsInAllHandsCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + int count = 0; + for (UUID playerId : game.getPlayer(sourceAbility.getControllerId()).getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) + { + count += player.getHand().size(); + } + } + return count; + } + + @Override + public CardsInAllHandsCount copy() { + return new CardsInAllHandsCount(); + } + + @Override + public String getMessage() { + return "the total number of cards in all players' hands"; + } + + @Override + public String toString() { + return "X"; + } +}