예제 #1
0
  public void processEnvironmentallyAware(Wolf wolf, double damage) {
    if (damage > wolf.getHealth()) {
      return;
    }

    Player owner = getPlayer();

    wolf.teleport(owner);
    owner.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
  }
예제 #2
0
  /**
   * Apply the Fast Food Service ability.
   *
   * @param wolf The wolf using the ability
   * @param damage The damage being absorbed by the wolf
   */
  public void fastFoodService(Wolf wolf, double damage) {
    if (!SkillUtils.activationSuccessful(
        SecondaryAbility.FAST_FOOD,
        getPlayer(),
        Taming.fastFoodServiceActivationChance,
        activationChance)) {
      return;
    }

    double health = wolf.getHealth();
    double maxHealth = wolf.getMaxHealth();

    if (health < maxHealth) {
      double newHealth = health + damage;
      wolf.setHealth(Math.min(newHealth, maxHealth));
    }
  }