From 1ab4c1858da5d0d243f25397f047a7fb3da4fafc Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 10 Sep 2024 09:47:01 -0400 Subject: [PATCH] [DSK] Implement Nashi, Searchr in the Dark --- .../mage/cards/n/NashiSearcherInTheDark.java | 101 ++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 1 + 2 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NashiSearcherInTheDark.java diff --git a/Mage.Sets/src/mage/cards/n/NashiSearcherInTheDark.java b/Mage.Sets/src/mage/cards/n/NashiSearcherInTheDark.java new file mode 100644 index 00000000000..f3efe3694ff --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NashiSearcherInTheDark.java @@ -0,0 +1,101 @@ +package mage.cards.n; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NashiSearcherInTheDark extends CardImpl { + + public NashiSearcherInTheDark(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.RAT); + this.subtype.add(SubType.NINJA); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Menace + this.addAbility(new MenaceAbility()); + + // Whenever Nashi, Searcher in the Dark deals combat damage to a player, you mill that many cards. You may put any number of legendary and/or enchantment cards from among them into your hand. If you put no cards into your hand this way, put a +1/+1 counter on Nashi. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new NashiSearcherInTheDarkEffect())); + } + + private NashiSearcherInTheDark(final NashiSearcherInTheDark card) { + super(card); + } + + @Override + public NashiSearcherInTheDark copy() { + return new NashiSearcherInTheDark(this); + } +} + +class NashiSearcherInTheDarkEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("legendary and/or enchantment cards"); + + static { + filter.add(Predicates.or( + SuperType.LEGENDARY.getPredicate(), + CardType.ENCHANTMENT.getPredicate() + )); + } + + NashiSearcherInTheDarkEffect() { + super(Outcome.Benefit); + staticText = "you mill that many cards. You may put any number of legendary and/or enchantment cards from " + + "among them into your hand. If you put no cards into your hand this way, put a +1/+1 counter on {this}"; + } + + private NashiSearcherInTheDarkEffect(final NashiSearcherInTheDarkEffect effect) { + super(effect); + } + + @Override + public NashiSearcherInTheDarkEffect copy() { + return new NashiSearcherInTheDarkEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + int amount = (Integer) getValue("damage"); + if (player == null || amount < 1) { + return false; + } + Cards cards = player.millCards(amount, source, game); + TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.ALL, filter); + target.withNotTarget(true); + player.choose(Outcome.ReturnToHand, cards, target, source, game); + Cards toHand = new CardsImpl(target.getTargets()); + player.moveCards(toHand, Zone.HAND, source, game); + toHand.retainZone(Zone.HAND, game); + if (toHand.isEmpty()) { + Optional.ofNullable(source.getSourcePermanentIfItStillExists(game)) + .ifPresent(permanent -> permanent.addCounters(CounterType.P1P1.createInstance(), source, game)); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index aff0da92a12..22a60db734d 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -107,6 +107,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet { cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Murder", 110, Rarity.COMMON, mage.cards.m.Murder.class)); cards.add(new SetCardInfo("Murky Sewer", 263, Rarity.COMMON, mage.cards.m.MurkySewer.class)); + cards.add(new SetCardInfo("Nashi, Searcher in the Dark", 223, Rarity.RARE, mage.cards.n.NashiSearcherInTheDark.class)); cards.add(new SetCardInfo("Neglected Manor", 264, Rarity.COMMON, mage.cards.n.NeglectedManor.class)); cards.add(new SetCardInfo("Oblivious Bookworm", 225, Rarity.UNCOMMON, mage.cards.o.ObliviousBookworm.class)); cards.add(new SetCardInfo("Overlord of the Boilerbilges", 146, Rarity.MYTHIC, mage.cards.o.OverlordOfTheBoilerbilges.class));