Merge pull request #6078 from Tosh94/fix-nicol-bolas-god-pharaoh-+1

Fix NPE when using Nicol Bolas, God-Pharaoh's +1
This commit is contained in:
Oleg Agafonov 2019-12-08 17:12:54 +01:00 committed by GitHub
commit fa62dac244
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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());
}
}
}