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

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
Mage.Sets/src/mage/sets

View file

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

View file

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