vPhaseReport.addElement(buildingReport);
addReport(buildingReport);
    private void resolveProtoAttack(PhysicalResult pr, int lastEntityId) {        final ProtomechPhysicalAttackAction ppaa = (ProtomechPhysicalAttackAction)pr.aaa;        final Entity ae = game.getEntity(ppaa.getEntityId());        // get damage, ToHitData and roll from the PhysicalResult        int damage = pr.damage;        final ToHitData toHit = pr.toHit;        int roll = pr.roll;        final Targetable target = game.getTarget(ppaa.getTargetType(), ppaa.getTargetId());        Entity te = null;        if (target.getTargetType() == Targetable.TYPE_ENTITY) {            te = (Entity)target;        }        boolean throughFront = true;        if (te!=null) {            throughFront = Compute.isThroughFrontHex(game, ppaa.getEntityId(), te);        }        final boolean targetInBuilding = Compute.isInBuilding( game, te );        final boolean glancing = (game.getOptions().booleanOption("maxtech_glancing_blows") && (roll == toHit.getValue()));        Report r;        // Which building takes the damage?        Building bldg = game.getBoard().getBuildingAt( target.getPosition() );        if (lastEntityId != ae.getId()) {            //who is making the attacks            r = new Report(4005);            r.subject = ae.getId();            r.addDesc(ae);            vPhaseReport.addElement(r);        }        r = new Report(4070);        r.subject = ae.getId();        r.indent();        r.add(target.getDisplayName());        r.newlines = 0;        vPhaseReport.addElement(r);        if (toHit.getValue() == ToHitData.IMPOSSIBLE) {            r = new Report(4075);            r.subject = ae.getId();            r.add(toHit.getDesc());            vPhaseReport.addElement(r);            return;        } else if (toHit.getValue() == ToHitData.AUTOMATIC_SUCCESS) {            r = new Report(4080);            r.subject = ae.getId();            r.add(toHit.getDesc());            r.newlines = 0;            vPhaseReport.addElement(r);            roll = Integer.MAX_VALUE;        } else {            // report the roll            r = new Report(4025);            r.subject = ae.getId();            r.add(toHit.getValue());            r.add(roll);            r.newlines = 0;            vPhaseReport.addElement(r);            if (glancing) {                r = new Report(4030);                r.subject = ae.getId();                r.newlines = 0;                vPhaseReport.addElement(r);            }        }        // do we hit?        if (roll < toHit.getValue()) {            // miss            r = new Report(4035);            r.subject = ae.getId();            vPhaseReport.addElement(r);            // If the target is in a building, the building absorbs the damage.            if ( targetInBuilding && bldg != null ) {                // Only report if damage was done to the building.                if ( damage > 0 ) {                    Report buildingReport = damageBuilding( bldg, damage );                    buildingReport.indent();                    buildingReport.subject = ae.getId();                    vPhaseReport.addElement(buildingReport);                }            }            return;        }        // Targeting a building.        if ( target.getTargetType() == Targetable.TYPE_BUILDING ) {            // The building takes the full brunt of the attack.            r = new Report(4040);            r.subject = ae.getId();            vPhaseReport.addElement(r);            Report buildingReport = damageBuilding( bldg, damage );            buildingReport.indent();            buildingReport.subject = ae.getId();            vPhaseReport.addElement(buildingReport);            // Damage any infantry in the hex.            this.damageInfantryIn( bldg, damage );            // And we're done!            return;        }        HitData hit = te.rollHitLocation(toHit.getHitTable(), toHit.getSideTable());        r = new Report(4045);        r.subject = ae.getId();        r.add(toHit.getTableDesc());        r.add(te.getLocationAbbr(hit));        r.newlines = 0;        vPhaseReport.addElement(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() / 10.0 );            int toBldg = Math.min( bldgAbsorbs, damage );            damage -= toBldg;            Report.addNewline(vPhaseReport);            Report buildingReport = damageBuilding( bldg, toBldg );            buildingReport.indent();            buildingReport.subject = ae.getId();            vPhaseReport.addElement(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;            vPhaseReport.addElement(r);        } else {            if (glancing) {                damage = (int)Math.floor(damage/2.0);            }            vPhaseReport.addAll(damageEntity(te, hit, damage));        }        Report.addNewline(vPhaseReport);    }