// Make sure that we have crit spot to hit
if (chp.entity instanceof Mech
|| chp.entity instanceof Protomech) {
// Is this a torso weapon slot?
CriticalSlot cs = null;
if (chp.entity instanceof Protomech
&& Protomech.LOC_TORSO == ch.loc
&& (Protomech.SYSTEM_TORSO_WEAPON_A == ch.slot || Protomech.SYSTEM_TORSO_WEAPON_B == ch.slot)) {
cs = new CriticalSlot(CriticalSlot.TYPE_SYSTEM,
ch.slot);
}
// Is this a valid slot number?
else if (ch.slot < 0
|| ch.slot > chp.entity
.getNumberOfCriticals(ch.loc)) {
System.out.println("\n\tInvalid Slot Specified "
+ ch.loc + ":" + (ch.slot + 1));
}
// Get the slot from the entity.
else {
cs = chp.entity.getCritical(ch.loc, ch.slot);
}
// Ignore invalid, unhittable, and damaged slots.
if (null == cs || !cs.isHittable()) {
System.out.println("\n\tSlot not hittable "
+ ch.loc + ":" + (ch.slot + 1));
} else {
System.out
.print("[s.applyCriticalHit(chp.entity, ch.loc, cs, false)]");
s.applyCriticalHit(chp.entity, ch.loc, cs, false);
}
}
// Handle Tanks differently.
else if (chp.entity instanceof Tank) {
if (ch.slot < 0 || ch.slot >= 6) {
System.out.println("\n\tInvalid Slot Specified "
+ ch.loc + ":" + (ch.slot + 1));
} else {
CriticalSlot cs = new CriticalSlot(
CriticalSlot.TYPE_SYSTEM, ch.slot + 1);
System.out
.print("[s.applyCriticalHit(chp.entity, ch.loc, cs, false)]");
s.applyCriticalHit(chp.entity, Entity.NONE, cs,
false);
}
} // End have-tank
} // End have-valid-location
} // Handle the next critical hit
// Print a line between hit plans.
System.out.println();
} // Handle the next critical hit plan
// Loop throught Set Ammo To
for (int saSpot = 0, saCount = m_vSetAmmoTo.size(); saSpot < saCount; saSpot++) {
SetAmmoPlan sap = m_vSetAmmoTo.elementAt(saSpot);
System.out.println("Applying Ammo Adjustment to "
+ sap.entity.getShortName());
for (int sapSpot = 0, sapCount = sap.ammoSetTo.size(); sapSpot < sapCount; sapSpot++) {
// Get the ScritHit
SetAmmoTo sa = sap.ammoSetTo.elementAt(sapSpot);
// Only can be done against Mechs
if (sap.entity instanceof Mech) {
if (sa.slot < sap.entity.getNumberOfCriticals(sa.loc)) {
// Get the piece of Eqipment and Check to make sure it
// is
// a ammo item then set its amount!
CriticalSlot cs = sap.entity.getCritical(sa.loc,
sa.slot);
if (!(cs == null)) {
Mounted ammo = sap.entity.getEquipment(sap.entity
.getCritical(sa.loc, sa.slot).getIndex());
if (ammo.getType() instanceof AmmoType) {