예제 #1
0
  /**
   * Method canAttackCharacter.
   *
   * @param target Creature
   * @return boolean
   */
  @Override
  protected boolean canAttackCharacter(Creature target) {
    final NpcInstance actor = getActor();

    if (getIntention() == CtrlIntention.AI_INTENTION_ATTACK) {
      final AggroList.AggroInfo ai = actor.getAggroList().get(target);
      return (ai != null) && (ai.hate > 0);
    }

    if (!startBattle) {
      return false;
    }

    return Util.contains(ATTACK_IDS, target.getId());
  }
예제 #2
0
  /**
   * Method onEvtAttacked.
   *
   * @param attacker Creature
   * @param damage int
   */
  @Override
  public void onEvtAttacked(Creature attacker, int damage) {
    final NpcInstance actor = getActor();
    super.onEvtAttacked(attacker, damage);

    if ((PositionUtils.calculateDistance(attacker, actor, false) > 300.) && Rnd.chance(0.13)) {
      addTaskCast(attacker, DRAIN_SKILL);
    }

    final Creature target = actor.getAggroList().getMostHated();

    if ((target.equals(attacker)) && Rnd.chance(0.3)) {
      addTaskCast(attacker, DAMAGE_SKILL);
    }
  }