Beispiel #1
0
 public String getFormattedValue() {
   return ""
       + ChatColor.GOLD
       + damage
       + ChatColor.RESET
       + " "
       + Translation.getString("Name.Damage", myPet.getOwner());
 }
Beispiel #2
0
 public void reset() {
   damage = 0;
   if (myPet.getStatus() == PetState.Here) {
     getMyPet().getEntity().get().getHandle().getPathfinder().clearGoals();
     getMyPet().getEntity().get().getHandle().getTargetSelector().clearGoals();
     getMyPet().getEntity().get().getHandle().setPathfinder();
     getMyPet().getEntity().get().setTarget(null);
   }
 }
Beispiel #3
0
 public void upgrade(SkillInfo upgrade, boolean quiet) {
   if (upgrade instanceof DamageInfo) {
     boolean isPassive = damage <= 0;
     if (upgrade.getProperties().getCompoundData().containsKey("damage")) {
       int damage = upgrade.getProperties().getAs("damage", TagInt.class).getIntData();
       upgrade.getProperties().getCompoundData().remove("damage");
       TagDouble TagDouble = new TagDouble(damage);
       upgrade.getProperties().getCompoundData().put("damage_double", TagDouble);
     }
     if (upgrade.getProperties().getCompoundData().containsKey("damage_double")) {
       if (!upgrade.getProperties().getCompoundData().containsKey("addset_damage")
           || upgrade
               .getProperties()
               .getAs("addset_damage", TagString.class)
               .getStringData()
               .equals("add")) {
         damage += upgrade.getProperties().getAs("damage_double", TagDouble.class).getDoubleData();
       } else {
         damage = upgrade.getProperties().getAs("damage_double", TagDouble.class).getDoubleData();
       }
       if (!quiet) {
         myPet
             .getOwner()
             .sendMessage(
                 Util.formatText(
                     Translation.getString(
                         "Message.Skill.Damage.Upgrade", myPet.getOwner().getLanguage()),
                     myPet.getPetName(),
                     damage));
       }
     }
     if (isPassive != (damage <= 0)) {
       if (myPet.getStatus() == PetState.Here) {
         getMyPet().getEntity().get().getHandle().getPathfinder().clearGoals();
         getMyPet().getEntity().get().getHandle().getTargetSelector().clearGoals();
         getMyPet().getEntity().get().getHandle().setPathfinder();
         if (damage == 0) {
           getMyPet().getEntity().get().setTarget(null);
         }
       }
     }
   }
 }
Beispiel #4
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;
  }
Beispiel #5
0
  @Override
  public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;

    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();

    try {
      Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
      Object obj = ctor.newInstance(world, pet);
      if (obj instanceof EntityMyPet) {
        petEntity = (EntityMyPet) obj;
      }
    } catch (Exception e) {
      MyPetApi.getLogger()
          .info(ChatColor.RED + entityClass.getName() + " is no valid MyPet(Entity)!");
      e.printStackTrace();
    }

    return petEntity;
  }