if (!mounted.isHit() && (rack < atype.getDamagePerShot() * atype.getRackSize() || damage < mounted.getExplosionDamage())) { rack = atype.getDamagePerShot() * atype.getRackSize(); damage = mounted.getExplosionDamage();
int newRack = atype.getDamagePerShot() * atype.getRackSize(); int newDamage = mounted.getExplosionDamage(); if ( !mounted.isHit() && ( rack < newRack || (rack == newRack && damage < newDamage) ) ) { rack = newRack; damage = newDamage;
    private String explodeAmmoFromHeat(Entity entity) {        int damage = 0;        int rack = 0;        int boomloc = -1;        int boomslot = -1;        for (int j = 0; j < entity.locations(); j++) {            for (int k = 0; k < entity.getNumberOfCriticals(j); k++) {                CriticalSlot cs = entity.getCritical(j, k);                if (cs == null || cs.isDestroyed() || cs.isHit() || cs.getType() != CriticalSlot.TYPE_EQUIPMENT) {                    continue;                }                Mounted mounted = entity.getEquipment(entity.getCritical(j, k).getIndex());                if (!(mounted.getType() instanceof AmmoType)) {                    continue;                }                AmmoType atype = (AmmoType)mounted.getType();                if (!atype.isExplosive()) {                    continue;                }                if (!mounted.isHit()                 && (rack < atype.getDamagePerShot() * atype.getRackSize()                || damage < mounted.getExplosionDamage())) {                    rack = atype.getDamagePerShot() * atype.getRackSize();                    damage = mounted.getExplosionDamage();                    boomloc = j;                    boomslot = k;                }            }        }        if (boomloc != -1 && boomslot != -1) {            CriticalSlot slot = entity.getCritical(boomloc, boomslot);            slot.setHit(true);            entity.getEquipment(slot.getIndex()).setHit(true);            return explodeEquipment(entity, boomloc, boomslot);        } else {            return "  Luckily, there is no ammo to explode.\n";        }    }