/** * The possible fire control types. * If you're adding a new one, add it here then make sure to add it to Princess.InitializeFireControls */ public enum FireControlType { Basic, Infantry }
/** * Creates a new {@link WeaponFireInfo} object containing data about firing the given weapon at the given target. * * @param shooter The unit doing the shooting. * @param target The target being fired on. * @param weapon The weapon being fired. * @param game The game being played. * @param guessToHit Set TRUE to estimate the odds to hit rather than doing the full calculation. * @return The resulting {@link WeaponFireInfo}. */ WeaponFireInfo buildWeaponFireInfo(final Entity shooter, final Targetable target, final Mounted weapon, final IGame game, final boolean guessToHit) { return new WeaponFireInfo(shooter, target, weapon, game, guessToHit, owner); }
/** * Creates a new {@link WeaponFireInfo} object containing data about firing the given weapon at the given target. * * @param shooter The unit doing the shooting. * @param flightPath The path the unit flies over this turn. * @param target The target being fired on. * @param targetState The current state of the target. * @param weapon The weapon being fired. * @param game The game being played. * @param assumeUnderFlightPath Set TRUE to assume the target is under the flight path and avoid doing the full * calculation. * @param guessToHit Set TRUE to estimate the odds to hit rather than doing the full calculation. * @return The resulting {@link WeaponFireInfo}. */ WeaponFireInfo buildWeaponFireInfo(final Entity shooter, final MovePath flightPath, final Targetable target, final EntityState targetState, final Mounted weapon, final IGame game, final boolean assumeUnderFlightPath, final boolean guessToHit) { return new WeaponFireInfo(shooter, flightPath, target, targetState, weapon, game, assumeUnderFlightPath, guessToHit, owner, new int[0]); }
final IGame game, final boolean guessToHit) { return new WeaponFireInfo(shooter, shooterState, target, targetState, weapon, game, guessToHit, owner);
/** * Worker function that calculates the shooter's "best" actions that result in a TAG being fired. * @param shooter * @param game * @param owner * @return */ private WeaponFireInfo getTAGInfo(Mounted weapon, Entity shooter, IGame game, Princess owner) { WeaponFireInfo retval = null; double hitOdds = 0.0; // pretty simple logic here: take the best shot that you have for(Targetable target : FireControl.getAllTargetableEnemyEntities(owner.getLocalPlayer(), game, owner.getFireControlState())) { WeaponFireInfo wfi = new WeaponFireInfo(shooter, target, weapon, game, false, owner); if(wfi.getProbabilityToHit() > hitOdds) { hitOdds = wfi.getProbabilityToHit(); retval = wfi; } } return retval; }
final WeaponFireInfo guessInfo = new WeaponFireInfo(shooter, new EntityState(shooter), target, true, owner); final WeaponFireInfo accurateInfo = new WeaponFireInfo(shooter, target, weapon, game, false, owner);
final double DELTA = 0.00001; WeaponFireInfo testWeaponFireInfo = Mockito.spy(new WeaponFireInfo(mockPrincess)); testWeaponFireInfo.setShooter(mockShooter); testWeaponFireInfo.setShooterState(mockShooterState);
WeaponFireInfo wfi = new WeaponFireInfo(shooter, hexTarget, currentWeapon, game, false, owner);