public MissingMekActuator(int tonnage, int type, int loc, Campaign c) { super(tonnage, c); this.type = type; Mech m = new BipedMech(); this.name = m.getSystemName(type) + " Actuator" ; this.location = loc; }
/** * * @return true if this unit is capable of Zweihandering (melee attack with both hands) */ public boolean canZweihander() { return (getCrew() != null) && hasAbility(OptionsConstants.PILOT_ZWEIHANDER) && hasWorkingSystem(Mech.ACTUATOR_HAND, Mech.LOC_RARM) && hasWorkingSystem(Mech.ACTUATOR_HAND, Mech.LOC_LARM) && !isLocationBad(Mech.LOC_RARM) && !isLocationBad(Mech.LOC_LARM) && !isProne(); }
/** * Returns this mech's running/flank mp modified for leg loss & stuff. */ @Override public int getRunMP(boolean gravity, boolean ignoreheat, boolean ignoremodulararmor) { if (countBadLegs() == 0) { return super.getRunMP(gravity, ignoreheat, ignoremodulararmor); } return getWalkMP(gravity, ignoreheat, ignoremodulararmor); }
/** * @return if this mech cannot stand up from hulldown */ @Override public boolean cannotStandUpFromHullDown() { int i = 0; if (isLocationBad(LOC_LLEG)) { i++; } if (isLocationBad(LOC_RLEG)) { i++; } return (i >= 1) || isGyroDestroyed(); }
/** * Returns true if the entity can flip its arms */ @Override public boolean canFlipArms() { boolean canFlip = true; if (hasSystem(Mech.ACTUATOR_HAND, Mech.LOC_LARM)) { canFlip = false; } else if (hasSystem(Mech.ACTUATOR_LOWER_ARM, Mech.LOC_LARM)) { canFlip = false; } else if (hasSystem(Mech.ACTUATOR_HAND, Mech.LOC_RARM)) { canFlip = false; } else if (hasSystem(Mech.ACTUATOR_LOWER_ARM, Mech.LOC_RARM)) { canFlip = false; } if (hasQuirk(OptionsConstants.QUIRK_POS_HYPER_ACTUATOR)) { canFlip = true; } if (isProne()) { canFlip = false; } return canFlip; }
@Override public int getWalkMP(boolean gravity, boolean ignoreheat, boolean ignoremodulararmor) { int wmp = getOriginalWalkMP(); int legsDestroyed = 0; int hipHits = 0; if (getMovementMode() == EntityMovementMode.TRACKED) { for (Mounted m : getMisc()) { if (m.getType().hasFlag(MiscType.F_TRACKS)) { if (m.isHit() || isLocationBad(m.getLocation())) { legsDestroyed++; for (int i = 0; i < locations(); i++) { if (locationIsLeg(i)) { if (!isLocationBad(i)) { if (legHasHipCrit(i)) { hipHits++; if ((game == null) || !game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_LEG_DAMAGE)) { actuatorHits += countLegActuatorCrits(i); } else { legsDestroyed++; if (hasShield()) { wmp -= getNumberOfShields(MiscType.S_SHIELD_LARGE); wmp -= getNumberOfShields(MiscType.S_SHIELD_MEDIUM); if (!ignoremodulararmor && hasModularArmor()) { wmp--;
assertEquals("Jenner", mek.getChassis()); assertEquals("JR7-D", mek.getModel()); assertEquals(35.0f, mek.getWeight(), 0.0f); assertEquals(Mech.COCKPIT_STANDARD, mek.getCockpitType()); assertEquals(Mech.GYRO_STANDARD, mek.getGyroType()); assertTrue(mek.getEngine().engineValid); assertTrue(mek.getEngine().isFusion()); assertEquals(Engine.NORMAL_ENGINE, mek.getEngine().getEngineType()); assertEquals(7, mek.getWalkMP()); assertEquals(11, mek.getRunMP()); assertEquals(10, mek.getActiveSinks()); assertEquals(7, mek.getArmor(Mech.LOC_HEAD)); assertEquals(8, mek.getArmor(Mech.LOC_RT)); assertEquals(10, mek.getArmor(Mech.LOC_CT)); assertEquals(8, mek.getArmor(Mech.LOC_LT)); assertEquals(4, mek.getArmor(Mech.LOC_RT, true)); assertEquals(3, mek.getArmor(Mech.LOC_CT, true)); assertEquals(4, mek.getArmor(Mech.LOC_LT, true)); assertEquals(4, mek.getArmor(Mech.LOC_RARM)); assertEquals(4, mek.getArmor(Mech.LOC_LARM)); assertEquals(6, mek.getArmor(Mech.LOC_RLEG)); assertEquals(6, mek.getArmor(Mech.LOC_LLEG)); assertFalse(mek.getFailedEquipment().hasNext());
public boolean hasPassiveShield(int location) { if (isShutDown() || (getCrew().isKoThisRound() || getCrew().isUnconscious())) { return false; for (int slot = 0; slot < this.getNumberOfCriticals(location); slot++) { CriticalSlot cs = getCritical(location, slot);
Mockito.when(mockShooter.getPosition()).thenReturn(SHOOTER_COORDS); Mockito.when(mockShooter.getWeight()).thenReturn(75.0); Mockito.when(mockShooter.getId()).thenReturn(SHOOTER_ID); Mockito.when(mockShooter.getDisplayName()).thenReturn("Test shooter 1"); Mockito.when(mockShooter.getEquipmentNum(Mockito.eq(mockWeapon))).thenReturn(WEAPON_ID); Mockito.when(mockTarget.getPosition()).thenReturn(TARGET_COORDS_9); Mockito.when(mockTarget.isLocationBad(Mockito.anyInt())).thenReturn(false); Mockito.when(mockTarget.getId()).thenReturn(TARGET_ID); Mockito.when(mockTarget.getTargetType()).thenReturn(Targetable.TYPE_ENTITY); Mockito.when(mockTarget.getDisplayName()).thenReturn("Mock target 2");
public void addStandingPenalties(PilotingRollData roll) { if (hasQuirk(OptionsConstants.QUIRK_NEG_NO_ARMS)) { roll.addModifier(2, "no/minimal arms"); return; } if (game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_ATTEMPTING_STAND)) { int[] locsToCheck = new int[2]; locsToCheck[0] = Mech.LOC_RARM; locsToCheck[1] = Mech.LOC_LARM; for (int i = 0; i < locsToCheck.length; i++) { int loc = locsToCheck[i]; if (isLocationBad(loc)) { roll.addModifier(2, getLocationName(loc) + " destroyed"); } else { // check for damaged hip actuators if (!hasWorkingSystem(Mech.ACTUATOR_HAND, loc)) { roll.addModifier(1, getLocationName(loc) + " hand Actuator missing/destroyed"); } else if (!hasWorkingSystem(Mech.ACTUATOR_LOWER_ARM, loc)) { roll.addModifier(1, getLocationName(loc) + " lower Actuator missing/destroyed"); } else if (!hasWorkingSystem(Mech.ACTUATOR_UPPER_ARM, loc)) { roll.addModifier(1, getLocationName(loc) + " upper ctuator missing/destroyed"); } else if (!hasWorkingSystem(Mech.ACTUATOR_SHOULDER, loc)) { roll.addModifier(1, getLocationName(loc) + " shoulder Actuator missing/destroyed"); } } } } }
locsToCheck[1] = Mech.LOC_LLEG; if (hasFunctionalLegAES()) { roll.addModifier(-2, "AES bonus"); int loc = locsToCheck[i]; if (isLocationBad(loc)) { roll.addModifier(5, getLocationName(loc) + " destroyed"); } else { if (getBadCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, loc) > 0) { roll.addModifier(2, getLocationName(loc) + " Hip Actuator destroyed"); if (!game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_LEG_DAMAGE)) { continue; if (getBadCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_UPPER_LEG, loc) > 0) { roll.addModifier(1, getLocationName(loc) + " Upper Leg Actuator destroyed"); if (getBadCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_LOWER_LEG, loc) > 0) { roll.addModifier(1, getLocationName(loc) + " Lower Leg Actuator destroyed"); if (getBadCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_FOOT, loc) > 0) { roll.addModifier(1, getLocationName(loc) + " Foot Actuator destroyed");
/** * Does the mech have any shields. a mech can have up to 2 shields. * * @return <code>true</code> if unit has a shield crit. */ @Override public boolean hasShield() { for (Mounted m : getMisc()) { boolean isShield = (m.getType() instanceof MiscType) && ((MiscType) m.getType()).isShield(); if (((m.getLocation() == Mech.LOC_LARM) || (m.getLocation() == Mech.LOC_RARM)) && isShield && !m.isInoperable() && (getInternal(m.getLocation()) > 0)) { for (int slot = 0; slot < this.getNumberOfCriticals(m.getLocation()); slot++) { CriticalSlot cs = getCritical(m.getLocation(), slot); if ((cs != null) && (cs.getType() == CriticalSlot.TYPE_EQUIPMENT) && cs.getMount().equals(m) && !cs.isDestroyed() && !cs.isMissing()) { // when all crits of a shield are destroyed, it // no longer hinders movement and stuff return true; } } } } return false; }
@Override public boolean canGoHullDown() { // check the option boolean retVal = game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_HULL_DOWN); if (!retVal) { return false; } // check the locations retVal = (!isLocationBad(Mech.LOC_LLEG) && !isLocationBad(Mech.LOC_RLEG) && !isLocationDoomed(Mech.LOC_LLEG) && !isLocationDoomed(Mech.LOC_RLEG)); if (!retVal) { return false; } // check the Gyro return !isGyroDestroyed(); }
private void setupMediumTarget() { Mockito.when(mockTarget.getInternal(Mockito.anyInt())).thenReturn(10); Mockito.when(mockTarget.getInternal(Mockito.eq(0))).thenReturn(3); Mockito.when(mockTarget.getArmor(Mockito.anyInt(), Mockito.anyBoolean())).thenReturn(16); Mockito.when(mockTarget.getArmor(Mockito.eq(0), Mockito.anyBoolean())).thenReturn(9); }
when(mockThunderbolt1.getEntityType()).thenReturn(Entity.ETYPE_MECH); when(mockThunderbolt1.getUnitType()).thenCallRealMethod(); when(mockThunderboltUnit1.getEntity()).thenReturn(mockThunderbolt1); when(mockThunderbolt1Pilot.isAdmin()).thenReturn(false); doReturn(mockMechPilot.getLevel()).when(mockThunderboltCrew).getPiloting(); doReturn(mockMechGunnery.getLevel()).when(mockThunderboltCrew).getGunnery(); when(mockThunderbolt1.getCrew()).thenReturn(mockThunderboltCrew); when(mockThunderbolt1Tech.isAdmin()).thenReturn(false); when(mockThunderbolt1Tech.isTech()).thenReturn(true); when(mockThunderbolt2.getEntityType()).thenReturn(Entity.ETYPE_MECH); when(mockThunderbolt2.getUnitType()).thenCallRealMethod(); when(mockThunderboltUnit2.getEntity()).thenReturn(mockThunderbolt2); when(mockThunderbolt2Pilot.isAdmin()).thenReturn(false); doReturn(mockMechPilot.getLevel()).when(mockThunderbolt2Crew).getPiloting(); doReturn(mockMechGunnery.getLevel()).when(mockThunderbolt2Crew).getGunnery(); when(mockThunderbolt2.getCrew()).thenReturn(mockThunderbolt2Crew); when(mockThunderbolt2Tech.isAdmin()).thenReturn(false); when(mockThunderbolt2Tech.isTech()).thenReturn(true); when(mockGrasshopper1.getEntityType()).thenReturn(Entity.ETYPE_MECH); when(mockGrasshopper1.getUnitType()).thenCallRealMethod(); when(mockGrasshopperUnit1.getEntity()).thenReturn(mockGrasshopper1); when(mockGrasshopper1Pilot.isAdmin()).thenReturn(false); doReturn(mockMechPilot.getLevel()).when(mockGrasshopperCrew).getPiloting(); doReturn(mockMechGunnery.getLevel()).when(mockGrasshopperCrew).getGunnery();
public int getBVWalkMP() { return super.getWalkMP(false, true, true); }
@Override protected double getArmActuatorCost() { double cost = 0; int numOfUpperArmActuators = 0; int numOfLowerArmActuators = 0; int numOfHands = 0; if (hasSystem(Mech.ACTUATOR_HAND, Mech.LOC_LARM)) { numOfHands++; } if (hasSystem(Mech.ACTUATOR_LOWER_ARM, Mech.LOC_LARM)) { numOfLowerArmActuators++; } if (hasSystem(Mech.ACTUATOR_UPPER_ARM, Mech.LOC_LARM)) { numOfUpperArmActuators++; } if (hasSystem(Mech.ACTUATOR_HAND, Mech.LOC_RARM)) { numOfHands++; } if (hasSystem(Mech.ACTUATOR_LOWER_ARM, Mech.LOC_RARM)) { numOfLowerArmActuators++; } if (hasSystem(Mech.ACTUATOR_UPPER_ARM, Mech.LOC_RARM)) { numOfUpperArmActuators++; } cost += numOfUpperArmActuators * weight * 100; cost += numOfLowerArmActuators * weight * 50; cost += numOfHands * weight * 80; return cost; }
@Override public int getRunMP(boolean gravity, boolean ignoreheat, boolean ignoremodulararmor) { int mp; if (getConversionMode() == CONV_MODE_FIGHTER) { mp = getFighterModeRunMP(gravity, ignoremodulararmor); } else if (getConversionMode() == CONV_MODE_AIRMECH) { mp = getAirMechFlankMP(gravity, ignoremodulararmor); } else { // conversion reduction has already been done at this point return super.getRunMP(gravity, ignoreheat, ignoremodulararmor); } if (convertingNow) { mp /= 2; } return mp; }
/** * Does the entity have a retracted blade in the given location */ @Override public boolean hasRetractedBlade(int loc) { for (Mounted m : getEquipment()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE) && !m .curMode().equals("extended")) { return true; } } return false; }
@Override public void addBattleForceSpecialAbilities(Map<BattleForceSPA, Integer> specialAbilities) { super.addBattleForceSpecialAbilities(specialAbilities); int bombs = (int) getEquipment().stream().filter(m -> m.getType().hasFlag(MiscType.F_BOMB_BAY)).count(); if (bombs > 0) { specialAbilities.put(BattleForceSPA.BOMB, bombs / 5); } if (lamType == LAM_BIMODAL) { specialAbilities.put(BattleForceSPA.BIM, null); } else { specialAbilities.put(BattleForceSPA.LAM, null); } }