private EntityState getShooterState() { if (null == shooterState) { shooterState = new EntityState(getShooter()); } return shooterState; }
ToHitData calcToHit() { return owner.getFireControl(getShooter()).guessToHitModifierForWeapon(getShooter(), getShooterState(), getTarget(), getTargetState(), getWeapon(), getGame()); }
String getDebugDescription(boolean detailed) { if (size() == 0) { return "Empty FiringPlan!"; } StringBuilder description = new StringBuilder("Firing Plan for ").append(get(0).getShooter().getChassis()) .append(" at ") .append(getTarget().getDisplayName()) .append("; ").append(Integer.toString(size())) .append(" weapons fired "); if (detailed) { for (WeaponFireInfo weaponFireInfo : this) { description.append("\n\t\t").append(weaponFireInfo.getDebugDescription()); } } DecimalFormat decimalFormat = new DecimalFormat("0.00000"); description.append("\n\tTotal Expected Damage=").append(decimalFormat.format(getExpectedDamage())); description.append("\n\tTotal Expected Criticals=").append(decimalFormat.format(getExpectedCriticals())); description.append("\n\tKill Probability=").append(decimalFormat.format(getKillProbability())); description.append("\n\tUtility=").append(decimalFormat.format(getUtility())); return description.toString(); }
WeaponAttackAction getWeaponAttackAction() { final String METHOD_NAME = "getWeaponAttackAction(IGame)"; owner.methodBegin(getClass(), METHOD_NAME); try { if (null != getAction()) { return getAction(); } if (!getWeapon().getType().hasFlag(WeaponType.F_ARTILLERY)) { setAction(new WeaponAttackAction(getShooter().getId(), getTarget().getTargetId(), getShooter().getEquipmentNum(getWeapon()))); } else { setAction(new ArtilleryAttackAction(getShooter().getId(), getTarget().getTargetType(), getTarget().getTargetId(), getShooter().getEquipmentNum(getWeapon()), getGame())); } if (getAction() == null) { setProbabilityToHit(0); return null; } setProbabilityToHit(Compute.oddsAbove(getAction().toHit(getGame()).getValue(), getShooterState().hasNaturalAptGun()) / 100.0); return getAction(); } finally { owner.methodEnd(getClass(), METHOD_NAME); } }
private ToHitData calcToHit(final MovePath shooterPath, final boolean assumeUnderFlightPath) { return owner.getFireControl(getShooter()).guessAirToGroundStrikeToHitModifier(getShooter(), null, getTarget(), getTargetState(), shooterPath, getWeapon(), getGame(), assumeUnderFlightPath); }
new StringBuilder("Initializing Damage for ").append(getShooter().getDisplayName()) .append(" firing ").append(getWeapon().getDesc()) .append(" at ").append(getTarget().getDisplayName())
/** * Builds a {@link Vector} of all the actions, {@link EntityAction}, that make up this firing plan. * * @return The list of actions as a vector. */ synchronized Vector<EntityAction> getEntityActionVector() { Vector<EntityAction> actionVector = new Vector<>(); if (size() == 0) { return actionVector; } if(getTwist() != 0) { actionVector.add(new TorsoTwistAction(get(0).getShooter().getId(), FireControl.correctFacing(get(0).getShooter().getFacing() + getTwist()))); } if(flipArms) { actionVector.addElement(new FlipArmsAction(get(0).getShooter().getId(), flipArms)); } for (WeaponFireInfo weaponFireInfo : this) { actionVector.add(weaponFireInfo.getWeaponAttackAction()); } return actionVector; }
private WeaponAttackAction buildBombAttackAction(final int[] bombPayload) { final WeaponAttackAction diveBomb = new WeaponAttackAction(getShooter().getId(), getTarget().getTargetType(), getTarget().getTargetId(), getShooter().getEquipmentNum(getWeapon())); diveBomb.setBombPayload(bombPayload); return diveBomb; }
WeaponAttackAction buildWeaponAttackAction() { if (!getWeapon().getType().hasFlag(WeaponType.F_ARTILLERY)) { return new WeaponAttackAction(getShooter().getId(), getTarget().getTargetType(), getTarget().getTargetId(), getShooter().getEquipmentNum(getWeapon())); } else { return new ArtilleryAttackAction(getShooter().getId(), getTarget().getTargetType(), getTarget().getTargetId(), getShooter().getEquipmentNum(getWeapon()), getGame()); } }
Mockito.when(mockPPCFireInfo.getKillProbability()).thenReturn(0.002); Mockito.when(mockPPCFireInfo.getWeapon()).thenReturn(mockPPC); Mockito.when(mockPPCFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockPPCFireInfo.getDebugDescription()).thenReturn("mock PPC"); alphaStrike.add(mockPPCFireInfo); Mockito.when(mockMLFireInfo.getKillProbability()).thenReturn(0.0); Mockito.when(mockMLFireInfo.getWeapon()).thenReturn(mockML); Mockito.when(mockMLFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockMLFireInfo.getDebugDescription()).thenReturn("mock ML"); alphaStrike.add(mockMLFireInfo); Mockito.when(mockLRMFireInfo.getKillProbability()).thenReturn(0.0); Mockito.when(mockLRMFireInfo.getWeapon()).thenReturn(mockLRM5); Mockito.when(mockLRMFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockLRMFireInfo.getDebugDescription()).thenReturn("mock LRM"); alphaStrike.add(mockLRMFireInfo); Mockito.when(mockMGFireInfo.getKillProbability()).thenReturn(0.0); Mockito.when(mockMGFireInfo.getWeapon()).thenReturn(mockMG); Mockito.when(mockMGFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockMGFireInfo.getDebugDescription()).thenReturn("mock MG"); alphaStrike.add(mockMGFireInfo);
action.setAmmoId(shooter.getEquipmentNum(mountedAmmo)); info.setAction(action); owner.sendAmmoChange(info.getShooter().getId(), shooter.getEquipmentNum(currentWeapon), shooter.getEquipmentNum(mountedAmmo));
double computeExpectedDamage() { return computeExpectedBombDamage(getShooter(), weapon, getTarget().getPosition()); int maxRange = game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_TACOPS_RANGE) ? weaponType.getExtremeRange() : weaponType.getLongRange(); int targetDistance = getShooter().getPosition().distance(getTarget().getPosition());