mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed some more possible null pointer exceptions.
This commit is contained in:
parent
7e9d285a49
commit
e74f5995cb
6 changed files with 20 additions and 11 deletions
|
@ -218,7 +218,9 @@ class TawnossCoffinReturnEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ExileZone exileZone = game.getExile().getExileZone(source.getSourceId());
|
||||
|
||||
if (exileZone == null) {
|
||||
return true;
|
||||
}
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
//There should be only 1 there, but the for each loop seems the most practical to get to it
|
||||
|
|
|
@ -244,8 +244,8 @@ class JestersScepterCounterEffect extends OneShotEffect {
|
|||
String nameOfExiledCardPayment = (String) game.getState().getValue(source.getSourceId() + "_nameOfExiledCardPayment");
|
||||
String nameOfExiledCardPayment2 = (String) game.getState().getValue(source.getSourceId() + "_nameOfExiledCardPayment2");
|
||||
if (nameOfExiledCardPayment != null) {
|
||||
if (nameOfExiledCardPayment.matches(spell.getName())
|
||||
|| nameOfExiledCardPayment2.matches(spell.getName())) {
|
||||
if (nameOfExiledCardPayment.equals(spell.getCard().getName())
|
||||
|| (nameOfExiledCardPayment2 != null) && nameOfExiledCardPayment2.equals(spell.getCard().getName())) {
|
||||
return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,10 @@ class EpicExperimentEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
// move cards not cast to graveyard
|
||||
controller.moveCards(game.getExile().getExileZone(source.getSourceId()).getCards(game), Zone.GRAVEYARD, source, game);
|
||||
ExileZone exileZone = game.getExile().getExileZone(source.getSourceId());
|
||||
if (exileZone != null) {
|
||||
controller.moveCards(exileZone.getCards(game), Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -90,7 +90,7 @@ class InfernoTrapCondition implements Condition {
|
|||
InfernoTrapWatcher watcher = (InfernoTrapWatcher) game.getState().getWatchers().get(InfernoTrapWatcher.class.getName());
|
||||
if (watcher != null) {
|
||||
Set<MageObjectReference> damagingCreatures = watcher.getDamagingCreatures(source.getControllerId());
|
||||
return !damagingCreatures.isEmpty() && damagingCreatures.size() > 1;
|
||||
return damagingCreatures != null && damagingCreatures.size() > 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -487,6 +487,9 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
attackerPerms.add(game.getPermanent(attackerId));
|
||||
}
|
||||
UUID attackerId = player.chooseAttackerOrder(attackerPerms, game);
|
||||
if (!player.isInGame()) {
|
||||
break;
|
||||
}
|
||||
attackerOrder.add(attackerId);
|
||||
attackerList.remove(attackerId);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.players;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -139,6 +140,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||
|
||||
private static Random rnd = new Random();
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
|
||||
|
||||
/**
|
||||
* Used to cancel waiting requests send to the player
|
||||
|
@ -203,7 +205,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
protected boolean canPayLifeCost = true;
|
||||
protected boolean loseByZeroOrLessLife = true;
|
||||
protected boolean canPlayCardsFromGraveyard = true;
|
||||
|
||||
|
||||
protected FilterPermanent sacrificeCostFilter;
|
||||
|
||||
protected final List<AlternativeSourceCosts> alternativeSourceCosts = new ArrayList<>();
|
||||
|
@ -1232,8 +1234,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
if (!ability.isUsesStack()) {
|
||||
ability.resolve(game);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
game.fireEvent(new GameEvent(EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
|
||||
}
|
||||
game.removeBookmark(bookmark);
|
||||
|
@ -2950,10 +2951,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public void setCanPaySacrificeCostFilter(FilterPermanent filter) {
|
||||
this.sacrificeCostFilter = filter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FilterPermanent getSacrificeCostFilter() {
|
||||
return sacrificeCostFilter;
|
||||
return sacrificeCostFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3016,7 +3017,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.LOOK_AT_FACE_DOWN, this.getId(), game)) {
|
||||
if (chooseUse(Outcome.Benefit, "Look at that card?", null, game)) {
|
||||
Cards cards = new CardsImpl(card);
|
||||
this.lookAtCards(getName(), cards, game);
|
||||
this.lookAtCards(getName() + " - " + sdf.format(System.currentTimeMillis()), cards, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue