1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-02 03:18:09 -09:00

Fix NPE when using Nicol Bolas, God-Pharaoh's +1 when an opponent has no cards in hand.

This commit is contained in:
Tosh94 2019-12-08 17:03:47 +01:00
parent 9748136723
commit 1365e7ff6c

View file

@ -98,11 +98,17 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
int numberOfCardsToExile = Math.min(2, opponent.getHand().size());
Target target = new TargetCardInHand(numberOfCardsToExile, new FilterCard());
target.setRequired(true);
if (opponent.chooseTarget(Outcome.Exile, target, source, game)) {
Cards cards = new CardsImpl(target.getTargets());
cardsToExile.put(opponentId, cards);
if(numberOfCardsToExile > 0) {
Target target = new TargetCardInHand(numberOfCardsToExile, new FilterCard());
target.setRequired(true);
if (opponent.chooseTarget(Outcome.Exile, target, source, game)) {
Cards cards = new CardsImpl(target.getTargets());
cardsToExile.put(opponentId, cards);
}
}
else
{
cardsToExile.put(opponentId, new CardsImpl());
}
}
}