if (attacker.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_SHOULDER, weapon.getLocation()) > 0) { mods.addModifier(4, "shoulder actuator destroyed"); } else {
if ( attacker instanceof Protomech ) {   int hits = ((Protomech)attacker).getCritsHit(Protomech.LOC_HEAD); if( hits > 0 ) { mods.addModifier( hits, hits + " head critical(s)" ); }   switch ( weapon.getLocation() ) { case Protomech.LOC_LARM: case Protomech.LOC_RARM: hits = ((Protomech)attacker).getCritsHit( weapon.getLocation() ); if ( hits > 0 ) { mods.addModifier( hits, hits + " arm critical(s)" ); } break; case Protomech.LOC_MAINGUN:  hits = ((Protomech)attacker).getCritsHit( Protomech.LOC_LARM ); hits += ((Protomech)attacker).getCritsHit( Protomech.LOC_RARM ); if ( 4 == hits ) { mods.addModifier( ToHitData.IMPOSSIBLE, "Cannot fire main gun with no arms." ); } else if ( hits > 0 ) { mods.addModifier( hits, hits + " arm critical(s)" ); } break; }  }   else if ( attacker.getDestroyedCriticals( CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_SHOULDER, weapon.getLocation() ) > 0 ) { mods.addModifier(4, "shoulder actuator destroyed"); } else {
  private static ToHitData getDamageWeaponMods(Entity attacker, Mounted weapon) {    ToHitData mods = new ToHitData();        if (attacker.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_SHOULDER, weapon.getLocation()) > 0) {            mods.addModifier(4, "shoulder actuator destroyed");        } else {          // no shoulder hits, add other arm hits          int actuatorHits = 0;          if (attacker.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_UPPER_ARM, weapon.getLocation()) > 0) {              actuatorHits++;          }          if (attacker.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_LOWER_ARM, weapon.getLocation()) > 0) {              actuatorHits++;          }          if (actuatorHits > 0) {        mods.addModifier(actuatorHits, actuatorHits + " destroyed arm actuators");          }    }            // sensors critical hit to attacker    int sensorHits = attacker.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_SENSORS, Mech.LOC_HEAD);    if (sensorHits > 0) {      mods.addModifier(2, "attacker sensors damaged");    }            return mods;  }