diff --git a/Mage.Sets/src/mage/cards/s/SnoopingNewsie.java b/Mage.Sets/src/mage/cards/s/SnoopingNewsie.java new file mode 100644 index 00000000000..c96a02ccb31 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SnoopingNewsie.java @@ -0,0 +1,109 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.MillCardsControllerEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.game.Game; +import mage.players.Player; + +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class SnoopingNewsie extends CardImpl { + + public SnoopingNewsie(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Snooping Newsie enters the battlefield, mill two cards. + this.addAbility(new EntersBattlefieldTriggeredAbility(new MillCardsControllerEffect(2))); + + // As long as there are five or more mana values among cards in your graveyard, Snooping Newsie gets +1/+1 and has lifelink. + Ability ability = new SimpleStaticAbility(new ConditionalContinuousEffect( + new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), + SnoopingNewsieCondition.instance, "as long as there are five or more " + + "mana values among cards in your graveyard, {this} gets +1/+1" + )); + ability.addEffect(new ConditionalContinuousEffect( + new GainAbilitySourceEffect(LifelinkAbility.getInstance()), + SnoopingNewsieCondition.instance, "and has lifelink" + )); + this.addAbility(ability.addHint(SnoopingNewsieHint.instance)); + } + + private SnoopingNewsie(final SnoopingNewsie card) { + super(card); + } + + @Override + public SnoopingNewsie copy() { + return new SnoopingNewsie(this); + } +} + +enum SnoopingNewsieCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + return player != null + && player + .getGraveyard() + .getCards(game) + .stream() + .mapToInt(MageObject::getManaValue) + .distinct() + .count() >= 5; + } +} + +enum SnoopingNewsieHint implements Hint { + instance;; + + @Override + public String getText(Game game, Ability ability) { + Player player = game.getPlayer(ability.getControllerId()); + if (player == null) { + return null; + } + List values = player + .getGraveyard() + .getCards(game) + .stream() + .mapToInt(MageObject::getManaValue) + .distinct() + .sorted() + .mapToObj(String::valueOf) + .collect(Collectors.toList()); + return "Different mana values among cards in your graveyard: " + values.size() + + (values.size() > 0 ? " (" + String.join(", ", values) + ')' : ""); + } + + @Override + public SnoopingNewsieHint copy() { + return this; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index fb0f36c9dcb..7d7704f560f 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -67,6 +67,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Riveteers Charm", 217, Rarity.UNCOMMON, mage.cards.r.RiveteersCharm.class)); cards.add(new SetCardInfo("Rumor Gatherer", 29, Rarity.UNCOMMON, mage.cards.r.RumorGatherer.class)); cards.add(new SetCardInfo("Skybridge Towers", 256, Rarity.COMMON, mage.cards.s.SkybridgeTowers.class)); + cards.add(new SetCardInfo("Snooping Newsie", 222, Rarity.COMMON, mage.cards.s.SnoopingNewsie.class)); cards.add(new SetCardInfo("Spara's Headquarters", 257, Rarity.RARE, mage.cards.s.SparasHeadquarters.class)); cards.add(new SetCardInfo("Strangle", 125, Rarity.COMMON, mage.cards.s.Strangle.class)); cards.add(new SetCardInfo("Swamp", 266, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));