Lineage Justice

Spells & Skills

Lookup and validate skills and spells.

WeaponBreak
MP: 32 HP: 0 Item: 40318 Amount: 1 Duration: 0 Skill Type: Curse
Delay: 3000 Cast Invis: No Ignores CM: No Element: Fire Range: 4 Area: N/A
Dmg Value: 0.0 Dmg Dice: 0 Dice Count: 0 Prob Value: 0 Prob Dice: 10 Prob Max: 90
L1SkillUse Execution:

if (_skillId == WEAPON_BREAK) {
	if (_calcType == PC_PC || _calcType == NPC_PC) {
		if (cha instanceof L1PcInstance) {
			L1PcInstance pc = (L1PcInstance) cha;
			L1ItemInstance weapon = pc.getWeapon();
			if (weapon != null) {
				RandomGenerator random = RandomGeneratorFactory
						.getSharedRandom();
				int weaponDamage = random.nextInt(_user
						.getInt() / 3) + 1;
				pc.sendPackets(new S_ServerMessage(268, weapon
						.getLogName())); // Your 'weapon' was damaged.
				pc.getInventory().receiveDamage(weapon,
						weaponDamage);
			}
		}
	} else {
		((L1NpcInstance) cha).setWeaponBreaked(true);
	}
}
L1Magic Probability:

private int calcProbability(int skillId) {
	L1Skill skill = SkillTable.getInstance().findBySkillId(skillId);
	int attackLevel = 0;
	int defenseLevel = 0;
	int probability = 0;

	if (_calcType == PC_PC || _calcType == PC_NPC) {
		attackLevel = _pc.getLevel();
	} else {
		attackLevel = _npc.getLevel();
	}
		
	if (_calcType == PC_PC || _calcType == NPC_PC) {
		defenseLevel = _targetPc.getLevel();
	} else {
		defenseLevel = _targetNpc.getLevel();
		if (skillId == RETURN_TO_NATURE) {
			if (_targetNpc instanceof L1SummonInstance) {
				L1SummonInstance summon = (L1SummonInstance) _targetNpc;
				defenseLevel = summon.getMaster().getLevel();
			}
		}
	}

	int levelDifference = attackLevel - defenseLevel;

	if (skillId == SHOCK_STUN || skillId == MASS_SHOCK_STUN ||
			skillId == COUNTER_BARRIER ||
			skillId == ELEMENTAL_FALL_DOWN || skillId == RETURN_TO_NATURE ||
			skillId == ENTANGLE || skillId == ERASE_MAGIC || skillId == EARTH_BIND ||
			skillId == AREA_OF_SILENCE || skillId == WIND_SHACKLE || skillId == AREA_WIND_SHACKLE ||
			skillId == STRIKER_GALE || skillId == POLLUTE_WATER ||
			skillId == ARMOR_BREAK ||
			skillId == ELZABE_AREA_SILENCE) {
			
		probability = (int) (((skill.getProbabilityDice()) / 10D) * levelDifference) + skill.getProbabilityValue();
			
		if (_calcType == PC_PC || _calcType == PC_NPC) {
			probability += 2 * _pc.getOriginalMagicHit();
		}
			
	} else if (skillId == GUARD_BRAKE || skillId == RESIST_FEAR
			|| skillId == HORROR_OF_DEATH) {
		probability = 100;
			
	} else if (skillId == THUNDER_GRAB) {
			
		probability = skill.getProbabilityValue()
				* (attackLevel / Math.max(1, defenseLevel))
				- _random.nextInt(21);

		if (_calcType == PC_PC || _calcType == PC_NPC) {
			probability += 2 * _pc.getOriginalMagicHit();
		}
			
	} else if (skillId == PHANTASM) {
			
		if (_calcType == PC_NPC) {
			probability = skill.getProbabilityValue();
		} else {
			probability = skill.getProbabilityValue() + 20;
		}
			
	} else {
		int dice = skill.getProbabilityDice();
		int diceCount = getMagicBonus() + getMagicLevel();
			
		if (_calcType == PC_PC || _calcType == PC_NPC) {
			diceCount += _pc.isWizard() ? 1 : -1;
		}
			
		diceCount = diceCount < 1 ? 1 : diceCount;
		for (int i = 0; i < diceCount; i++) {
			probability += (_random.nextInt(dice) + 1);
		}
		probability = probability * getLeverage() / 10;

		if (_calcType == PC_PC || _calcType == PC_NPC) {
			probability += 2 * _pc.getOriginalMagicHit();
		}

		probability -= getTargetMr();

		if (skillId == TAMING_MONSTER) {
			double probabilityRevision = 1;
			if ((_targetNpc.getMaxHp() * 1 / 4) > _targetNpc.getCurrentHp()) {
				probabilityRevision = 1.3;
			} else if ((_targetNpc.getMaxHp() * 2 / 4) > _targetNpc
					.getCurrentHp()) {
				probabilityRevision = 1.2;
			} else if ((_targetNpc.getMaxHp() * 3 / 4) > _targetNpc
					.getCurrentHp()) {
				probabilityRevision = 1.1;
			}
			probability *= probabilityRevision;
		}
	}

	if (_calcType == PC_PC || _calcType == NPC_PC) {
		switch (skillId) {
		case EARTH_BIND:
			probability -= _target.getResistHold();
			break;
		case MASS_SHOCK_STUN:
		case SHOCK_STUN:
			probability -= 2 * _target.getResistStun();
			break;
		case CURSE_PARALYZE:
			probability -= _target.getResistStone();
			break;
		case FOG_OF_SLEEPING:
			probability -= _target.getResistSleep();
			break;
		case ICE_LANCE:
		case FREEZING_BLIZZARD:
			probability -= _target.getResistFreeze();
			break;
		case CURSE_BLIND:
		case DARKNESS:
		case SHADOW_SLEEP:
			probability -= _target.getResistBlind();
			break;
		}
	}
	return probability;
}