if (!entity.isShutDown()) { entity.heatBuildup += 5 * entity.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_ENGINE, Mech.LOC_CT); entity.heatBuildup += 5 * entity.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_ENGINE, Mech.LOC_LT); entity.heatBuildup += 5 * entity.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_ENGINE, Mech.LOC_RT); }
entity.heatBuildup += entity.getEngineCritHeat();
    private void resolveHeat() {        roundReport.append("\nHeat Phase\n----------\n");        for (Enumeration i = game.getEntities(); i.hasMoreElements();) {            Entity entity = (Entity)i.nextElement();            if ( null == entity.getPosition() ) {                continue;            }            Hex entityHex = game.getBoard().getHex(entity.getPosition());                        // heat doesn't matter for non-mechs            if (!(entity instanceof Mech)) {                entity.heatBuildup = 0;                // If the unit is hit with an Inferno, do flaming death test.                if ( entity.infernos.isStillBurning() ) {                    doFlamingDeath(entity);                }                continue;            }            else {                // Meks gain heat from inferno hits.                if ( entity.infernos.isStillBurning() ) {                    int infernoHeat = entity.infernos.getHeat();                    entity.heatBuildup += infernoHeat;                    roundReport.append( "Added " )                        .append( infernoHeat )                        .append( " from a burning inferno round...\n" );                }            }            // should we even bother?            if ( entity.isDestroyed() || entity.isDoomed() ||                 entity.crew.isDead() ) {                continue;            }            // engine hits add a lot of heat, provided the engine is on            if (!entity.isShutDown()) {                entity.heatBuildup += 5 * entity.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_ENGINE, Mech.LOC_CT);                entity.heatBuildup += 5 * entity.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_ENGINE, Mech.LOC_LT);                entity.heatBuildup += 5 * entity.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_ENGINE, Mech.LOC_RT);            }            // If a Mek had an active Stealth suite, add 10 heat.            if ( entity instanceof Mech && entity.isStealthActive() ) {                entity.heatBuildup += 10;                roundReport.append("Added 10 heat from Stealth Armor...\n");            }            // Add +5 Heat if the hex you're in is on fire            // and was on fire for the full round.            if (entityHex.levelOf(Terrain.FIRE) == 2) {                entity.heatBuildup += 5;                roundReport.append("Added 5 heat from a fire...\n");            }                        // add the heat we've built up so far.            roundReport.append( entity.getDisplayName() )                .append( " gains " )                .append( entity.heatBuildup )                .append( " heat,");            entity.heat += entity.heatBuildup;            entity.heatBuildup = 0;            // how much heat can we sink?            int tosink = Math.min( entity.getHeatCapacityWithWater(),                                   entity.heat );                        entity.heat -= tosink;            roundReport.append( " sinks " )                .append( tosink )                .append( " heat and is now at " )                .append( entity.heat )                .append( " heat.\n");            // Does the unit have inferno ammo?            if( entity.hasInfernoAmmo() ) {                // Apply the inferno ammo explosion.                if (entity.heat >= 10) {                    int boom = 4 + (entity.heat >= 14 ? 2 : 0) +                         (entity.heat >= 19 ? 2 : 0) +                         (entity.heat >= 23 ? 2 : 0) +                         (entity.heat >= 28 ? 2 : 0);                    int boomroll = Compute.d6(2);                    roundReport.append(entity.getDisplayName() )                        .append( " needs a " )                        .append( boom )                        .append( "+ to avoid inferno ammo explosion, rolls " )                        .append( boomroll )                        .append( " : " );                    if (boomroll >= boom) {                        roundReport.append("avoids successfully!\n");                    } else {                        roundReport.append("fails to avoid explosion.\n");                        roundReport.append(explodeInfernoAmmoFromHeat(entity));                    }                }            } // End avoid-inferno-explosion            // heat effects: start up            if (entity.heat < 30 && entity.isShutDown()) {                if (entity.heat < 14) {                    entity.setShutDown(false);                    roundReport.append( entity.getDisplayName() )                        .append( " automatically starts up.\n" );                } else {                    int startup = 4 + (((entity.heat - 14) / 4) * 2);                    int suroll = Compute.d6(2);                    roundReport.append( entity.getDisplayName() )                        .append( " needs a " )                        .append( startup )                        .append( "+ to start up, rolls " )                        .append( suroll )                        .append( " : " );                    if (suroll >= startup) {                        entity.setShutDown(false);                        roundReport.append("successful!\n");                    } else {                        roundReport.append("fails.\n");                    }                }            }            // heat effects: shutdown!            // 2003-01-26 JAD - Don't shut down if you just restarted.            else if (entity.heat >= 14 && !entity.isShutDown()) {                if (entity.heat >= 30) {                    roundReport.append( entity.getDisplayName() )                        .append( " automatically shuts down.\n" );                    // add a piloting roll and resolve immediately                    game.addPSR(new PilotingRollData                        ( entity.getId(), 3, "reactor shutdown" ));                    resolvePilotingRolls();                    // okay, now mark shut down                    entity.setShutDown(true);                } else if (entity.heat >= 14) {                    int shutdown = 4 + (((entity.heat - 14) / 4) * 2);                    int sdroll = Compute.d6(2);                    roundReport.append(entity.getDisplayName() )                        .append( " needs a " )                        .append( shutdown )                        .append( "+ to avoid shutdown, rolls " )                        .append( sdroll )                        .append( " : ");                    if (sdroll >= shutdown) {                        roundReport.append("avoids successfully!\n");                    } else {                        roundReport.append("shuts down.\n");                        // add a piloting roll and resolve immediately                        game.addPSR(new PilotingRollData                            ( entity.getId(), 3, "reactor shutdown" ));                        resolvePilotingRolls();                        // okay, now mark shut down                        entity.setShutDown(true);                    }                }            }            // heat effects: ammo explosion!            if (entity.heat >= 19) {                int boom = 4 + (entity.heat >= 23 ? 2 : 0) +                    (entity.heat >= 28 ? 2 : 0);                int boomroll = Compute.d6(2);                roundReport.append( entity.getDisplayName() )                        .append( " needs a " )                        .append( boom )                        .append( "+ to avoid ammo explosion, rolls " )                        .append( boomroll )                        .append( " : ");                if (boomroll >= boom) {                    roundReport.append("avoids successfully!\n");                } else {                    roundReport.append("fails to avoid explosion.\n");                    roundReport.append(explodeAmmoFromHeat(entity));                }            }                        // heat effects: mechwarrior damage            if (entity.getHitCriticals( CriticalSlot.TYPE_SYSTEM,                                        Mech.SYSTEM_LIFE_SUPPORT,                                        Mech.LOC_HEAD ) > 0                && entity.heat >= 15) {                if (entity.heat >= 25) {                    // mechwarrior takes 2 damage                    roundReport.append(entity.getDisplayName() ).append( " has 25 or higher heat and damaged life support.  Mechwarrior takes 2 damage.\n");                    damageCrew(entity, 2);                } else {                    // mechwarrior takes 1 damage                    roundReport.append(entity.getDisplayName() ).append( " has 15 or higher heat and damaged life support.  Mechwarrior takes 1 damage.\n");                    damageCrew(entity, 1);                }                // The pilot may have just expired.                if ( entity.crew.isDead() ) {                    roundReport.append( "*** " )                        .append( entity.getDisplayName() )                        .append( " PILOT BAKES TO DEATH! ***" );                }            }        }    }