Fixed some null pointer exceptions with Thieves Auction and Avatar of the Might.

This commit is contained in:
LevelX2 2016-10-03 20:19:57 +02:00
parent 1a8f38759b
commit 7dfcb15c3c
2 changed files with 9 additions and 7 deletions

View file

@ -109,8 +109,8 @@ class ThievesAuctionEffect extends OneShotEffect {
// Starting with you, each player // Starting with you, each player
PlayerList playerList = game.getState().getPlayersInRange(controller.getId(), game); PlayerList playerList = game.getState().getPlayersInRange(controller.getId(), game);
Player player = playerList.getCurrent(game); Player player = playerList.getCurrent(game);
while (!exiledCards.isEmpty()) { while (!exiledCards.isEmpty() && !game.hasEnded()) {
if (player.canRespond()) { if (player != null && player.canRespond()) {
// chooses one of the exiled cards // chooses one of the exiled cards
TargetCard target = new TargetCardInExile(new FilterCard()); TargetCard target = new TargetCardInExile(new FilterCard());
if (player.choose(Outcome.PutCardInPlay, exiledCards, target, game)) { if (player.choose(Outcome.PutCardInPlay, exiledCards, target, game)) {

View file

@ -105,6 +105,7 @@ class AvatarOfMightCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getSourceId().equals(source.getSourceId()) && (abilityToModify instanceof SpellAbility)) {
int creatures = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId(), game); int creatures = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId(), game);
for (UUID playerId : game.getOpponents(source.getControllerId())) { for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId); Player opponent = game.getPlayer(playerId);
@ -112,6 +113,7 @@ class AvatarOfMightCostReductionEffect extends CostModificationEffectImpl {
return true; return true;
} }
} }
}
return false; return false;
} }