fixes #3707 minds desire npe

This commit is contained in:
Derek Monturo 2017-07-21 07:29:14 -04:00
parent fc32c9a7b7
commit 521b573ad2

View file

@ -55,7 +55,6 @@ public class MindsDesire extends CardImpl {
public MindsDesire(UUID ownerId, CardSetInfo setInfo) { public MindsDesire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{U}{U}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{U}{U}");
// Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost. // Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost.
this.getSpellAbility().addEffect(new MindsDesireEffect()); this.getSpellAbility().addEffect(new MindsDesireEffect());
@ -135,13 +134,10 @@ class MindsDesireCastFromExileEffect extends AsThoughEffectImpl {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
UUID targetId = getTargetPointer().getFirst(game, source); UUID targetId = getTargetPointer().getFirst(game, source);
Player player = game.getPlayer(affectedControllerId); Player player = game.getPlayer(affectedControllerId);
if (targetId != null if (targetId != null && sourceId != null && targetId.equals(sourceId) && player != null) {
&& targetId.equals(sourceId)
&& player != null) {
if (affectedControllerId.equals(source.getControllerId())) { if (affectedControllerId.equals(source.getControllerId())) {
Card card = game.getCard(sourceId); Card card = game.getCard(sourceId);
if (card != null if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
&& game.getState().getZone(sourceId) == Zone.EXILED) {
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts()); player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts());
return true; return true;
} }