Lineage Justice

Spells & Skills

Lookup and validate skills and spells.

PurifyStone
MP: 5 HP: 0 Item: None Amount: N/A Duration: 0 Skill Type: Change
Delay: 0 Cast Invis: Yes Ignores CM: Yes 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:

public static void turnStone(final L1PcInstance player,
		final L1ItemInstance item, double penalty, int count, boolean report) {
	if (item == null)
		return;

	int dark = (int) (penalty * (10 + (player.getLevel() * 0.8) + (player
			.getWis() - 6) * 1.2));
	int brave = (int) (dark / 2.1);
	int wise = (int) (brave / 2.0);
	int kaiser = (int) (wise / 1.9);

	switch (item.getItem().getItemId()) {
	case BRING_STONE:
		turnStone(player, item, dark, DARK_STONE, "$2475", count, report);
		break;
	case DARK_STONE:
		turnStone(player, item, brave, BRAVE_STONE, "$2476", count, report);
		break;
	case BRAVE_STONE:
		turnStone(player, item, wise, WISE_STONE, "$2477", count, report);
		break;
	case WISE_STONE:
		turnStone(player, item, kaiser, KAISER_STONE, "$2478", count, report);
		break;
	}
}

private static void turnStone(final L1PcInstance player,
		final L1ItemInstance item, int chance, int nextStone, String name,
		int count, boolean report) {
	// This should never actually happen...
	if (count > item.getCount()) {
		_log.log(Level.WARNING, "turnStone count did not match.");
		return;
	}

	RandomGenerator random = RandomGeneratorFactory.getSharedRandom();
	L1PcInventory inventory = player.getInventory();

	for (int i = 0; i < count; i++) {
		inventory.removeItem(item, 1);
		if (chance > random.nextInt(100) + 1) {
			inventory.storeItem(nextStone, 1);
			if (report)
				player.sendPackets(new S_ServerMessage(403, name)); // obtained 'item'.
		} else if (report)
			player.sendPackets(SkillFailed);
	}
}