Vector<Report> vPhaseReport = new Vector<Report>();
IHex h = game.getBoard().getHex(c);
if (h == null) {
return vPhaseReport;
}
ITerrain woods = h.getTerrain(Terrains.WOODS);
ITerrain jungle = h.getTerrain(Terrains.JUNGLE);
ITerrain ice = h.getTerrain(Terrains.ICE);
ITerrain magma = h.getTerrain(Terrains.MAGMA);
Report r;
if (woods != null) {
int tf = woods.getTerrainFactor() - nDamage;
int level = woods.getLevel();
if (tf <= 0) {
h.removeTerrain(Terrains.WOODS);
h.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.ROUGH, 1));
// light converted to rough
r = new Report(3090);
r.subject = entityId;
vPhaseReport.add(r);
} else if ((tf <= 50) && (level > 1)) {
h.removeTerrain(Terrains.WOODS);
h.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.WOODS, 1));
woods = h.getTerrain(Terrains.WOODS);
// heavy converted to light
r = new Report(3085);
r.subject = entityId;
vPhaseReport.add(r);
} else if ((tf <= 90) && (level > 2)) {
h.removeTerrain(Terrains.WOODS);
h.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.WOODS, 2));
woods = h.getTerrain(Terrains.WOODS);
// ultra heavy converted to heavy
r = new Report(3082);
r.subject = entityId;
vPhaseReport.add(r);
}
woods.setTerrainFactor(tf);
}
if (jungle != null) {
int tf = jungle.getTerrainFactor() - nDamage;
int level = jungle.getLevel();
if (tf < 0) {
h.removeTerrain(Terrains.JUNGLE);
h.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.ROUGH, 1));
// light converted to rough
r = new Report(3091);
r.subject = entityId;
vPhaseReport.add(r);
} else if ((tf <= 50) && (level > 1)) {
h.removeTerrain(Terrains.JUNGLE);
h.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.JUNGLE, 1));
jungle = h.getTerrain(Terrains.JUNGLE);
// heavy converted to light
r = new Report(3086);
r.subject = entityId;
vPhaseReport.add(r);
} else if ((tf <= 90) && (level > 2)) {
h.removeTerrain(Terrains.JUNGLE);
h.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.JUNGLE, 2));
jungle = h.getTerrain(Terrains.JUNGLE);
// ultra heavy converted to heavy
r = new Report(3083);
r.subject = entityId;
vPhaseReport.add(r);
}
jungle.setTerrainFactor(tf);
}
if (ice != null) {
int tf = ice.getTerrainFactor() - nDamage;
if (tf <= 0) {
// ice melted
r = new Report(3092);
r.subject = entityId;
vPhaseReport.add(r);
vPhaseReport.addAll(resolveIceBroken(c));
} else {
ice.setTerrainFactor(tf);
}
}
if ((magma != null) && (magma.getLevel() == 1)) {
int tf = magma.getTerrainFactor() - nDamage;
if (tf <= 0) {
// magma crust destroyed
r = new Report(3093);
r.subject = entityId;
vPhaseReport.add(r);
h.removeTerrain(Terrains.MAGMA);
h.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.MAGMA, 2));
for (Enumeration<Entity> e = getGame()
.getEntities(c); e.hasMoreElements();) {
doMagmaDamage(e.nextElement(), false);
}
} else {
magma.setTerrainFactor(tf);
}
}
sendChangedHex(c);
//any attempt to clear an heavy industrial hex may cause an exposion