mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Fixed NPE in some cards with exile zone (example: Draugr Necromancer)
This commit is contained in:
parent
3030feaaf1
commit
d393ac9c60
3 changed files with 11 additions and 12 deletions
|
@ -10,6 +10,7 @@ import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.mana.ConditionalColorlessManaAbility;
|
import mage.abilities.mana.ConditionalColorlessManaAbility;
|
||||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||||
import mage.abilities.mana.conditional.ManaCondition;
|
import mage.abilities.mana.conditional.ManaCondition;
|
||||||
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -87,7 +88,8 @@ class AutomatedArtificerManaCondition extends ManaCondition {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (object instanceof Commander) {
|
if (object instanceof Commander) {
|
||||||
return ((Commander) object).getSourceObject().isArtifact(game);
|
Card card = ((Commander) object).getSourceObject();
|
||||||
|
return card != null && card.isArtifact(game);
|
||||||
}
|
}
|
||||||
return object.isArtifact(game);
|
return object.isArtifact(game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ class DraugrNecromancerSpendAnyManaEffect extends AsThoughEffectImpl implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
|
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
|
||||||
if (mana.getSourceObject().isSnow()) {
|
if (mana.getSourceObject() != null && mana.getSourceObject().isSnow()) {
|
||||||
return mana.getFirstAvailable();
|
return mana.getFirstAvailable();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -57,23 +57,20 @@ class TibaltCosmicImpostorPlayFromExileEffect extends AsThoughEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// the exile zone of the Tibalt, Cosmic Impostor that spawned the emblem only
|
// the exile zone of the Tibalt, Cosmic Impostor that spawned the emblem only
|
||||||
UUID exileId = CardUtil.getExileZoneId(tibaltEmblem.getSourceObject().getId().toString(), game);
|
UUID sourceId = tibaltEmblem.getSourceId();
|
||||||
if (exileId == null) {
|
UUID exileId = CardUtil.getExileZoneId(sourceId != null ? sourceId.toString() : source.getSourceId().toString(), game);
|
||||||
return false;
|
ExileZone exileZone = game.getState().getExile().getExileZone(exileId);
|
||||||
}
|
if (exileZone == null || exileZone.isEmpty()) {
|
||||||
ExileZone exile = game.getState().getExile().getExileZone(exileId);
|
|
||||||
if (exile == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (exile.isEmpty()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Card cardInExile = game.getCard(objectId);
|
Card cardInExile = game.getCard(objectId);
|
||||||
if (cardInExile == null) {
|
if (cardInExile == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID mainCardId = cardInExile.getMainCard().getId();
|
UUID mainCardId = cardInExile.getMainCard().getId();
|
||||||
if (exile.contains(mainCardId)
|
if (exileZone.contains(mainCardId)
|
||||||
&& affectedControllerId.equals(source.getControllerId())
|
&& affectedControllerId.equals(source.getControllerId())
|
||||||
&& game.getState().getZone(mainCardId).equals(Zone.EXILED)) {
|
&& game.getState().getZone(mainCardId).equals(Zone.EXILED)) {
|
||||||
CardUtil.makeCardPlayable(game, source, cardInExile, Duration.Custom, true);
|
CardUtil.makeCardPlayable(game, source, cardInExile, Duration.Custom, true);
|
||||||
|
|
Loading…
Reference in a new issue