mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Fixed potential NPE errors in getPhase usage (fixed Berserker's Frenzy, etc)
This commit is contained in:
parent
cfd7464b49
commit
a15a0daa04
81 changed files with 162 additions and 130 deletions
|
|
@ -61,7 +61,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
|
|||
|
||||
@Override
|
||||
public boolean priority(Game game) {
|
||||
if (game.getStep().getType() == PhaseStep.UPKEEP) {
|
||||
if (game.getTurnStepType() == PhaseStep.UPKEEP) {
|
||||
if (!lastPhase.equals(game.getTurn().getValue(game.getTurnNum()))) {
|
||||
logList(game.getTurn().getValue(game.getTurnNum()) + name + " hand: ", new ArrayList(hand.getCards(game)));
|
||||
lastPhase = game.getTurn().getValue(game.getTurnNum());
|
||||
|
|
@ -236,7 +236,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
|
|||
if (root.getNumChildren() > 0)
|
||||
nodeSizeRatio = root.getVisits() / root.getNumChildren();
|
||||
// logger.info("Ratio: " + nodeSizeRatio);
|
||||
PhaseStep curStep = game.getStep().getType();
|
||||
PhaseStep curStep = game.getTurnStepType();
|
||||
if (action == NextAction.SELECT_ATTACKERS || action == NextAction.SELECT_BLOCKERS) {
|
||||
if (nodeSizeRatio < THINK_MIN_RATIO) {
|
||||
thinkTime = maxThinkTime;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class MCTSNode {
|
|||
if (game.getStep().getStepPart() == StepPart.PRIORITY) {
|
||||
playerId = game.getPriorityPlayerId();
|
||||
} else {
|
||||
if (game.getStep().getType() == PhaseStep.DECLARE_BLOCKERS) {
|
||||
if (game.getTurnStepType() == PhaseStep.DECLARE_BLOCKERS) {
|
||||
playerId = game.getCombat().getDefenders().iterator().next();
|
||||
} else {
|
||||
playerId = game.getActivePlayerId();
|
||||
|
|
@ -129,7 +129,7 @@ public class MCTSNode {
|
|||
}
|
||||
switch (player.getNextAction()) {
|
||||
case PRIORITY:
|
||||
// logger.info("Priority for player:" + player.getName() + " turn: " + game.getTurnNum() + " phase: " + game.getPhase().getType() + " step: " + game.getStep().getType());
|
||||
// logger.info("Priority for player:" + player.getName() + " turn: " + game.getTurnNum() + " phase: " + game.getTurnPhaseType() + " step: " + game.getTurnStepType());
|
||||
List<Ability> abilities;
|
||||
if (!USE_ACTION_CACHE)
|
||||
abilities = player.getPlayableOptions(game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue