Lineage Justice

Spells & Skills

Lookup and validate skills and spells.

JoyofPain
MP: 40 HP: 0 Item: None Amount: N/A Duration: 2 Skill Type: Attack
Delay: 3000 Cast Invis: No Ignores CM: No Element: None Range: 3 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 (_skill.getType() == L1Skill.TYPE_ATTACK
		&& _user.getId() != cha.getId()) {
					
	if (_user instanceof L1PcInstance) {
		((L1PcInstance)_user).setLastAggressiveAct();
	}
						
	if (isUseCounterMagic(cha)) {
		iter.remove();
		if(cha instanceof L1PcInstance && _user instanceof L1PcInstance) {
			L1PcInstance target = (L1PcInstance) cha;
			((L1PcInstance) _user)._pinkName.onAction(target);
		}
		continue;
	}
	dmg = _magic.calcMagicDamage(_skillId);
	_dmg = dmg;
					
	if(_skillId != TRIPLE_ARROW)
		cha.removeSkillEffect(ERASE_MAGIC);
}
L1Magic Calculation:

public int calcMagicDamage(int skillId) {
	int damage = 0;
		
	if (_calcType == PC_PC || _calcType == NPC_PC) {
		damage = calcPcMagicDamage(skillId);
	} else if (_calcType == PC_NPC || _calcType == NPC_NPC) {
		damage = calcNpcMagicDamage(skillId);
	}
		
	damage = calcMrDefense(damage);
		
	damage = calcExceptionMagicDamage(skillId, damage);
		
	if (_calcType == PC_NPC && _pc.getDmgMessages()) {
		_pc.sendPackets(new S_SystemMessage(L1NamedSkill.getName(skillId)
				+ " Dealt:" + String.valueOf(damage)));
	}
	return damage;
}
L1Magic Calculation:

private int calcExceptionMagicDamage(int skillId, int dmg) {

	L1Skill l1skills = SkillTable.getInstance().findBySkillId(skillId);
	if (skillId == MIND_BREAK) {
		
		int sp = getSpellPower();
		dmg = (int) (l1skills.getDamageValue() * sp);
		
		if (_calcType == PC_PC || _calcType == NPC_PC) {
			if (_targetPc.getCurrentMp() >= 5) {
				_targetPc.setCurrentMp(_targetPc.getCurrentMp() - 5);
			} else {
				_targetPc.setCurrentMp(0);
			}
		} else if (_calcType == NPC_NPC || _calcType == PC_NPC) {
			if (_targetNpc.getCurrentMp() >= 5) {
				_targetNpc.setCurrentMp(_targetNpc.getCurrentMp() - 5);
			} else {
				_targetNpc.setCurrentMp(0);
			}
		}
	} else if (skillId == CONFUSION) {
		
		int sp = getSpellPower();
		dmg = (int) (l1skills.getDamageValue() * sp);
	} else if (skillId == COUNTER_DETECTION) {
		if (_calcType == PC_PC) {
			if (_targetPc.getCurrentHp() <= 50) {
				dmg = 0;
			}
		}
	} else if (skillId == JOY_OF_PAIN) {
		
		dmg = ((_pc.getMaxHp() - _pc.getCurrentHp()) / 4);
	}

	return dmg;
}