Fixed potential NPE errors in getPhase usage (fixed Berserker's Frenzy, etc)

This commit is contained in:
Oleg Agafonov 2023-03-25 16:01:27 +04:00
parent cfd7464b49
commit a15a0daa04
81 changed files with 162 additions and 130 deletions

View file

@ -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;