Lineage Justice

Spells & Skills

Lookup and validate skills and spells.

Summon
MP: 30 HP: 30 Item: 40318 Amount: 3 Duration: 0 Skill Type: Other
Delay: 1000 Cast Invis: No Ignores CM: No Element: Earth Range: N/A Area: N/A
Dmg Value: 0.0 Dmg Dice: 0 Dice Count: 0 Prob Value: 0 Prob Dice: 0 Prob Max: N/A
L1SkillUse Execution:

if (_skillId == SUMMON_MONSTER || _skillId == AVATAR) {
	L1PcInstance pc = (L1PcInstance) cha;
	int level = pc.getLevel();
	int[] summons;
	if (pc.getMap().isRecallPets() || pc.isGm()) {
		if (pc.getInventory().checkEquipped(20284)) {
			pc.sendPackets(new S_ShowSummonList(pc.getId()));
			if (!pc.isSummonMonster()) {
				pc.setSummonMonster(true);
			}
		} else {
			summons = new int[] { 81210, 81213, 81216,
					81219, 81222, 81225, 81228 };
			int summonid = 0;
			int summoncost = 8;
			int levelRange = 32;
			for (int i = 0; i < summons.length; i++) {
				if (level < levelRange
						|| i == summons.length - 1) {
					summonid = summons[i];
					break;
				}
				levelRange += 4;
			}

			int petcost = 0;
			Object[] petlist = pc.getPetList().values()
					.toArray();
			for (Object pet : petlist) {
				petcost += ((L1NpcInstance) pet)
						.getPetcost();
			}
			int pcCha = pc.getCha();
			if (pcCha > 34) {
				pcCha = 34;
			}
			int charisma = pcCha + 6 - petcost;
			int summoncount = charisma / summoncost;
			L1Npc npcTemp = NpcTable.getInstance()
					.getTemplate(summonid);
			for (int i = 0; i < summoncount; i++) {
				L1SummonInstance summon = new L1SummonInstance(
						npcTemp, pc);
				summon.setPetcost(summoncost);
			}
		}
	} else {
		pc.sendPackets(new S_ServerMessage(79)); // Nothing happened.
	}
}