if (entity instanceof VTOL || entity.getMovementMode()==IEntityMovementMode.VTOL) {  if (entity.getElevation()!=0 && entity.getElevation()!=hex.terrainLevel(Terrains.BLDG_ELEV) && entity.getElevation()!=hex.terrainLevel(Terrains.BRIDGE_ELEV)) {
if(flak) {  if (!(entity instanceof VTOL || entity.getMovementMode()==IEntityMovementMode.VTOL)) {
    void artilleryDamageHex(Coords coords, Coords attackSource, int damage, AmmoType ammo, int subjectId, Entity killer, Entity exclude) {        IHex hex = game.getBoard().getHex(coords);        if(hex == null) return; //not on board.        Report r;        Building bldg = game.getBoard().getBuildingAt(coords);        int bldgAbsorbs = 0;        if(bldg != null) {            bldgAbsorbs = bldg.getPhaseCF() / 10;            if(!(ammo != null && ammo.getMunitionType() == AmmoType.M_FLECHETTE)) {                //damage the building                r = damageBuilding( bldg, damage );                r.subject = subjectId;                addReport(r);                addNewLines();            }        }        // get units in hex        for (Enumeration impactHexHits = game.getEntities(coords);impactHexHits.hasMoreElements();) {            Entity entity = (Entity)impactHexHits.nextElement();            int hits = damage;            ToHitData toHit = new ToHitData();            int cluster = 5;                        //Check: is entity excluded?            if(entity == exclude)                continue;            //Check: is entity inside building?            if(bldg != null &&               bldgAbsorbs > 0 &&               entity.getElevation() < hex.terrainLevel(Terrains.BLDG_ELEV)) {                cluster -= bldgAbsorbs;                if(entity instanceof Infantry) {                    continue; //took its damage already from building damage                }                else if(cluster <= 0) {                    //entity takes no damage                    r = new Report(6426);                    r.subject = subjectId;                    r.addDesc(entity);                    addReport(r);                    continue;                } else {                    r = new Report(6425);                    r.subject = subjectId;                    r.add(bldgAbsorbs);                    addReport(r);                }            }            //Check: is entity a VTOL in flight?            if (entity instanceof VTOL ||                entity.getMovementMode()==IEntityMovementMode.VTOL) {                // VTOLs take no damage from normal artillery unless landed                if (entity.getElevation()!=0                    && entity.getElevation()!=hex.terrainLevel(Terrains.BLDG_ELEV)                    && entity.getElevation()!=hex.terrainLevel(Terrains.BRIDGE_ELEV)) {                    continue;                }            }            //Work out hit table to use            if (attackSource!=null) {                toHit.setSideTable(entity.sideTable(attackSource));                if(ammo != null                    && entity instanceof Mech                   && ammo.getMunitionType() == AmmoType.M_CLUSTER                   && attackSource.equals(coords)) {                    toHit.setHitTable(ToHitData.HIT_ABOVE);                }            }            //Entity/ammo specific damage modifiers            if(ammo != null) {                if(ammo.getMunitionType() == AmmoType.M_CLUSTER) {                    if(hex.containsTerrain(Terrains.FORTIFIED)                             && entity instanceof Infantry                            && !(entity instanceof BattleArmor)) {                        hits *= 2;                    }                    if(hex.containsTerrain(Terrains.WOODS)                            || hex.containsTerrain(Terrains.JUNGLE)) {                        hits = (hits + 1) / 2;                    }                }                else if(ammo.getMunitionType() == AmmoType.M_FLECHETTE) {                    //wheeled and hover tanks take movement critical                    if(entity instanceof Tank &&                       (entity.getMovementMode() == IEntityMovementMode.WHEELED ||                        entity.getMovementMode() == IEntityMovementMode.HOVER)) {                        r = new Report(6480);                        r.subject = entity.getId();                        r.addDesc(entity);                        r.add(toHit.getTableDesc());                        r.add(0);                        addReport(r);                        vehicleMotiveDamage((Tank)entity, 0);                        continue;                    }                    //non infantry are immune                    if(entity instanceof BattleArmor ||                       !(entity instanceof Infantry)) {                        continue;                    }                    if(hex.containsTerrain(Terrains.WOODS)                            || hex.containsTerrain(Terrains.JUNGLE)) {                        hits = (hits + 1) / 2;                    }                }            }            //Do the damage            addNewLines();            r = new Report(6480);            r.subject = entity.getId();            r.addDesc(entity);            r.add(toHit.getTableDesc());            r.add(hits);            addReport(r);            while(hits>0) {                HitData hit = entity.rollHitLocation(toHit.getHitTable(), toHit.getSideTable());                addReport( damageEntity(entity, hit, Math.min(cluster, hits), false, 0, false, true, false));                hits -= Math.min(5,hits);            }            if(killer != null) {                creditKill(entity, killer);            }            addNewLines();        }    }