- null pointer Nahin, The Harbinger.

This commit is contained in:
jeffwadsworth 2019-01-26 23:47:56 -06:00
parent d07415e08c
commit 3b1a9388ac

View file

@ -1,4 +1,3 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID; import java.util.UUID;
@ -49,13 +48,13 @@ public final class NahiriTheHarbinger extends CardImpl {
static { static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ENCHANTMENT), filter.add(Predicates.or(new CardTypePredicate(CardType.ENCHANTMENT),
(Predicates.and(new CardTypePredicate(CardType.ARTIFACT), (Predicates.and(new CardTypePredicate(CardType.ARTIFACT),
TappedPredicate.instance)), TappedPredicate.instance)),
(Predicates.and(new CardTypePredicate(CardType.CREATURE), (Predicates.and(new CardTypePredicate(CardType.CREATURE),
TappedPredicate.instance)))); TappedPredicate.instance))));
} }
public NahiriTheHarbinger(UUID ownerId, CardSetInfo setInfo) { public NahiriTheHarbinger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{R}{W}"); super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{R}{W}");
this.addSuperType(SuperType.LEGENDARY); this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.NAHIRI); this.subtype.add(SubType.NAHIRI);
@ -114,16 +113,18 @@ class NahiriTheHarbingerEffect extends SearchEffect {
if (controller.searchLibrary(target, game)) { if (controller.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) { if (!target.getTargets().isEmpty()) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game); if (card != null) {
Permanent permanent = game.getPermanent(card.getId()); controller.moveCards(card, Zone.BATTLEFIELD, source, game);
if (permanent != null) { Permanent permanent = game.getPermanent(card.getId());
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom); if (permanent != null) {
effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
game.addEffect(effect, source); effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game)));
Effect effect2 = new ReturnToHandTargetEffect(); game.addEffect(effect, source);
effect2.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); Effect effect2 = new ReturnToHandTargetEffect();
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2); effect2.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game)));
game.addDelayedTriggeredAbility(delayedAbility, source); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
} }
} }
controller.shuffleLibrary(source, game); controller.shuffleLibrary(source, game);