/** * Calculate an indirect artillery "fire plan", taking into account the possibility of rotating the turret. * @param shooter Entity doing the shooting * @param game Game pointer * @param owner Princess pointer * @return Firing plan */ public FiringPlan calculateIndirectArtilleryPlan(Entity shooter, IGame game, Princess owner) { FiringPlan bestPlan = calculateIndirectArtilleryPlan(shooter, game, owner, 0); // simply loop through all possible facings and see if any of those is better than the no-turning plan if(!shooter.isOffBoard()) { for(int facingChange : FireControl.getValidFacingChanges(shooter)) { FiringPlan twistPlan = calculateIndirectArtilleryPlan(shooter, game, owner, facingChange); if(twistPlan.getUtility() > bestPlan.getUtility()) { bestPlan = twistPlan; } } } return bestPlan; }
/** * Calculates the targeting/offboard turn * This includes firing TAG and non-direct-fire artillery */ @Override protected void calculateTargetingOffBoardTurn() { Entity entityToFire = getGame().getFirstEntity(getMyTurn()); FiringPlan firingPlan = getArtilleryTargetingControl().calculateIndirectArtilleryPlan(entityToFire, getGame(), this); sendAttackData(entityToFire.getId(), firingPlan.getEntityActionVector()); sendDone(true); }