mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
[RAV] fixed null pointer exception with Bottled Cloister (fixes #8451)
This commit is contained in:
parent
f0b08424e6
commit
a7e89ec354
1 changed files with 4 additions and 2 deletions
|
@ -12,6 +12,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
@ -102,10 +103,11 @@ class BottledCloisterReturnEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
|
||||
if (player == null || exileZone == null || exileZone.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(game.getExile().getExileZone(CardUtil.getExileZoneId(game, source)).getCards(game));
|
||||
Cards cards = new CardsImpl(exileZone.getCards(game));
|
||||
cards.removeIf(uuid -> !player.getId().equals(game.getOwnerId(uuid)));
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
player.drawCards(1, source, game);
|
||||
|
|
Loading…
Reference in a new issue