示例#1
0
  @Override
  public boolean shouldStart() {
    if (myPet.getRangedDamage() <= 0) {
      return false;
    }
    if (!entityMyPet.canMove()) {
      return false;
    }
    if (!entityMyPet.hasTarget()) {
      return false;
    }

    EntityLiving target = ((CraftLivingEntity) this.entityMyPet.getTarget()).getHandle();

    if (target instanceof EntityArmorStand) {
      return false;
    }
    double meleeDamage = myPet.getDamage();
    if (meleeDamage > 0
        && this.entityMyPet.f(target.locX, target.getBoundingBox().b, target.locZ) < 4) {
      if (meleeDamage > rangedSkill.getDamage()) {
        return false;
      }
    }
    this.target = target;
    return true;
  }
示例#2
0
  @Override
  public void tick() {
    double distanceToTarget =
        this.entityMyPet.f(this.target.locX, this.target.getBoundingBox().b, this.target.locZ);
    boolean canSee = this.entityMyPet.getEntitySenses().a(this.target); // a -> canSee

    if (canSee) {
      this.lastSeenTimer++;
    } else {
      this.lastSeenTimer = 0;
    }

    if ((distanceToTarget <= this.range) && (this.lastSeenTimer >= 20)) {
      this.entityMyPet.getPetNavigation().getParameters().removeSpeedModifier("RangedAttack");
      this.entityMyPet.getPetNavigation().stop();
    } else {
      this.entityMyPet
          .getPetNavigation()
          .getParameters()
          .addSpeedModifier("RangedAttack", walkSpeedModifier);
      this.entityMyPet.getPetNavigation().navigateTo(this.target.getBukkitEntity().getLocation());
    }

    this.entityMyPet.getControllerLook().a(this.target, 30.0F, 30.0F);

    if (--this.shootTimer <= 0) {
      if (distanceToTarget < this.range && canSee) {
        shootProjectile(this.target, (float) myPet.getRangedDamage(), getProjectile());
        this.shootTimer = this.rangedSkill.getRateOfFire();
      }
    }
  }
示例#3
0
 @Override
 public boolean shouldFinish() {
   if (entityMyPet.getTarget() == null
       || !target.isAlive()
       || myPet.getRangedDamage() <= 0
       || !entityMyPet.canMove()) {
     return true;
   }
   if (this.target.getBukkitEntity() != this.myPet.getEntity().getTarget()) {
     return true;
   }
   double meleeDamage = myPet.getDamage();
   if (meleeDamage > 0
       && this.entityMyPet.f(target.locX, target.getBoundingBox().b, target.locZ) < 4) {
     if (meleeDamage > rangedSkill.getDamage()) {
       return true;
     }
   }
   return false;
 }