/** * Count the number of destroyed or breached legs on the mech */ public int countBadLegs() { int badLegs = 0; for (int i = 0; i < locations(); i++) { badLegs += (locationIsLeg(i) && isLocationBad(i)) ? 1 : 0; } return badLegs; }
/** * Return true is the location is a leg and has a hip crit */ public boolean legHasHipCrit(int loc) { if (isLocationBad(loc)) { return false; } if (locationIsLeg(loc)) { return (getGoodCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, loc) == 0); } return false; }
/** * Count non-hip leg actuator crits */ public int countLegActuatorCrits(int loc) { if (isLocationBad(loc)) { return 0; } int legCrits = 0; if (locationIsLeg(loc)) { if (getGoodCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_UPPER_LEG, loc) == 0) { legCrits++; } if (getGoodCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_LOWER_LEG, loc) == 0) { legCrits++; } if (getGoodCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_FOOT, loc) == 0) { legCrits++; } } return legCrits; }
@Override public boolean canEscape() { int hipHits = 0; int legsDestroyed = 0; for (int i = 0; i < locations(); i++) { if (locationIsLeg(i)) { if (!isLocationBad(i)) { if (legHasHipCrit(i)) { hipHits++; } } else { legsDestroyed++; } } } //there is room for debate here but I think most people would agree that a //legged biped mech (and a double legged quad mech) or a hipped mech are not //escapable, although technically they still have as much MP as foot infantry which //can escape. We could also consider creating options to control this. if(((this instanceof BipedMech) && (legsDestroyed > 0)) || (legsDestroyed > 1) || (hipHits > 0)) { return false; } return super.canEscape(); }
MoveOption next = (MoveOption) adjacent.next(); if ((entity instanceof Mech) && (((Mech) entity).countBadLegs() >= 1) && (((Mech) entity).isLocationBad(Mech.LOC_LARM) && ((Mech) entity) .isLocationBad(Mech.LOC_RARM))) { MoveOption eject = next.clone(); eject.addStep(MoveStepType.EJECT);
int hitLocation = i; while (targetMech.isLocationBad(hitLocation) && (Mech.LOC_CT != hitLocation)) {
Mockito.when(mockTarget.isLocationBad(Mockito.anyInt())).thenReturn(false); Mockito.when(mockTarget.getArmor(Mockito.anyInt(), Mockito.eq(false))).thenReturn(10); Mockito.when(mockTarget.getArmor(Mockito.anyInt(), Mockito.eq(true))).thenReturn(5); Mockito.when(mockTarget.isLocationBad(Mockito.anyInt())).thenReturn(false); Mockito.when(mockTarget.getArmor(Mockito.anyInt(), Mockito.eq(false))).thenReturn(6); Mockito.when(mockTarget.getArmor(Mockito.anyInt(), Mockito.eq(true))).thenReturn(3);
for (int i = 0; i <= 7; i++) { int hitLoc = i; while (targetMech.isLocationBad(hitLoc) && (hitLoc != Mech.LOC_CT)
if (isLocationBad(LOC_LT)) { logger.log(Mech.class, METHOD_NAME, LogLevel.DEBUG, getDisplayName() + " CRIPPLED: Left Torso destroyed."); if (isLocationBad(LOC_RT)) { logger.log(Mech.class, METHOD_NAME, LogLevel.DEBUG, getDisplayName() + " CRIPPLED: Right Torso destroyed.");