}
// If the swarmer has Assault claws, give a 1 modifier.
// We can stop looking when we find our first match.
for (Mounted mount : swarmer.getMisc()) {
EquipmentType equip = mount.getType();
if (BattleArmor.ASSAULT_CLAW.equals(equip.getInternalName())) {
roll.addModifier(1, "swarmer has assault claws");
break;
}
}
// okay, print the info
r = new Report(2125);
r.subject = entity.getId();
r.addDesc(entity);
addReport(r);
// roll
final int diceRoll = Compute.d6(2);
r = new Report(2130);
r.subject = entity.getId();
r.add(roll.getValueAsString());
r.add(roll.getDesc());
r.add(diceRoll);
if (diceRoll < roll.getValue()) {
r.choose(false);
addReport(r);
} else {
// Dislodged swarmers don't get turns.
game.removeTurnFor(swarmer);
send(createTurnVectorPacket());
// Update the report and the swarmer's status.
r.choose(true);
addReport(r);
entity.setSwarmAttackerId(Entity.NONE);
swarmer.setSwarmTargetId(Entity.NONE);
IHex curHex = game.getBoard().getHex(curPos);
// Did the infantry fall into water?
if (curHex.terrainLevel(Terrains.WATER) > 0) {
// Swarming infantry die.
swarmer.setPosition(curPos);
r = new Report(2135);
r.subject = entity.getId();
r.indent();
r.addDesc(swarmer);
addReport(r);
addReport(destroyEntity(swarmer, "a watery grave", false));
} else {
// Swarming infantry take a 3d6 point hit.
// ASSUMPTION : damage should not be doubled.
r = new Report(2140);
r.subject = entity.getId();
r.indent();
r.addDesc(swarmer);
r.add("3d6");
addReport(r);
addReport(damageEntity(swarmer, swarmer.rollHitLocation(ToHitData.HIT_NORMAL, ToHitData.SIDE_FRONT), Compute.d6(3)));
addNewLines();
swarmer.setPosition(curPos);
}
entityUpdate(swarmerId);
} // End successful-PSR
} // End try-to-dislodge-swarmers
// but the danger isn't over yet! landing from a jump can be risky!
if ((overallMoveType == IEntityMovementType.MOVE_JUMP) && !entity.isMakingDfa()) {
final IHex curHex = game.getBoard().getHex(curPos);
// check for damaged criticals
rollTarget = entity.checkLandingWithDamage(overallMoveType);
if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {
doSkillCheckInPlace(entity, rollTarget);
}
// jumped into water?
int waterLevel = curHex.terrainLevel(Terrains.WATER);
if (curHex.containsTerrain(Terrains.ICE) && (waterLevel > 0)) {
if(!(entity instanceof Infantry)) {
waterLevel = 0;
// check for breaking ice
int roll = Compute.d6(1);
r = new Report(2122);
r.add(entity.getDisplayName(), true);
r.add(roll);
r.subject = entity.getId();
addReport(r);
if (roll >= 4) {
// oops!
entity.setPosition(curPos);
addReport(resolveIceBroken(curPos));
curPos = entity.getPosition();
} else {
//TacOps: immediate PSR with +4 for terrain. If you fall then may break the ice after all
rollTarget = entity.checkLandingOnIce(overallMoveType, curHex);
if(!doSkillCheckInPlace(entity, rollTarget)) {
//apply damage now, or it will show up as a possible breach, if ice is broken
entity.applyDamage();
roll = Compute.d6(1);
r = new Report(2118);
r.addDesc(entity);
r.add(roll);
r.subject = entity.getId();
addReport(r);
if(roll == 6) {
entity.setPosition(curPos);
addReport(resolveIceBroken(curPos));
curPos = entity.getPosition();
}
}
}
}
} else if (!(prevStep.climbMode() && curHex.containsTerrain(Terrains.BRIDGE))) {
rollTarget = entity.checkWaterMove(waterLevel, overallMoveType);
if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {
doSkillCheckInPlace(entity, rollTarget);
}
if (waterLevel > 1) {
// Any swarming infantry will be destroyed.
drownSwarmer(entity, curPos);
}
}
// check for building collapse
Building bldg = game.getBoard().getBuildingAt(curPos);
if (bldg != null) {
checkForCollapse(bldg, game.getPositionMap(), curPos, true);
}
// check for breaking magma crust
if (curHex.terrainLevel(Terrains.MAGMA) == 1) {
int roll = Compute.d6(1);
r = new Report(2395);
r.addDesc(entity);
r.add(roll);
r.subject = entity.getId();
addReport(r);
if (roll == 6) {
curHex.removeTerrain(Terrains.MAGMA);
curHex.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.MAGMA, 2));
sendChangedHex(curPos);
for (Enumeration<Entity> e = game.getEntities(curPos); e.hasMoreElements();) {
Entity en = e.nextElement();
if (en != entity) {
doMagmaDamage(en, false);
}
}
}
}
// check for entering liquid magma
if (curHex.terrainLevel(Terrains.MAGMA) == 2) {
doMagmaDamage(entity, false);
}
// jumped into swamp? maybe stuck!
if (curHex.getBogDownModifier(entity.getMovementMode(), entity instanceof LargeSupportTank) != TargetRoll.AUTOMATIC_SUCCESS) {
if (entity instanceof Mech) {
entity.setStuck(true);
r = new Report(2121);
r.add(entity.getDisplayName(), true);
r.subject = entity.getId();
addReport(r);
//check for quicksand
addReport(checkQuickSand(curPos));
} else {
PilotingRollData roll = new PilotingRollData(entity.getId(), 5, "entering boggy terrain");
roll.append(new PilotingRollData(entity.getId(), curHex.getBogDownModifier(entity.getMovementMode(), entity instanceof LargeSupportTank), "avoid bogging down"));
if (0 < doSkillCheckWhileMoving(entity, curPos, curPos, roll, false)) {
entity.setStuck(true);
r = new Report(2081);
r.add(entity.getDisplayName());
r.subject = entity.getId();
addReport(r);
//check for quicksand
addReport(checkQuickSand(curPos));
}
}
}
// If the entity is being swarmed, jumping may dislodge the fleas.
if (Entity.NONE != swarmerId) {
final Entity swarmer = game.getEntity(swarmerId);
final PilotingRollData roll = entity.getBasePilotingRoll(overallMoveType);
entity.addPilotingModifierForTerrain(roll);
// Add a +4 modifier.
roll.addModifier(4, "dislodge swarming infantry");
// If the swarmer has Assault claws, give a 1 modifier.
// We can stop looking when we find our first match.
for (Mounted mount : swarmer.getMisc()) {
EquipmentType equip = mount.getType();
if (BattleArmor.ASSAULT_CLAW.equals(equip.getInternalName())) {
roll.addModifier(1, "swarmer has assault claws");
break;
}
}