Пример #1
0
 @Override
 protected int chooseSkillToUseItOnSomeBitch(L2FpInstance player, L2Character enemy) {
   if (!isCurrentHpLowerThan(enemy, 90) && !enemy.isRaid() && !player.isMoving())
     return TRIPLE_SLASH;
   L2Effect effectVS = player.getFirstEffect(VICIOUS_STANCE);
   if (isCurrentHpLowerThan(player, 50) || getMyAttackersCount(player) > 2) {
     if (effectVS == null) {
       return VICIOUS_STANCE;
     }
   } else if (effectVS != null) {
     effectVS.exit();
   }
   return 0;
 }
Пример #2
0
 @Override
 protected int chooseSkillToUseItOnSomeBitch(L2FpInstance player, L2Character enemy) {
   L2Effect effectVS = player.getFirstEffect(VICIOUS_STANCE);
   if (isCurrentHpLowerThan(player, 60) || getMyAttackersCount(player) > 2) {
     if (effectVS == null) {
       return VICIOUS_STANCE;
     }
   } else if (effectVS != null) {
     effectVS.exit();
   }
   if (!isCurrentHpLowerThan(enemy, 80) && player.isBehind(enemy) && !player.isMoving())
     return BACKSTAB;
   if ((!isCurrentHpLowerThan(enemy, 80) || isCurrentHpLowerThan(player, 50))
       && !player.isMoving()) {
     if (Rnd.get(2) == 0) return CRITICAL_BLOW;
     else return DEADLY_BLOW;
   }
   return 0;
 }
Пример #3
0
 @Override
 public void addEffect(L2Effect newEffect) {
   if (newEffect instanceof EffectDebuff || newEffect instanceof EffectBuff)
     super.addEffect(newEffect);
   else if (newEffect != null) newEffect.stopEffectTask();
 }
Пример #4
0
  public void activate(L2PcInstance player, ItemInstance item) {
    // if the player is mounted, attempt to unmount first and pick it if successful.
    if (player.isMounted() && !player.dismount()) {
      player.sendPacket(
          SystemMessage.getSystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1)
              .addItemName(item.getItemId()));
      item.setDestroyProtected(true);
      player.dropItem("InvDrop", item, null, true);
      return;
    }

    _isActivated = true;

    // Hold player data.
    _player = player;
    _playerId = _player.getObjectId();
    _playerKarma = _player.getKarma();
    _playerPkKills = _player.getPkKills();

    _item = item;

    // Generate a random number for next stage.
    _numberBeforeNextStage =
        Rnd.get((int) Math.round(_stageKills * 0.5), (int) Math.round(_stageKills * 1.5));

    // Renew hungry time.
    _hungryTime = _durationLost * 60;

    // Activate the daily timer.
    _dailyTimerTask =
        ThreadPoolManager.getInstance()
            .scheduleGeneralAtFixedRate(new DailyTimerTask(), 60000L, 60000L);

    // Cancel the "1h dropped CW" timer.
    cancelDropTimerTask();

    insertData();

    // Change player stats
    _player.setCursedWeaponEquippedId(_itemId);
    _player.setKarma(9999999);
    _player.setPkKills(0);

    if (_player.isInParty()) _player.getParty().removePartyMember(_player, MessageType.Expelled);

    // Disable active toggles
    for (L2Effect effect : _player.getAllEffects()) {
      if (effect.getSkill().isToggle()) effect.exit();
    }

    // Add CW skills
    giveDemonicSkills();

    // Equip the weapon
    _player.useEquippableItem(_item, true);

    // Fully heal player
    _player.setCurrentHpMp(_player.getMaxHp(), _player.getMaxMp());
    _player.setCurrentCp(_player.getMaxCp());

    // Refresh player stats
    _player.broadcastUserInfo();

    // _player.broadcastPacket(new SocialAction(_player, 17));
    Broadcast.toAllOnlinePlayers(
        SystemMessage.getSystemMessage(
                SystemMessageId.THE_OWNER_OF_S2_HAS_APPEARED_IN_THE_S1_REGION)
            .addZoneName(_player.getX(), _player.getY(), _player.getZ())
            .addItemName(_item.getItemId()));
  }
Пример #5
0
 public ConfirmDlg addSkillName(L2Effect effect) {
   return addSkillName(effect.getSkill());
 }