double expectedDmg = getExpectedDamage((WeaponType)w.getType());
double expectedDmg;   if ( fen instanceof Infantry ) {   Infantry inf = (Infantry) fen; expectedDmg = inf.getDamage(inf.getShootingStrength()); } else {  expectedDmg = getExpectedDamage((WeaponType)w.getType()); }   if ( ten instanceof Infantry ) { Hex e_hex = game.getBoard().getHex( ten.getPosition() ); if ( !e_hex.contains(Terrain.WOODS) && !e_hex.contains(Terrain.BUILDING) ) { expectedDmg *= 2; } }
     protected double calculateOneWeaponThreat(int from, int to)     {        Entity fen = game.getEntity(from);        Entity ten = game.getEntity(to);        // for each weapon mounted on From...        int first = fen.getFirstWeapon();        if (first == -1) return 0; // no weapons                int weap = first;        double total = 0.0;        do {            // if it can target To...            Mounted w = fen.getEquipment(weap);            ToHitData th = Compute.toHitWeapon(game, from, to, weap, new Vector(0));                // TODO: try all secondary facings for firer; take the best                         // calculate expected value of attack            if (th.getValue() != ToHitData.IMPOSSIBLE) {                double odds = Compute.oddsAbove(th.getValue())/ 100.0;                double expectedDmg = getExpectedDamage((WeaponType)w.getType());                total += odds * expectedDmg;//                sendChat(" -> threat " + w.getType().getName() + " needs " + th.getValue() + ": " + (odds*expectedDmg));                                               }                        weap = fen.getNextWeapon(weap);        } while (weap != first);        return total;     }