public void slowdamage(Location nxt, Hero fhero) {
    for (LivingEntity target : getNearbyLivingEntities(nxt, 3)) {
      if (!targets.contains(target.getEntityId())) {
        if (Skill.damageCheck(fhero.getPlayer(), target)) {

          Skill.damageEntity(
              target, fhero.getPlayer(), 10, EntityDamageEvent.DamageCause.MAGIC, false);
          if (target instanceof Player) {
            plugin
                .getCharacterManager()
                .getHero((Player) target)
                .addEffect(
                    new com.herocraftonline.heroes.characters.effects.common.SlowEffect(
                        this, 1500, 2, false, null, null, fhero));
          }
        }
      }
    }
  }
Example #2
0
  @Override
  public SkillResult use(Hero hero, LivingEntity target, String[] args) {
    Player player = hero.getPlayer();
    if (target.equals(player) || hero.getSummons().contains(target)) {
      return SkillResult.INVALID_TARGET;
    }

    long duration = SkillConfigManager.getUseSetting(hero, this, Setting.DURATION, 10000, false);
    long period = SkillConfigManager.getUseSetting(hero, this, Setting.PERIOD, 2000, true);
    int tickDamage = SkillConfigManager.getUseSetting(hero, this, "tick-damage", 1, false);
    BleedSkillEffect bEffect = new BleedSkillEffect(this, duration, period, tickDamage, player);

    if (target instanceof Player) {
      plugin.getHeroManager().getHero((Player) target).addEffect(bEffect);
    } else plugin.getEffectManager().addEntityEffect(target, bEffect);

    broadcastExecuteText(hero, target);
    return SkillResult.NORMAL;
  }