@Override public boolean cast(LivingObject caster, LivingObject victim, String[] arguments) { if (caster instanceof KailiptonPlayer) { Player player = (Player) caster; long currentMana = player.getMana(); long manaSpent = getManaModifier(player); player.setMana(currentMana - manaSpent); Item<?> item = player.getEquipment().getMainHand(); long baseDamage = player.getBaseDamage(); long weaponDamage = 0; double weaponMagicBoost = 1; float criticalMultiplier = 0; Weapon weapon = null; if (item != null && item.is(StaffWeapon.class)) { weapon = (Weapon) item.getType(); criticalMultiplier = weapon.getCritical(); weaponDamage += weapon.getDamage(item); weaponMagicBoost += weapon.getMagicDmg(item); // % of magic dmg boost } long stoneDamage = getDamageModifier(player); float stoneMasteryDamage = 1; // calculate damage of skill StoneMastery for (Skill skill : ((Player) caster).getSkills().keySet()) { if (Modifier.class.isInstance(skill)) { Modifier modifier = (Modifier) skill; if (modifier.getAffectedSkills().contains(this)) { if (modifier.getValueType() == getValueType()) { switch (modifier.getModifierType()) { case MULTIPLICATIVE: // StoneMastery stoneMasteryDamage *= modifier.getModifier(caster); break; case ADDITIVE: stoneDamage += modifier.getModifier(caster); break; } } } } } long magicDamage = (long) ((baseDamage + weaponDamage + stoneDamage) * stoneMasteryDamage * weaponMagicBoost * (criticalMultiplier + 1)); player.setDmgType(criticalMultiplier > 0 ? 1 : 0); synchronized (victim) { victim.getsAttacked(player, magicDamage, true); player.getClient().sendPacket(Type.AV, victim, player.getDmgType()); return true; } } return false; }
public void effect(LivingObject source, LivingObject target, String[] arguments) { source.getInterested().sendPacket(Type.EFFECT, source, target, this, 0, 0, 0); }