IHex fallHex = game.board.getHex(fallPos);
IHex fallHex = game.getBoard().getHex(fallPos);
    private void doEntityFall(Entity entity, Coords fallPos, int height, int facing, PilotingRollData roll) {        IHex fallHex = game.board.getHex(fallPos);        // we don't need to deal damage yet, if the entity is doing DFA        if (entity.isMakingDfa()) {            phaseReport.append("But, since the 'mech is making a death from above attack, damage will be dealt during the physical phase.\n");            entity.setProne(true);            return;        }        // facing after fall        String side;        int table;        switch(facing) {            case 1:            case 2:                side = "right side";                table = ToHitData.SIDE_RIGHT;                break;            case 3:                side = "rear";                table = ToHitData.SIDE_REAR;                break;            case 4:            case 5:                side = "left side";                table = ToHitData.SIDE_LEFT;                break;            case 0:            default:                side = "front";                table = ToHitData.SIDE_FRONT;        }        int waterDepth = fallHex.terrainLevel(Terrains.WATER);        int damageHeight = height;        // HACK: if the dest hex is water, assume that the fall height given is        // to the floor of the hex, and modifiy it so that it's to the surface        if (waterDepth > 0) {            damageHeight = Math.max(height - waterDepth, 0);        }        // calculate damage for hitting the surface        int damage = (int)Math.round(entity.getWeight() / 10.0) * (damageHeight + 1);        // calculate damage for hitting the ground, but only if we actually fell        // into water        // if we fell onto the water surface, that damage is halved.        int waterDamage = 0;        if (waterDepth > 0) {            damage /= 2;            waterDamage = (int)Math.round(entity.getWeight() / 10.0) * (waterDepth + 1) /2;        }        // If the waterDepth is larger than the fall height,        // we fell underwater        if (waterDepth > height) {            damage = 0;            waterDamage = (int)Math.round(entity.getWeight() / 10.0) * (height + 1) /2;        }        // adjust damage for gravity        damage = (int)Math.round(damage * game.getOptions().floatOption("gravity"));        waterDamage = (int)Math.round(waterDamage * game.getOptions().floatOption("gravity"));        // report falling        if (waterDamage == 0) {            phaseReport.append("    " ).append( entity.getDisplayName() ).append( " falls on its " ).append( side ).append( ", suffering " ).append( damage ).append( " damage.");        } else if (damage > 0) {            phaseReport.append("    " ).append( entity.getDisplayName() ).append( " falls on its " ).append( side ).append( ", suffering " ).append( damage ).append( " damage when hitting the water surface and ")                       .append(waterDamage).append(" when hitting the ground");        } else {            phaseReport.append("    " ).append( entity.getDisplayName() ).append( " falls on its " ).append( side ).append( ", suffering " ).append( waterDamage ).append( " damage.");        }        damage += waterDamage;        // Any swarming infantry will be dislodged, but we don't want to        // interrupt the fall's report.  We have to get the ID now because        // the fall may kill the entity which will reset the attacker ID.        final int swarmerId = entity.getSwarmAttackerId();        // Positioning must be prior to damage for proper handling of breaches        // Only Mechs can fall prone.        if ( entity instanceof Mech ) {            entity.setProne(true);        }        entity.setPosition(fallPos);        entity.setFacing((entity.getFacing() + (facing - 1)) % 6);        entity.setSecondaryFacing(entity.getFacing());        if (fallHex.terrainLevel(Terrains.WATER) > 0) {            for (int loop=0; loop< entity.locations();loop++){                entity.setLocationStatus(loop, Entity.LOC_WET);            }        }        // standard damage loop        while (damage > 0) {            int cluster = Math.min(5, damage);            HitData hit = entity.rollHitLocation(ToHitData.HIT_NORMAL, table);            phaseReport.append(damageEntity(entity, hit, cluster));            damage -= cluster;        }        //check for location exposure        doSetLocationsExposure(entity, fallHex, fallHex.hasPavement(), false);        // pilot damage?        roll.removeAutos();        if (height > 0) {            roll.addModifier(height, "height of fall");        }        if (roll.getValue() == PilotingRollData.AUTOMATIC_FAIL) {            phaseReport.append("\nPilot of " ).append( entity.getDisplayName()            ).append( " \"" ).append( entity.crew.getName() ).append( "\" cannot avoid damage.\n");            phaseReport.append(damageCrew(entity, 1) ).append( "\n");        } else {            int diceRoll = Compute.d6(2);            phaseReport.append("\nPilot of " ).append( entity.getDisplayName()            ).append( " \"" ).append( entity.crew.getName() ).append( "\" must roll " ).append( roll.getValueAsString()            ).append( " to avoid damage; rolls " ).append( diceRoll ).append( " : ");            if (diceRoll >= roll.getValue()) {                phaseReport.append("succeeds.\n");            } else {                phaseReport.append("fails.\n");                phaseReport.append(damageCrew(entity, 1) ).append( "\n");            }        }        // Now dislodge any swarming infantry.        if ( Entity.NONE != swarmerId ) {            final Entity swarmer = game.getEntity( swarmerId );            entity.setSwarmAttackerId( Entity.NONE );            swarmer.setSwarmTargetId( Entity.NONE );            // Did the infantry fall into water?            if ( fallHex.terrainLevel(Terrains.WATER) > 0 ) {                // Swarming infantry die.                swarmer.setPosition( fallPos );                phaseReport.append("    ")                    .append(swarmer.getDisplayName())                    .append(" is dislodged and drowns!")                    .append(destroyEntity(swarmer, "a watery grave", false));            } else {                // Swarming infantry take an 11 point hit.                // ASSUMPTION : damage should not be doubled.                phaseReport.append("    ")                    .append(swarmer.getDisplayName())                    .append(" is dislodged and suffers 11 damage.")                    .append( damageEntity(swarmer,                                          swarmer.rollHitLocation(ToHitData.HIT_NORMAL, ToHitData.SIDE_FRONT),                                          11) )                    .append( "\n" );            }            swarmer.setPosition( fallPos );            entityUpdate( swarmerId );        } // End dislodge-infantry        // clear all PSRs after a fall -- the Mek has already failed ONE and fallen, it'd be cruel to make it fail some more!        game.resetPSRs(entity);    }