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); }
private Projectiles getProjectile() { Skills skills = entityMyPet.getMyPet().getSkills(); if (skills.isSkillActive(Ranged.class)) { return skills.getSkill(Ranged.class).getProjectile(); } return Projectiles.Arrow; }
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; }
@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; }
@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; }