Esempio n. 1
0
 public int getPhysicalAttackAngle() {
   final L2Weapon weapon = _activeChar.getActiveWeaponItem();
   final int baseAttackAngle;
   if (weapon != null) {
     baseAttackAngle = weapon.getBaseAttackAngle();
   } else {
     baseAttackAngle = 120;
   }
   return baseAttackAngle;
 }
Esempio n. 2
0
  /** @return the Physical Attack range (base+modifier) of the L2Character. */
  public final int getPhysicalAttackRange() {
    final L2Weapon weapon = _activeChar.getActiveWeaponItem();
    int baseAttackRange;
    if (_activeChar.isTransformed() && _activeChar.isPlayer()) {
      baseAttackRange =
          _activeChar.getTransformation().getBaseAttackRange(_activeChar.getActingPlayer());
    } else if (weapon != null) {
      baseAttackRange = weapon.getBaseAttackRange();
    } else {
      baseAttackRange = _activeChar.getTemplate().getBaseAttackRange();
    }

    return (int) calcStat(Stats.POWER_ATTACK_RANGE, baseAttackRange, null, null);
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState qs = getQuestState(killer, false);

    if ((qs == null) || !Util.checkIfInRange(1500, killer, npc, true)) {
      return super.onKill(npc, killer, isSummon);
    }

    switch (npc.getId()) {
      case SKELETON_MARAUDER:
      case SKELETON_RAIDER:
        {
          if (qs.isMemoState(2)) {
            final int flag = qs.getInt("flag");

            if (getRandom(100) < (flag * 10)) {
              addSpawn(SPIRIT_OF_SIR_HEROD, npc);
              qs.set("flag", 0);
            } else {
              qs.set("flag", flag + 1);
            }
          }
          break;
        }
      case SPIRIT_OF_SIR_HEROD:
        {
          if (qs.isMemoState(2)) {
            final L2Weapon weapon = killer.getActiveWeaponItem();

            if ((weapon != null) && (weapon.getId() == OLD_KNIGHTS_SWORD)) {
              giveItems(killer, KNIGHTS_TEAR, 1);
              qs.setMemoState(3);
              qs.setCond(3, true);
            }
          }
          break;
        }
      case STRAIN:
      case GHOUL:
        {
          if (qs.isMemoState(5) && !hasQuestItems(killer, TALIANUSS_REPORT)) {
            if (giveItemRandomly(
                killer, npc, REPORT_PIECE.getId(), 1, REPORT_PIECE.getCount(), 1, true)) {
              takeItem(killer, REPORT_PIECE);
              giveItems(killer, TALIANUSS_REPORT, 1);
              qs.setCond(6);
            }
          }
          break;
        }
      case HANGMAN_TREE:
        {
          if (qs.isMemoState(6)) {
            final int flag = qs.getInt("flag");

            if (getRandom(100) < ((flag - 3) * 33)) {
              addSpawn(SPIRIT_OF_SIR_TALIANUS, npc);
              qs.set("flag", 0);
              qs.setCond(8, true);
            } else {
              qs.set("flag", flag + 1);
            }
          }
          break;
        }
      case LETO_LIZARDMAN:
      case LETO_LIZARDMAN_ARCHER:
      case LETO_LIZARDMAN_SOLDIER:
      case LETO_LIZARDMAN_WARRIOR:
      case LETO_LIZARDMAN_SHAMAN:
      case LETO_LIZARDMAN_OVERLORD:
        {
          if (qs.isMemoState(9)
              && giveItemRandomly(
                  killer, npc, MILITAS_ARTICLE.getId(), 1, MILITAS_ARTICLE.getCount(), 1, true)) {
            qs.setCond(12);
          }
          break;
        }
      case BREKA_ORC_OVERLORD:
        {
          if (qs.isMemoState(11)) {
            if (!hasQuestItems(killer, ATHEBALDTS_SKULL)) {
              giveItems(killer, ATHEBALDTS_SKULL, 1);
              playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
            } else if (!hasQuestItems(killer, ATHEBALDTS_RIBS)) {
              giveItems(killer, ATHEBALDTS_RIBS, 1);
              playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
            } else if (!hasQuestItems(killer, ATHEBALDTS_SHIN)) {
              giveItems(killer, ATHEBALDTS_SHIN, 1);
              qs.setCond(15, true);
            }
          }
          break;
        }
    }
    return super.onKill(npc, killer, isSummon);
  }