Beispiel #1
0
  @Override
  public CombatEntityAPI findTarget() {
    target = missile.getSource().getShipTarget();

    if (target == null || target.getOwner() != missile.getOwner()) target = missile.getSource();

    if ((!(target instanceof ShipAPI) || !((ShipAPI) target).isAlive()))
      target = AIUtils.getNearestAlly(missile);

    return target;
  }
Beispiel #2
0
  @Override
  public void evaluateCircumstances() {
    super.evaluateCircumstances();

    //        if(target == null || (!(target instanceof ShipAPI) || !((ShipAPI)target).isAlive())) {
    //            findTarget();
    //            return;
    //        }

    Vector2f.sub(
        MathUtils.getRandomPointInCircle(target.getLocation(), target.getCollisionRadius()),
        target.getLocation(),
        destOffset);

    if (missile.isFading() || ammo <= 0 || !missile.getSource().isAlive())
      IceUtils.destroy(missile);

    potentialTargets.clear();
    potentialTargets.addAll(AIUtils.getNearbyEnemyMissiles(missile, POTENTIAL_TARGET_RANGE));
    potentialTargets.addAll(AIUtils.getNearbyEnemies(missile, POTENTIAL_TARGET_RANGE));
  }