Some minor changes.

This commit is contained in:
LevelX2 2017-09-01 23:50:07 +02:00
parent 4c5e5d1367
commit 5bf12d227c
3 changed files with 26 additions and 10 deletions

View file

@ -834,10 +834,23 @@ public class HumanPlayer extends PlayerImpl {
return !controllingPlayer.getUserData().getUserSkipPrioritySteps().getOpponentTurn().isPhaseStepSet(game.getStep().getType()); return !controllingPlayer.getUserData().getUserSkipPrioritySteps().getOpponentTurn().isPhaseStepSet(game.getStep().getType());
} }
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
String isNull = controllingPlayer.getUserData() == null ? "null" : "not null"; if (controllingPlayer.getUserData() != null) {
logger.error("null pointer exception UserData = " + isNull); if (controllingPlayer.getUserData().getUserSkipPrioritySteps() != null) {
if (game.getStep() != null) {
if (game.getStep().getType() == null) {
logger.error("game.getStep().getType() == null");
} }
return true; } else {
logger.error("game.getStep() == null");
}
} else {
logger.error("UserData.getUserSkipPrioritySteps == null");
}
} else {
logger.error("UserData == null");
}
}
return false;
} }
@Override @Override
@ -1223,7 +1236,9 @@ public class HumanPlayer extends PlayerImpl {
FilterCreatureForCombatBlock filter = filterCreatureForCombatBlock.copy(); FilterCreatureForCombatBlock filter = filterCreatureForCombatBlock.copy();
filter.add(new ControllerIdPredicate(defendingPlayerId)); filter.add(new ControllerIdPredicate(defendingPlayerId));
if (game.getBattlefield().count(filter, null, playerId, game) == 0 if (game.getBattlefield().count(filter, null, playerId, game) == 0
&& !getControllingPlayersUserData(game).getUserSkipPrioritySteps().isStopOnDeclareBlockerIfNoneAvailable()) { && !getControllingPlayersUserData(game)
.getUserSkipPrioritySteps()
.isStopOnDeclareBlockerIfNoneAvailable()) {
return; return;
} }
while (!abort) { while (!abort) {

View file

@ -27,6 +27,8 @@
*/ */
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.LinkedHashSet;
import java.util.stream.Collectors;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -39,9 +41,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.LinkedHashSet;
import java.util.stream.Collectors;
/** /**
* @author LevelX2 * @author LevelX2
*/ */
@ -72,6 +71,9 @@ public class ChooseCreatureTypeEffect extends OneShotEffect {
return false; return false;
} }
} }
if (typeChoice.getChoice() == null) {
return false;
}
if (!game.isSimulation()) { if (!game.isSimulation()) {
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice()); game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
} }

View file

@ -2959,7 +2959,7 @@ public abstract class PlayerImpl implements Player, Serializable {
} }
public UserData getControllingPlayersUserData(Game game) { public UserData getControllingPlayersUserData(Game game) {
if (isGameUnderControl()) { if (!isGameUnderControl()) {
Player player = game.getPlayer(getTurnControlledBy()); Player player = game.getPlayer(getTurnControlledBy());
if (player.isHuman()) { if (player.isHuman()) {
return player.getUserData(); return player.getUserData();
@ -2969,8 +2969,7 @@ public abstract class PlayerImpl implements Player, Serializable {
} }
@Override @Override
public void setUserData(UserData userData public void setUserData(UserData userData) {
) {
this.userData = userData; this.userData = userData;
getManaPool().setAutoPayment(userData.isManaPoolAutomatic()); getManaPool().setAutoPayment(userData.isManaPoolAutomatic());
getManaPool().setAutoPaymentRestricted(userData.isManaPoolAutomaticRestricted()); getManaPool().setAutoPaymentRestricted(userData.isManaPoolAutomaticRestricted());