mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Fixed some null pointer exceptions with Thieves Auction and Avatar of the Might.
This commit is contained in:
parent
1a8f38759b
commit
7dfcb15c3c
2 changed files with 9 additions and 7 deletions
|
|
@ -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)) {
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,13 @@ class AvatarOfMightCostReductionEffect extends CostModificationEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
int creatures = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId(), game);
|
if (abilityToModify.getSourceId().equals(source.getSourceId()) && (abilityToModify instanceof SpellAbility)) {
|
||||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
int creatures = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId(), game);
|
||||||
Player opponent = game.getPlayer(playerId);
|
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||||
if (opponent != null && game.getBattlefield().countAll(new FilterCreaturePermanent(), opponent.getId(), game) >= creatures + 4) {
|
Player opponent = game.getPlayer(playerId);
|
||||||
return true;
|
if (opponent != null && game.getBattlefield().countAll(new FilterCreaturePermanent(), opponent.getId(), game) >= creatures + 4) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue