diff --git a/Mage.Sets/src/mage/sets/fatereforged/AvenSurveyor.java b/Mage.Sets/src/mage/sets/fatereforged/AvenSurveyor.java new file mode 100644 index 00000000000..b07ae20c55c --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/AvenSurveyor.java @@ -0,0 +1,77 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author emerald000 + */ +public class AvenSurveyor extends CardImpl { + + public AvenSurveyor(UUID ownerId) { + super(ownerId, 31, "Aven Surveyor", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Bird"); + this.subtype.add("Scout"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Aven Surveyor enters the battlefield, choose one - + // * Put a +1/+1 counter on Aven Surveyor + Ability ability = new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); + + // * Return target creature to its owner's hand + Mode mode = new Mode(); + mode.getEffects().add(new ReturnToHandTargetEffect()); + mode.getTargets().add(new TargetCreaturePermanent()); + ability.addMode(mode); + this.addAbility(ability); + } + + public AvenSurveyor(final AvenSurveyor card) { + super(card); + } + + @Override + public AvenSurveyor copy() { + return new AvenSurveyor(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/Cloudform.java b/Mage.Sets/src/mage/sets/fatereforged/Cloudform.java new file mode 100644 index 00000000000..a810849d54a --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/Cloudform.java @@ -0,0 +1,75 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BecomesAuraAttachToManifestSourceEffect; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HexproofAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author emerald000 + */ +public class Cloudform extends CardImpl { + + public Cloudform(UUID ownerId) { + super(ownerId, 32, "Cloudform", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}{U}"); + this.expansionSetCode = "FRF"; + + // When Cloudform enters the battlefield, it becomes an aura with enchant creature. Manifest the top card of your library and attach Cloudform to it. + this.addAbility(new EntersBattlefieldTriggeredAbility(new BecomesAuraAttachToManifestSourceEffect())); + + // Enchanted creature has flying and hexproof. + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield)); + Effect effect = new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield); + effect.setText("and hexproof"); + ability.addEffect(effect); + this.addAbility(ability); + } + + public Cloudform(final Cloudform card) { + super(card); + } + + @Override + public Cloudform copy() { + return new Cloudform(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/Fascination.java b/Mage.Sets/src/mage/sets/fatereforged/Fascination.java new file mode 100644 index 00000000000..60143cef875 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/Fascination.java @@ -0,0 +1,68 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.common.DrawCardAllEffect; +import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveEachPlayerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; + +/** + * + * @author emerald000 + */ +public class Fascination extends CardImpl { + + public Fascination(UUID ownerId) { + super(ownerId, 34, "Fascination", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{X}{U}{U}"); + this.expansionSetCode = "FRF"; + + // Choose one - + // * Each player draws X cards. + this.getSpellAbility().addEffect(new DrawCardAllEffect(new ManacostVariableValue())); + + // * Each player puts the top X cards of his or her library into his or her graveyard. + Mode mode = new Mode(); + mode.getEffects().add(new PutTopCardOfLibraryIntoGraveEachPlayerEffect(new ManacostVariableValue(), TargetController.ANY)); + this.getSpellAbility().addMode(mode); + } + + public Fascination(final Fascination card) { + super(card); + } + + @Override + public Fascination copy() { + return new Fascination(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java b/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java new file mode 100644 index 00000000000..fcac8d480cc --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java @@ -0,0 +1,162 @@ +/* + * 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.fatereforged; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.OneControlledCreatureCondition; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.costs.mana.ManaCosts; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalRestrictionEffect; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.combat.UnblockableSourceEffect; +import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentCard; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author emerald000 + */ +public class JeskaiInfiltrator extends CardImpl { + + public JeskaiInfiltrator(UUID ownerId) { + super(ownerId, 36, "Jeskai Infiltrator", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Human"); + this.subtype.add("Monk"); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Jeskai Infiltrator can't be blocked as long as you control no other creatures. + Effect effect = new ConditionalRestrictionEffect(new UnblockableSourceEffect(), new OneControlledCreatureCondition()); + effect.setText("{this} can't be blocked as long as you control no other creatures"); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + + // Whenever Jeskai Infiltrator deals combat damage to a player, exile it and the top card of your library in a face-down pile, shuffle that pile, then manifest those cards. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new JeskaiInfiltratorEffect(), false)); + } + + public JeskaiInfiltrator(final JeskaiInfiltrator card) { + super(card); + } + + @Override + public JeskaiInfiltrator copy() { + return new JeskaiInfiltrator(this); + } +} + +class JeskaiInfiltratorEffect extends OneShotEffect { + + JeskaiInfiltratorEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "exile it and the top card of your library in a face-down pile, shuffle that pile, then manifest those cards"; + } + + JeskaiInfiltratorEffect(final JeskaiInfiltratorEffect effect) { + super(effect); + } + + @Override + public JeskaiInfiltratorEffect copy() { + return new JeskaiInfiltratorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + List cardsToManifest = new ArrayList<>(2); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + Card sourceCard = game.getCard(source.getSourceId()); + if (sourcePermanent != null && sourceCard != null) { + sourceCard.setFaceDown(true); + player.moveCardToExileWithInfo(sourcePermanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD); + cardsToManifest.add(sourceCard); + } + if (player.getLibrary().size() > 0) { + Card cardFromLibrary = player.getLibrary().removeFromTop(game); + cardFromLibrary.setFaceDown(true); + player.moveCardToExileWithInfo(cardFromLibrary, null, "", source.getSourceId(), game, Zone.LIBRARY); + cardsToManifest.add(cardFromLibrary); + } + Collections.shuffle(cardsToManifest); + for (Card card : cardsToManifest) { + //Manual zone change to keep the cards face-down. + ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source.getSourceId(), source.getControllerId(), Zone.EXILED, Zone.BATTLEFIELD); + if (!game.replaceEvent(event)) { + game.getExile().removeCard(card, game); + game.rememberLKI(card.getId(), event.getFromZone(), card); + PermanentCard permanent = new PermanentCard(card, event.getPlayerId()); + game.addPermanent(permanent); + game.setZone(card.getId(), Zone.BATTLEFIELD); + game.setScopeRelevant(true); + permanent.entersBattlefield(source.getSourceId(), game, event.getFromZone(), true); + game.setScopeRelevant(false); + game.applyEffects(); + game.fireEvent(new ZoneChangeEvent(permanent, event.getPlayerId(), Zone.EXILED, Zone.BATTLEFIELD)); + ManaCosts manaCosts = null; + if (card.getCardType().contains(CardType.CREATURE)) { + manaCosts = card.getSpellAbility().getManaCosts(); + if (manaCosts == null) { + manaCosts = new ManaCostsImpl<>("{0}"); + } + } + ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + game.informPlayers(new StringBuilder(player.getName()) + .append(" puts facedown card from exile onto the battlefield").toString()); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/MarangRiverProwler.java b/Mage.Sets/src/mage/sets/fatereforged/MarangRiverProwler.java new file mode 100644 index 00000000000..cea8fe563ce --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/MarangRiverProwler.java @@ -0,0 +1,126 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.combat.CantBlockSourceEffect; +import mage.abilities.effects.common.combat.UnblockableSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.AsThoughEffectType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; + +/** + * + * @author emerald000 + */ +public class MarangRiverProwler extends CardImpl { + + public MarangRiverProwler(UUID ownerId) { + super(ownerId, 40, "Marang River Prowler", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Human"); + this.subtype.add("Rogue"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Marang River Prowler can't block and can't be blocked. + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockSourceEffect(Duration.WhileOnBattlefield)); + Effect effect = new UnblockableSourceEffect(); + effect.setText("and can't be blocked"); + ability.addEffect(effect); + this.addAbility(ability); + + // You may cast Marang River Prowler from your graveyard as long as you control a black or green permanent. + this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, new MarangRiverProwlerCastEffect())); + } + + public MarangRiverProwler(final MarangRiverProwler card) { + super(card); + } + + @Override + public MarangRiverProwler copy() { + return new MarangRiverProwler(this); + } +} + +class MarangRiverProwlerCastEffect extends AsThoughEffectImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("a black or green permanent"); + static { + filter.add(Predicates.or(new ColorPredicate(ObjectColor.BLACK), new ColorPredicate(ObjectColor.GREEN))); + } + + MarangRiverProwlerCastEffect() { + super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit); + staticText = "You may cast {this} from your graveyard as long as you control a black or green permanent"; + } + + MarangRiverProwlerCastEffect(final MarangRiverProwlerCastEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public MarangRiverProwlerCastEffect copy() { + return new MarangRiverProwlerCastEffect(this); + } + + @Override + public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { + if (sourceId.equals(source.getSourceId())) { + Card card = game.getCard(source.getSourceId()); + if (card != null + && card.getOwnerId().equals(affectedControllerId) + && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD + && game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) { + return true; + } + } + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveEachPlayerEffect.java b/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveEachPlayerEffect.java index 961d0980daa..677c60d4e95 100644 --- a/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveEachPlayerEffect.java +++ b/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveEachPlayerEffect.java @@ -30,6 +30,8 @@ package mage.abilities.effects.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.constants.Outcome; @@ -46,10 +48,14 @@ import mage.util.CardUtil; public class PutTopCardOfLibraryIntoGraveEachPlayerEffect extends OneShotEffect { - private final int numberCards; + private final DynamicValue numberCards; private final TargetController targetController; public PutTopCardOfLibraryIntoGraveEachPlayerEffect(int numberCards, TargetController targetController) { + this(new StaticValue(numberCards), targetController); + } + + public PutTopCardOfLibraryIntoGraveEachPlayerEffect(DynamicValue numberCards, TargetController targetController) { super(Outcome.Discard); this.numberCards = numberCards; this.targetController = targetController; @@ -100,7 +106,7 @@ public class PutTopCardOfLibraryIntoGraveEachPlayerEffect extends OneShotEffect private void putCardsToGravecard(UUID playerId, Ability source, Game game) { Player player = game.getPlayer(playerId); if (player != null) { - int cardsCount = Math.min(numberCards, player.getLibrary().size()); + int cardsCount = Math.min(numberCards.calculate(game, source, this), player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { @@ -126,12 +132,9 @@ public class PutTopCardOfLibraryIntoGraveEachPlayerEffect extends OneShotEffect throw new UnsupportedOperationException("TargetController type not supported."); } sb.append("puts the top "); - if (numberCards == 1) { - sb.append(" card"); - } else { - sb.append(CardUtil.numberToText(numberCards)); - sb.append(" cards"); - } + sb.append(CardUtil.numberToText(numberCards.toString(),"a")); + sb.append(" card"); + sb.append(numberCards.toString().equals("1")?"":"s"); sb.append(" of his or her library into his or her graveyard"); return sb.toString(); }