if (glancing) { damage = (int)Math.floor((double)damage/2.0); }
    private void resolveKickAttack(PhysicalResult pr, int lastEntityId) {        KickAttackAction kaa = (KickAttackAction)pr.aaa;        final Entity ae = game.getEntity(kaa.getEntityId());        final Targetable target = game.getTarget(kaa.getTargetType(), kaa.getTargetId());        Entity te = null;        if (target.getTargetType() == Targetable.TYPE_ENTITY) {            te = (Entity)target;        }        final String legName = kaa.getLeg() == KickAttackAction.LEFT        ? "Left Leg"        : "Right Leg";        // get damage, ToHitData and roll from the PhysicalResult        int damage = pr.damage;        final ToHitData toHit = pr.toHit;        int roll = pr.roll;        final boolean targetInBuilding = Compute.isInBuilding( game, te );        // Which building takes the damage?        Building bldg = game.board.getBuildingAt( target.getPosition() );        if (lastEntityId != ae.getId()) {            phaseReport.append("\nPhysical attacks for " ).append( ae.getDisplayName() ).append( "\n");        }        phaseReport.append("    Kick (" ).append( legName ).append( ") at " ).append( target.getDisplayName());//        // should we even bother?//        if (te.isDestroyed() || te.isDoomed() || te.crew.isDead()) {//            phaseReport.append(" but the target is already destroyed!\n");//            return;//        }        if (toHit.getValue() == ToHitData.IMPOSSIBLE) {            phaseReport.append(", but the kick is impossible (" ).append( toHit.getDesc() ).append( ")\n");            game.addPSR(new PilotingRollData(ae.getId(), 0, "missed a kick"));            return;        } else if (toHit.getValue() == ToHitData.AUTOMATIC_SUCCESS) {            phaseReport.append(", the kick is an automatic hit (" ).append( toHit.getDesc() ).append( "), ");            roll = Integer.MAX_VALUE;        } else {            phaseReport.append("; needs " ).append( toHit.getValue() ).append( ", ");            phaseReport.append("rolls " ).append( roll ).append( " : ");        }        // do we hit?        if (roll < toHit.getValue()) {            // miss            phaseReport.append("misses.\n");            game.addPSR(new PilotingRollData(ae.getId(), 0, "missed a kick"));            // 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 ) {                    phaseReport.append( "  " )                        .append( damageBuilding( bldg, damage ) )                        .append( "\n" );                }            }            return;        }        // Targeting a building.        if ( target.getTargetType() == Targetable.TYPE_BUILDING ) {            // The building takes the full brunt of the attack.            phaseReport.append( "hits.\n  " )                .append( damageBuilding( bldg, damage ) )                .append( "\n" );            // Damage any infantry in the hex.            this.damageInfantryIn( bldg, damage );            // And we're done!            return;        }        HitData hit = te.rollHitLocation(toHit.getHitTable(), toHit.getSideTable());        phaseReport.append("hits" ).append( toHit.getTableDesc() ).append( " " ).append( te.getLocationAbbr(hit));        // 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;            phaseReport.append( "\n  " )                .append( damageBuilding( bldg, toBldg ) );        }        // A building may absorb the entire shot.        if ( damage == 0 ) {            phaseReport.append( "\n  " )                .append( te.getDisplayName() )                .append( " suffers no damage." );        } else {            phaseReport.append( damageEntity(te, hit, damage) );        }        if (te.getMovementType() == Entity.MovementType.BIPED || te.getMovementType() == Entity.MovementType.QUAD) {            PilotingRollData kickPRD = new PilotingRollData(te.getId(), getKickPushPSRMod(ae, te, 0), "was kicked");            kickPRD.setCumulative(false); // see Bug# 811987 for more info            game.addPSR(kickPRD);        }        phaseReport.append("\n");    }