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

Removed erroneous check in dark deal effect ()

* Removed erroneous check in dark deal effect

* Fixed NPE with empty hand in dark deal
This commit is contained in:
Alexander Novotny 2023-04-24 19:18:28 -07:00 committed by GitHub
parent e176292da6
commit ed32ee554d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,7 +62,7 @@ class DarkDealEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
int cardsInHand = player.getHand().size();
if (cardsInHand > 1) {
if(cardsInHand > 0) {
player.discard(cardsInHand, false, false, source, game);
cardsToDraw.put(playerId, cardsInHand - 1);
}
@ -70,7 +70,7 @@ class DarkDealEffect extends OneShotEffect {
}
for (Map.Entry<UUID, Integer> toDrawByPlayer : cardsToDraw.entrySet()) {
Player player = game.getPlayer(toDrawByPlayer.getKey());
if (player != null) {
if (player != null && toDrawByPlayer.getValue() > 0) {
player.drawCards(toDrawByPlayer.getValue(), source, game);
}
}