mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Fixed NPE error in momir emblem;
This commit is contained in:
parent
8df43cfbb6
commit
6bfea7bfd9
1 changed files with 14 additions and 4 deletions
|
@ -11,7 +11,10 @@ import mage.cards.Sets;
|
|||
import mage.cards.repository.CardCriteria;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.token.EmptyToken;
|
||||
|
@ -64,7 +67,9 @@ class MomirEffect extends OneShotEffect {
|
|||
game.informPlayers("No random creature card with converted mana cost of " + value + " was found.");
|
||||
return false;
|
||||
}
|
||||
EmptyToken token = new EmptyToken(); // search for a non custom set creature
|
||||
|
||||
// search for a random non custom set creature
|
||||
EmptyToken token = null;
|
||||
while (!options.isEmpty()) {
|
||||
int index = RandomUtil.nextInt(options.size());
|
||||
ExpansionSet expansionSet = Sets.findSet(options.get(index).getSetCode());
|
||||
|
@ -73,6 +78,7 @@ class MomirEffect extends OneShotEffect {
|
|||
} else {
|
||||
Card card = options.get(index).getCard();
|
||||
if (card != null) {
|
||||
token = new EmptyToken();
|
||||
CardUtil.copyTo(token).from(card);
|
||||
break;
|
||||
} else {
|
||||
|
@ -80,7 +86,11 @@ class MomirEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false);
|
||||
return true;
|
||||
if (token != null) {
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue