case PHASE_SET_ARTYAUTOHITHEXES:
sendSpecialHexDisplayPackets();
Enumeration<Player> e = game.getPlayers();
boolean mines = false;
while (e.hasMoreElements() && !mines) {
Player p = e.nextElement();
if (p.hasMinefields()) {
mines = true;
}
}
if (mines) {
changePhase(IGame.Phase.PHASE_DEPLOY_MINEFIELDS);
} else {
changePhase(IGame.Phase.PHASE_INITIATIVE);
}
break;
case PHASE_DEPLOY_MINEFIELDS:
changePhase(IGame.Phase.PHASE_INITIATIVE);
break;
case PHASE_DEPLOYMENT:
game.clearDeploymentThisRound();
game.checkForCompleteDeployment();
Enumeration<Player> pls = game.getPlayers();
while (pls.hasMoreElements()) {
Player p = pls.nextElement();
p.adjustStartingPosForReinforcements();
}
if (game.getRoundCount() < 1) {
changePhase(IGame.Phase.PHASE_INITIATIVE);
} else {
changePhase(IGame.Phase.PHASE_TARGETING);
}
break;
case PHASE_INITIATIVE:
game.addReports(vPhaseReport);
changePhase(IGame.Phase.PHASE_INITIATIVE_REPORT);
break;
case PHASE_INITIATIVE_REPORT:
// boolean doDeploy = game.shouldDeployThisRound() &&
// (game.getLastPhase() != IGame.Phase.PHASE_DEPLOYMENT);
if (game.shouldDeployThisRound()) {
changePhase(IGame.Phase.PHASE_DEPLOYMENT);
} else {
changePhase(IGame.Phase.PHASE_TARGETING);
}
break;
case PHASE_MOVEMENT:
doAllAssaultDrops();
addMovementHeat();
applyBuildingDamage();
checkForPSRFromDamage();
addReport(resolvePilotingRolls()); // Skids cause damage in
// movement phase
checkForFlamingDamage();
checkForTeleMissileAttacks();
// check phase report
if (vPhaseReport.size() > 1) {
game.addReports(vPhaseReport);
changePhase(IGame.Phase.PHASE_MOVEMENT_REPORT);
} else {
// just the header, so we'll add the <nothing> label
addReport(new Report(1205, Report.PUBLIC));
game.addReports(vPhaseReport);
sendReport();
changePhase(IGame.Phase.PHASE_OFFBOARD);
}
break;
case PHASE_MOVEMENT_REPORT:
changePhase(IGame.Phase.PHASE_OFFBOARD);
break;
case PHASE_FIRING:
resolveAllButWeaponAttacks();
reportGhostTargetRolls();
reportLargeCraftECCMRolls();
resolveOnlyWeaponAttacks();
assignAMS();
handleAttacks();
resolveScheduledNukes();
applyBuildingDamage();
checkForPSRFromDamage();
addReport(resolvePilotingRolls());
// check phase report
if (vPhaseReport.size() > 1) {
game.addReports(vPhaseReport);
changePhase(IGame.Phase.PHASE_FIRING_REPORT);
} else {
// just the header, so we'll add the <nothing> label
addReport(new Report(1205, Report.PUBLIC));
sendReport();
game.addReports(vPhaseReport);
changePhase(IGame.Phase.PHASE_PHYSICAL);
}
break;
case PHASE_FIRING_REPORT:
changePhase(IGame.Phase.PHASE_PHYSICAL);
break;
case PHASE_PHYSICAL:
resolvePhysicalAttacks();
applyBuildingDamage();
checkForPSRFromDamage();
addReport(resolvePilotingRolls());
resolveSinkVees();
// check phase report
if (vPhaseReport.size() > 1) {
game.addReports(vPhaseReport);
changePhase(IGame.Phase.PHASE_PHYSICAL_REPORT);
} else {
// just the header, so we'll add the <nothing> label
addReport(new Report(1205, Report.PUBLIC));
game.addReports(vPhaseReport);
sendReport();
changePhase(IGame.Phase.PHASE_END);
}
break;
case PHASE_PHYSICAL_REPORT:
changePhase(IGame.Phase.PHASE_END);
break;
case PHASE_TARGETING:
vPhaseReport.addElement(new Report(1035, Report.PUBLIC));
resolveAllButWeaponAttacks();
resolveOnlyWeaponAttacks();
handleAttacks();
// check reports
if (vPhaseReport.size() > 1) {
game.addReports(vPhaseReport);
changePhase(IGame.Phase.PHASE_TARGETING_REPORT);
} else {
// just the header, so we'll add the <nothing> label
vPhaseReport.addElement(new Report(1205, Report.PUBLIC));
game.addReports(vPhaseReport);
sendReport();
changePhase(IGame.Phase.PHASE_MOVEMENT);
}
sendSpecialHexDisplayPackets();
break;
case PHASE_OFFBOARD:
// write Offboard Attack Phase header
addReport(new Report(1100, Report.PUBLIC));
resolveAllButWeaponAttacks(); // torso twist or flip arms
// possible
resolveOnlyWeaponAttacks(); // should only be TAG at this point
handleAttacks();
for (Enumeration<Player> i = game.getPlayers(); i.hasMoreElements();) {
Player player = i.nextElement();
int connId = player.getId();
send(connId, createArtilleryPacket(player));
}
applyBuildingDamage();
checkForPSRFromDamage();
addReport(resolvePilotingRolls());