int m=missiles; for (int i=0; i<m; i++) { int roll=Compute.d6(2); LosEffects le=LosEffects.calculateLos(game, ae.getId(), t); if (te.removePartialCoverHits(roll, le.getTargetCover(), Compute.targetSideTable(ae, t))) { missiles--; } } if (missiles!=m) { r = new Report(3403); r.add(m-missiles); addReport(r); }
    private void deliverInfernoMissiles(Entity ae, Targetable t, int missiles) {        IHex hex = game.getBoard().getHex(t.getPosition());        Report r;        //inferno missiles hit        r = new Report(3370);        r.subject = ae.getId();        r.add(missiles);        addReport(r);        switch(t.getTargetType()) {        case Targetable.TYPE_HEX_ARTILLERY:            //used for BA inferno explosion            for(Enumeration<Entity> entities = game.getEntities(t.getPosition());entities.hasMoreElements();) {                Entity e = entities.nextElement();                if(e.getElevation() > hex.terrainLevel(Terrains.BLDG_ELEV)) {                    r = new Report(6685);                    r.subject = e.getId();                    r.addDesc(e);                    addReport(r);                    deliverInfernoMissiles(ae, e, missiles);                } else {                    int roll = Compute.d6();                    r = new Report(3570);                    r.subject = e.getId();                    r.addDesc(e);                    r.add(roll);                    addReport(r);                    if(roll>=5) {                        deliverInfernoMissiles(ae, e, missiles);                    }                }            }            if(game.getBoard().getBuildingAt(t.getPosition()) != null) {                addReport(damageBuilding(game.getBoard().getBuildingAt(t.getPosition()), 2*missiles));            }            //fall through        case Targetable.TYPE_HEX_CLEAR:        case Targetable.TYPE_HEX_IGNITE:            tryClearHex(t.getPosition(), missiles * 4, ae.getId());            tryIgniteHex(t.getPosition(),ae.getId(), true, 0);            break;        case Targetable.TYPE_BLDG_IGNITE:        case Targetable.TYPE_BUILDING:            for(Enumeration<Entity> entities = game.getEntities(t.getPosition());entities.hasMoreElements();) {                Entity e = entities.nextElement();                if(e.getElevation() > hex.terrainLevel(Terrains.BLDG_ELEV))                    continue;                int roll = Compute.d6();                r = new Report(3560);                r.subject = e.getId();                r.addDesc(e);                r.add(roll);                addReport(r);                if(roll>=5) {                    deliverInfernoMissiles(ae, e, missiles);                }            }            addReport(damageBuilding(game.getBoard().getBuildingAt(t.getPosition()), 2*missiles));            break;        case Targetable.TYPE_ENTITY:            Entity te = (Entity)t;            if(te instanceof Mech) {                r = new Report(3400);                r.add(2*missiles);                r.subject = te.getId();                r.choose(true);                addReport(r);                te.heatFromExternal += 2*missiles;            }            else if(te instanceof Tank                    || te instanceof Protomech) {                if(game.getOptions().booleanOption("vehicle_fires")                        && te instanceof Tank) {                    checkForVehicleFire((Tank)te, true);                }                int direction = Compute.targetSideTable(ae,te);                while(missiles-- > 0) {                    HitData hit = te.rollHitLocation(ToHitData.HIT_NORMAL, direction);                    if(te instanceof Protomech && hit.getLocation() == Protomech.LOC_NMISS) {                        r = new Report(6035);                        r.subject = te.getId();                        addReport(r);                    } else {                        addReport(criticalEntity(te,hit.getLocation(),-2));                    }                }            }            else if(te instanceof BattleArmor) {                for(Mounted equip:te.getMisc()) {                    if ( BattleArmor.FIRE_PROTECTION.equals                        (equip.getType().getInternalName()) ) {                       r = new Report(3395);                       r.indent(2);                       r.subject = te.getId();                       r.addDesc(te);                       addReport(r);                       return;                    }                }                te.heatFromExternal += missiles;                while(te.heatFromExternal >=3) {                    te.heatFromExternal -= 3;                    HitData hit = te.rollHitLocation(ToHitData.HIT_NORMAL, ToHitData.SIDE_FRONT);                    hit.setEffect(HitData.EFFECT_CRITICAL);                    addReport(damageEntity(te,hit,1));                }            }            else if(te instanceof Infantry) {                HitData hit = new HitData(Infantry.LOC_INFANTRY);                addReport(damageEntity(te,hit,3*missiles));            }            else {                //gun emplacements                int direction = Compute.targetSideTable(ae,te);                while(missiles-- > 0) {                    HitData hit = te.rollHitLocation(ToHitData.HIT_NORMAL, direction);                    addReport(damageEntity(te,hit,2));                }            }        }    }