.findFirst(); if (ammo.isPresent()) { damage = ((AmmoType)ammo.get()).getDamagePerShot() * Math.max(1, ((AmmoType)ammo.get()).getRackSize());
@Override protected int calcDamagePerHit() { AmmoType atype = (AmmoType) ammo.getType(); double toReturn = atype.getDamagePerShot(); int minRange; if (ae.isAirborne()) { minRange = wtype.getATRanges()[RangeType.RANGE_MINIMUM]; } else { minRange = wtype.getMinimumRange(); } if ((nRange <= minRange) && !weapon.isHotLoaded()) { toReturn /= 2; toReturn = Math.floor(toReturn); } if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { toReturn = Compute.directBlowInfantryDamage(toReturn, bDirect ? toHit.getMoS() / 3 : 0, wtype.getInfantryDamageClass(), ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); } else if (bDirect) { toReturn = Math.min(toReturn + (toHit.getMoS() / 3), toReturn * 2); } return (int) Math.ceil(toReturn); }
Mockito.when(mockAmmoLRM.getType()).thenReturn(mockAmmoTypeLRM); Mockito.when(mockAmmoTypeLRM.getMunitionType()).thenReturn(AmmoType.M_STANDARD); Mockito.when(mockAmmoTypeLRM.getDamagePerShot()).thenReturn(1); AmmoType mockAmmoTypeLBXCluster = Mockito.mock(AmmoType.class); Mockito.when(mockAmmoTypeLBXCluster.getMunitionType()).thenReturn(AmmoType.M_CLUSTER); Mockito.when(mockAmmoTypeLBXCluster.getDamagePerShot()).thenReturn(1); AmmoType mockAmmoTypeLBXSlug = Mockito.mock(AmmoType.class); Mockito.when(mockAmmoTypeLBXSlug.getMunitionType()).thenReturn(AmmoType.M_STANDARD); Mockito.when(mockAmmoTypeLBXSlug.getDamagePerShot()).thenReturn(1); Mockito.when(mockAmmoSRM.getType()).thenReturn(mockAmmoTypeSRM); Mockito.when(mockAmmoTypeSRM.getMunitionType()).thenReturn(AmmoType.M_STANDARD); Mockito.when(mockAmmoTypeSRM.getDamagePerShot()).thenReturn(2);
if (WeaponType.DAMAGE_BY_CLUSTERTABLE == weaponType1.getDamage() || AmmoType.M_CLUSTER == ammoType.getMunitionType()) { dmg1 = ammoType.getDamagePerShot(); if (WeaponType.DAMAGE_BY_CLUSTERTABLE == weaponType2.getDamage() || AmmoType.M_CLUSTER == ammoType.getMunitionType()) { dmg2 = ammoType.getDamagePerShot();
@Override protected int calcDamagePerHit() { double toReturn = ((AmmoType) ammo.getType()).getRackSize() * ((AmmoType) ammo.getType()).getDamagePerShot();
AmmoType atype = (AmmoType) type; int rackSize = atype.getRackSize(); int damagePerShot = atype.getDamagePerShot(); Mounted link = getLinked(); AmmoType atype = ((AmmoType) link.getType()); int damagePerShot = atype.getDamagePerShot();
fDamage = fHits * at.getDamagePerShot(); } else { fDamage = wt.getDamage();
&& (weapon.getLinked().getType() instanceof AmmoType)) { at = (AmmoType) weapon.getLinked().getType(); fDamage = at.getDamagePerShot();