diff --git a/Mage.Sets/src/mage/cards/s/SwimmerInNightmares.java b/Mage.Sets/src/mage/cards/s/SwimmerInNightmares.java new file mode 100644 index 0000000000..a13f4e773c --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SwimmerInNightmares.java @@ -0,0 +1,78 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.decorator.ConditionalRestrictionEffect; +import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPlaneswalkerPermanent; +import mage.game.Game; +import mage.players.Player; + +import java.util.HashSet; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SwimmerInNightmares extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledPlaneswalkerPermanent(SubType.ASHIOK); + private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter); + + public SwimmerInNightmares(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); + + this.subtype.add(SubType.NIGHTMARE); + this.subtype.add(SubType.MERFOLK); + this.power = new MageInt(1); + this.toughness = new MageInt(4); + + // Swimmer in Nightmares gets +3/+0 as long as there are ten or more cards in a single graveyard. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new BoostSourceEffect(3, 0, Duration.WhileOnBattlefield), + SwimmerInNightmaresCondition.instance, + "{this} +3/+0 as long as there are ten or more cards in a single graveyard" + ))); + + // Swimmer in Nightmares can't be blocked as long as you control an Ashiok planeswalker. + this.addAbility(new SimpleStaticAbility(new ConditionalRestrictionEffect( + new CantBeBlockedSourceEffect(), condition, + "{this} can't be blocked as long as you control an Ashiok planeswalker" + ))); + } + + private SwimmerInNightmares(final SwimmerInNightmares card) { + super(card); + } + + @Override + public SwimmerInNightmares copy() { + return new SwimmerInNightmares(this); + } +} + +enum SwimmerInNightmaresCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getState() + .getPlayersInRange(source.getControllerId(), game) + .stream() + .map(game::getPlayer) + .map(Player::getGraveyard) + .map(HashSet::size) + .anyMatch(x -> x >= 10); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 7ec690ee4c..2e33cae432 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -138,6 +138,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Storm's Wrath", 157, Rarity.RARE, mage.cards.s.StormsWrath.class)); cards.add(new SetCardInfo("Swamp", 252, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Sweet Oblivion", 70, Rarity.UNCOMMON, mage.cards.s.SweetOblivion.class)); + cards.add(new SetCardInfo("Swimmer in Nightmares", 275, Rarity.UNCOMMON, mage.cards.s.SwimmerInNightmares.class)); cards.add(new SetCardInfo("Taranika, Akroan Veteran", 39, Rarity.RARE, mage.cards.t.TaranikaAkroanVeteran.class)); cards.add(new SetCardInfo("Tectonic Giant", 158, Rarity.RARE, mage.cards.t.TectonicGiant.class)); cards.add(new SetCardInfo("Temple of Abandon", 244, Rarity.RARE, mage.cards.t.TempleOfAbandon.class));