@Override
 public void calc(Env env) {
   L2Character p = env.getCharacter();
   // CT2: The magic critical rate has been increased to 50 times.
   if (p.isPlayer()) {
     env.mulValue(BaseStats.WIT.calcBonus(p));
   } else {
     env.mulValue(BaseStats.WIT.calcBonus(p) * 10.0);
   }
 }
Example #2
0
  @Override
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets) {
    if (!(activeChar instanceof L2PcInstance)) {
      return;
    }

    boolean isMastersCall = skill.getId() == 23249;

    L2PcInstance activePlayer = activeChar.getActingPlayer();

    if (!isMastersCall && !activePlayer.getSummonFriendController().checkSummonerStatus()) {
      return;
    }

    try {
      for (L2Character target : (L2Character[]) targets) {
        if (target == null || activeChar.equals(target) || !target.isPlayer()) {
          continue;
        }

        if (isMastersCall) // Master's Call
        {
          L2Party party = target.getParty();
          if (party != null) {
            party
                .getMembers()
                .stream()
                .filter(partyMember -> !target.equals(partyMember))
                .forEach(
                    partyMember ->
                        partyMember.teleToLocation(
                            target.getX(), target.getY(), target.getZ(), true));
          } else {
            activePlayer.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                    .addSkillName(skill));
          }
        } else {
          if (skill.isClanSkill()) // Призыв Клана
          {
            if (!target.getActingPlayer().isInSameClan(activePlayer)) {
              activePlayer.sendPacket(
                  SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                      .addSkillName(skill));
              continue;
            } else if (!target.getActingPlayer().isInSameParty(activePlayer)) {
              activePlayer.sendPacket(
                  SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                      .addSkillName(skill));
              continue;
            }
          }

          L2PcInstance targetPlayer = target.getActingPlayer();

          if (!Util.checkIfInRange(500, activeChar, target, false)) {
            if (!targetPlayer.getSummonFriendController().setSummoner(activePlayer, skill)) {
              SystemMessage sm =
                  SystemMessage.getSystemMessage(SystemMessageId.C1_ALREADY_SUMMONED);
              sm.addString(target.getName());
              activePlayer.sendPacket(sm);
            }

            ConfirmDlg confirm =
                new ConfirmDlg(
                    SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
            confirm.addCharName(activeChar);
            confirm.addZoneName(activeChar.getX(), activeChar.getY(), activeChar.getZ());
            confirm.addTime(30000);
            confirm.addRequesterId(activePlayer.getObjectId());
            target.sendPacket(confirm);
            // targetPlayer.getSummonFriendController().teleport();
          }
        }
      }
    } catch (Exception e) {
      _log.log(Level.ERROR, "", e);
    }
  }