Example #1
0
 public RangedAttack(EntityMyPet entityMyPet, float walkSpeedModifier, float range) {
   this.entityMyPet = entityMyPet;
   this.myPet = entityMyPet.getMyPet();
   this.shootTimer = -1;
   this.lastSeenTimer = 0;
   this.walkSpeedModifier = walkSpeedModifier;
   this.range = range;
   rangedSkill = entityMyPet.getMyPet().getSkills().getSkill(Ranged.class);
 }
Example #2
0
 private Projectiles getProjectile() {
   Skills skills = entityMyPet.getMyPet().getSkills();
   if (skills.isSkillActive(Ranged.class)) {
     return skills.getSkill(Ranged.class).getProjectile();
   }
   return Projectiles.Arrow;
 }
Example #3
0
 public MeleeAttack(
     EntityMyPet petEntity, float walkSpeedModifier, double range, int ticksUntilNextHit) {
   this.petEntity = petEntity;
   this.myPet = petEntity.getMyPet();
   this.walkSpeedModifier = walkSpeedModifier;
   this.range = range;
   this.ticksUntilNextHit = ticksUntilNextHit;
 }
Example #4
0
 @Override
 public boolean shouldFinish() {
   if (!this.petEntity.hasTarget() || !this.petEntity.canMove()) {
     return true;
   } else if (this.targetEntity.getBukkitEntity() != this.petEntity.getTarget()) {
     return true;
   }
   if (petEntity.getMyPet().getRangedDamage() > 0
       && this.petEntity.f(targetEntity.locX, targetEntity.getBoundingBox().b, targetEntity.locZ)
           >= 20) {
     return true;
   }
   return false;
 }
Example #5
0
  @Override
  public boolean shouldStart() {
    if (myPet.getDamage() <= 0) {
      return false;
    }
    if (!this.petEntity.hasTarget()) {
      return false;
    }
    EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();

    if (targetEntity instanceof EntityArmorStand) {
      return false;
    }
    if (petEntity.getMyPet().getRangedDamage() > 0
        && this.petEntity.f(targetEntity.locX, targetEntity.getBoundingBox().b, targetEntity.locZ)
            >= 20) {
      return false;
    }
    this.targetEntity = targetEntity;
    return true;
  }