// And we're done!
return;
}
HitData hit = te.rollHitLocation(toHit.getHitTable(), toHit.getSideTable());
hit.setGeneralDamageType(HitData.DAMAGE_PHYSICAL);
r = new Report(4045);
r.subject = ae.getId();
r.add(toHit.getTableDesc());
r.add(te.getLocationAbbr(hit));
r.newlines = 0;
addReport(r);
// The building shields all units from a certain amount of damage.
// The amount is based upon the building's CF at the phase's start.
if (targetInBuilding && (bldg != null)) {
int bldgAbsorbs = (int) Math.ceil(bldg.getPhaseCF(target.getPosition()) / 10.0);
int toBldg = Math.min(bldgAbsorbs, damage);
damage -= toBldg;
addNewLines();
Vector<Report> buildingReport = damageBuilding(bldg, damage, target.getPosition());
for (Report report : buildingReport) {
report.subject = ae.getId();
}
addReport(buildingReport);
}
// A building may absorb the entire shot.
if (damage == 0) {
r = new Report(4050);
r.subject = ae.getId();
r.add(te.getShortName());
r.add(te.getOwner().getName());
r.newlines = 0;
addReport(r);
} else {
if (glancing) {
damage = (int) Math.floor(damage / 2.0);
}
if (directBlow) {
damage += toHit.getMoS() / 3;
hit.makeDirectBlow(toHit.getMoS() / 3);
}
addReport(damageEntity(te, hit, damage, false, DamageType.NONE, false, false, throughFront));
}
addNewLines();