if (nightModifier > 0) { base += nightModifier; reason.append("Night Battle, no Spotlights"); }
    public static ToHitData getSwarmMekBaseToHit(Entity attacker,            Entity defender) {        int men = 0;        int base = ToHitData.IMPOSSIBLE;        StringBuffer reason = new StringBuffer();        final int nightModifier = (attacker.game.getOptions()                .booleanOption("night_battle")) ? +2 : 0;        // Can only swarm a Mek.        if (!(defender instanceof Mech)) {            reason.append("Defender is not a Mek.");        }        // Can't target a transported entity.        else if (Entity.NONE != defender.getTransportId()) {            reason.append("Target is a passenger.");        }        // Attacker can't be swarming.        else if (Entity.NONE != attacker.getSwarmTargetId()) {            reason.append("Attacker is swarming.");        }        // Can't target a entity invloved in a swarm attack.        else if (Entity.NONE != defender.getSwarmAttackerId()) {            reason.append("Target is already being swarmed.");        }        // Can't target a entity conducting a swarm attack.        else if (Entity.NONE != defender.getSwarmTargetId()) {            reason.append("Target is swarming a Mek.");        }        // Can't swarm a friendly Mek.        // Seehttp://www.classicbattletech.com/w3t/showflat.php?Cat=&Board=ask&Number=632321&page=0&view=collapsed&sb=5&o=0&fpart=        else if (!attacker.isEnemyOf(defender)) {            reason.append("Can only swarm an enemy.");        }        // Handle BattleArmor attackers.        else if (attacker instanceof BattleArmor) {            BattleArmor inf = (BattleArmor) attacker;            // Battle Armor units can't Leg Attack if they're burdened.            if (inf.isBurdened()) {                reason.append("Launcher not jettisoned.");            } else {                men = inf.getShootingStrength();                if (men >= 4)                    base = 7;                else if (men >= 1)                    base = 10;                reason.append(men);                reason.append(" trooper(s) active");            }        }        // Non-BattleArmor infantry need many more men.        else if (attacker instanceof Infantry) {            Infantry inf = (Infantry) attacker;            men = inf.getShootingStrength();            if (men >= 22)                base = 7;            else if (men >= 16)                base = 10;            reason.append(men);            reason.append(" men alive");        }        // No one else can conduct leg attacks.        else {            reason.append("Attacker is not infantry.");        }        if (nightModifier > 0) {            base += nightModifier;            reason.append("Night Battle, no Spotlights");        }        // Return the ToHitData for this attack.        return new ToHitData(base, reason.toString());    }