[DSK] Implement Nashi, Searchr in the Dark

This commit is contained in:
theelk801 2024-09-10 09:47:01 -04:00
parent 04fb295dde
commit 1ab4c1858d
2 changed files with 102 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));