Lineage Justice

Spells & Skills

Lookup and validate skills and spells.

SummonLesserElement
MP: 20 HP: 0 Item: 40319 Amount: 2 Duration: 0 Skill Type: Other
Delay: 0 Cast Invis: No Ignores CM: No Element: None 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 == LESSER_ELEMENTAL
		|| _skillId == GREATER_ELEMENTAL) {
	L1PcInstance pc = (L1PcInstance) cha;
	int attr = pc.getElfAttr();
	if (attr != 0) {
		if (pc.getMap().isRecallPets() || pc.isGm()) {
			int petcost = 0;
			Object[] petlist = pc.getPetList().values()
					.toArray();
			for (Object pet : petlist) {
				petcost += ((L1NpcInstance) pet)
						.getPetcost();
			}

			if (petcost == 0) {
				int summonid = 0;
				int summons[];
				if (_skillId == LESSER_ELEMENTAL) {
					summons = new int[] { 45306, 45303,
							45304, 45305 };
				} else {
					summons = new int[] { 81053, 81050,
							81051, 81052 };
				}
				int npcattr = 1;
				for (int i = 0; i < summons.length; i++) {
					if (npcattr == attr) {
						summonid = summons[i];
						i = summons.length;
					}
					npcattr *= 2;
				}
				if (summonid == 0) {
					RandomGenerator random = RandomGeneratorFactory
							.getSharedRandom();
					int k3 = random.nextInt(4);
					summonid = summons[k3];
				}

				L1Npc npcTemp = NpcTable.getInstance()
						.getTemplate(summonid);
				L1SummonInstance summon = new L1SummonInstance(
						npcTemp, pc);
				summon.setPetcost(pc.getCha() + 7);
			}
		} else {
			pc.sendPackets(new S_ServerMessage(79)); // Nothing happened.
		}
	}
}