Пример #1
0
  /**
   * Method onEvtClanAttacked.
   *
   * @param attacked_member Creature
   * @param attacker Creature
   * @param damage int
   */
  @Override
  protected void onEvtClanAttacked(Creature attacked_member, Creature attacker, int damage) {
    super.onEvtClanAttacked(attacked_member, attacker, damage);
    final NpcInstance actor = getActor();

    if (_healSkills.length == 0) {
      return;
    }

    if (attacked_member.isDead()
        || actor.isDead()
        || (attacked_member.getCurrentHpPercents() > 50)) {
      return;
    }

    int heal_chance = 0;

    if (attacked_member.getId() == actor.getId()) {
      heal_chance = (attacked_member.getObjectId() == actor.getObjectId()) ? 100 : 0;
    } else {
      heal_chance = (attacked_member.getId() == Orfen_id) ? 90 : 10;
    }

    if (Rnd.chance(heal_chance) && canUseSkill(_healSkills[0], attacked_member, -1)) {
      addTaskAttack(attacked_member, _healSkills[0], 1000000);
    }
  }
Пример #2
0
 public ExFishingStartCombat(
     Creature character, int time, int hp, int mode, int lureType, int deceptiveMode) {
   char_obj_id = character.getObjectId();
   _time = time;
   _hp = hp;
   _mode = mode;
   _lureType = lureType;
   _deceptiveMode = deceptiveMode;
 }
Пример #3
0
 /**
  * Method useSkill.
  *
  * @param activeChar Creature
  * @param targets List<Creature>
  */
 @Override
 public void useSkill(Creature activeChar, List<Creature> targets) {
   if (isSSPossible()) {
     activeChar.unChargeShots(isMagic());
   }
   if (!activeChar.isPlayer()) {
     return;
   }
   Player player = activeChar.getPlayer();
   if (player.getTrainedBeasts() == null) {
     return;
   }
   if (_type == 0) {
     for (Creature target : targets) {
       if ((target != null) && (target instanceof TamedBeastInstance)) {
         if (player.getTrainedBeasts().get(target.getObjectId()) != null) {
           ((TamedBeastInstance) target).despawnWithDelay(1000);
         }
       }
     }
   } else if (_type > 0) {
     if (_type == 1) {
       for (TamedBeastInstance tamedBeast : player.getTrainedBeasts().values()) {
         tamedBeast
             .getAI()
             .setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player, Config.FOLLOW_RANGE);
       }
     } else if (_type == 3) {
       for (TamedBeastInstance tamedBeast : player.getTrainedBeasts().values()) {
         tamedBeast.buffOwner();
       }
     } else if (_type == 4) {
       for (TamedBeastInstance tamedBeast : player.getTrainedBeasts().values()) {
         tamedBeast.doDespawn();
       }
     }
   }
 }
Пример #4
0
 public NickNameChanged(Creature cha) {
   objectId = cha.getObjectId();
   title = cha.getTitle();
 }