/** * Method computes how much heat a dial down weapon generates * * @param weapon * @param wtype * @param range * @return Heat, minimum of 1; */ public static int dialDownHeat(Mounted weapon, WeaponType wtype, int range) { int toReturn = wtype.getHeat(); if (!wtype.hasModes()) { return toReturn; } int damage = wtype.getDamage(range); int newDamage = Compute.dialDownDamage(weapon, wtype, range); toReturn = Math.max(1, wtype.getHeat() - Math.max(0, damage - newDamage)); return toReturn; }
private void setupMediumLaser() { Mockito.when(mockWeaponType.getHeat()).thenReturn(3); Mockito.when(mockWeaponType.getDamage()).thenReturn(5); Mockito.when(mockWeaponType.getShortRange()).thenReturn(3); Mockito.when(mockWeaponType.getMediumRange()).thenReturn(6); Mockito.when(mockWeaponType.getLongRange()).thenReturn(9); Mockito.when(mockWeapon.getDesc()).thenReturn("Medium Laser"); }
private void setupPPC() { Mockito.when(mockWeaponType.getHeat()).thenReturn(10); Mockito.when(mockWeaponType.getDamage()).thenReturn(10); Mockito.when(mockWeaponType.getShortRange()).thenReturn(6); Mockito.when(mockWeaponType.getMediumRange()).thenReturn(12); Mockito.when(mockWeaponType.getLongRange()).thenReturn(18); Mockito.when(mockWeapon.getDesc()).thenReturn("PPC"); }
private void setupCGR() { Mockito.when(mockWeaponType.getHeat()).thenReturn(1); Mockito.when(mockWeaponType.getDamage()).thenReturn(15); Mockito.when(mockWeaponType.getShortRange()).thenReturn(7); Mockito.when(mockWeaponType.getMediumRange()).thenReturn(15); Mockito.when(mockWeaponType.getLongRange()).thenReturn(22); Mockito.when(mockWeapon.getDesc()).thenReturn("Gauss Rifle (C)"); }
fields.put("heat", ((WeaponType) eq).getHeat()); fields.put("srv", (int) ((WeaponType) eq).getShortAV()); fields.put("mrv", (int) ((WeaponType) eq).getMedAV());
heat += wtype.getHeat(); srv += wtype.getShortAV() * multiplier; mrv += wtype.getMedAV() * multiplier;
@Override public int getBattleForceTotalHeatGeneration(int location) { int totalHeat = 0; for (Mounted mount : getWeaponList()) { WeaponType weapon = (WeaponType) mount.getType(); if (weapon.hasFlag(WeaponType.F_ONESHOT) || getBattleForceLocationMultiplier(location, mount.getLocation(), mount.isRearMounted()) == 0) { continue; } totalHeat += weapon.getHeat(); } return totalHeat; }
/** * We need to check whether the weapon is mounted in LOC_AFT in addition to * isRearMounted() */ @Override public int getBattleForceTotalHeatGeneration(boolean allowRear) { int totalHeat = 0; for (Mounted mount : getWeaponList()) { WeaponType weapon = (WeaponType) mount.getType(); if (weapon instanceof BayWeapon) { for (int index : mount.getBayWeapons()) { totalHeat += ((WeaponType) (getEquipment(index).getType())).getHeat(); } } if (weapon.hasFlag(WeaponType.F_ONESHOT) || (allowRear && !mount.isRearMounted() && mount.getLocation() != LOC_AFT) || (!allowRear && (mount.isRearMounted() || mount.getLocation() == LOC_AFT))) { continue; } totalHeat += weapon.getHeat(); } return totalHeat; }
@Override public int getBattleForceTotalHeatGeneration(boolean allowRear) { int totalHeat = 0; // finish the max heat calculations if (this.getJumpMP() > 0) { totalHeat += getJumpHeat(getJumpMP()); } else if (!isIndustrial() && hasEngine()) { totalHeat += getEngine().getRunHeat(this); } for (Mounted mount : getWeaponList()) { WeaponType weapon = (WeaponType) mount.getType(); if (weapon.hasFlag(WeaponType.F_ONESHOT) || (allowRear && !mount.isRearMounted()) || (!allowRear && mount.isRearMounted())) { continue; } if (weapon.getAmmoType() == AmmoType.T_AC_ROTARY) { totalHeat += weapon.getHeat() * 6; } else if (weapon.getAmmoType() == AmmoType.T_AC_ULTRA || weapon.getAmmoType() == AmmoType.T_AC_ULTRA_THB) { totalHeat += weapon.getHeat() * 2; } else { totalHeat += weapon.getHeat(); } } if (hasWorkingMisc(MiscType.F_STEALTH, -1)) { totalHeat += 10; } return totalHeat; }
@Test public void testHeatSinkCount() { Protomech mockProto = createGenericMockProto(); Mounted laser = new Mounted(mockProto, EquipmentType.get("CLERSmallLaser")); laser.setLocation(Protomech.LOC_TORSO); ArrayList<Mounted> eqList = new ArrayList<>(); eqList.add(laser); when(mockProto.getEquipment()).thenReturn(eqList); when(mockProto.getWeaponList()).thenReturn(eqList); TestProtomech test = new TestProtomech(mockProto, option, null); assertEquals(test.getCountHeatSinks(), ((WeaponType) laser.getType()).getHeat()); eqList.add(new Mounted(mockProto, EquipmentType.get("CLUltraAC5"))); assertEquals(test.getCountHeatSinks(), ((WeaponType) laser.getType()).getHeat()); } }
return wp.getDamage(); case COL_HEAT: return wp.getHeat(); case COL_SHORT: return wp.getShortRange();
if (mount.getType().hasFlag(WeaponType.F_ENERGY)) { WeaponType wtype = (WeaponType) mount.getType(); sinks += wtype.getHeat();
if (getType() instanceof WeaponType) { WeaponType wtype = (WeaponType) getType(); int heat = wtype.getHeat();
double weaponHeat = wtype.getHeat();
|| wt.hasFlag(WeaponType.F_PLASMA_MFUK) || (wt.hasFlag(WeaponType.F_FLAMER) && (wt.getAmmoType() == AmmoType.T_NA))) { heat += wt.getHeat();
if (mount.getType().hasFlag(WeaponType.F_ENERGY)) { WeaponType wtype = (WeaponType) mount.getType(); sinks += wtype.getHeat();