mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
fixed a null pointer exception when multiple players discard
This commit is contained in:
parent
42fd5a6410
commit
713a7ab35d
2 changed files with 5 additions and 3 deletions
|
|
@ -103,8 +103,7 @@ public class DiscardEachPlayerEffect extends OneShotEffect {
|
|||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
Cards cardsPlayer = cardsToDiscard.get(playerId);
|
||||
player.discard(cardsPlayer, source, game);
|
||||
player.discard(cardsToDiscard.get(playerId), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -721,6 +721,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public Cards discard(Cards cards, Ability source, Game game) {
|
||||
Cards discardedCards = new CardsImpl();
|
||||
if (cards == null) {
|
||||
return discardedCards;
|
||||
}
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if (doDiscard(card, source, game, false)) {
|
||||
discardedCards.add(card);
|
||||
|
|
@ -4005,7 +4008,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
for (Card card : cards) {
|
||||
if (card instanceof Permanent) {
|
||||
game.getBattlefield().removePermanent(card.getId());
|
||||
ZoneChangeEvent event = new ZoneChangeEvent((Permanent)card,
|
||||
ZoneChangeEvent event = new ZoneChangeEvent((Permanent) card,
|
||||
(source == null ? null : source.getSourceId()),
|
||||
byOwner ? card.getOwnerId() : getId(), Zone.BATTLEFIELD, Zone.OUTSIDE, appliedEffects);
|
||||
game.fireEvent(event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue