boolean ss = activeChar.checkSs();
for (L2Object target2 : target_s)
{
L2Character target = (L2Character) target2;
Formulas f = Formulas.getInstance();
L2ItemInstance weapon = activeChar.getActiveWeaponInstance();
if (activeChar instanceof L2PcInstance && target instanceof L2PcInstance && target.isAlikeDead() && target.isFakeDeath())
{
target.stopFakeDeath(null);
}
else if (target.isAlikeDead())
continue;
/*
* if(target.isInvul()){ continue; }
*/
// Calculate skill evasion
// Formulas.getInstance();
if (Formulas.calcPhysicalSkillEvasion(target, skill))
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.ATTACK_FAILED));
continue;
}
boolean dual = activeChar.isUsingDualWeapon();
boolean shld = Formulas.calcShldUse(activeChar, target);
// PDAM critical chance not affected by buffs, only by STR. Only some skills are meant to crit.
boolean crit = false;
if (skill.getBaseCritRate() > 0)
crit = Formulas.calcCrit(skill.getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar));
boolean soul = false;
if (weapon != null)
soul = (ss && weapon.getItemType() != L2WeaponType.DAGGER);
if (!crit && (skill.getCondition() & L2Skill.COND_CRIT) != 0)
damage = 0;
else
damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, false, dual, soul);
if (crit)
damage *= 2; // PDAM Critical damage always 2x and not affected by buffs
if (damage > 5000 && Config.LOG_HIGH_DAMAGES && activeChar instanceof L2PcInstance)
{
String name = "";
if (target instanceof L2RaidBossInstance)
name = "RaidBoss ";
if (target instanceof L2NpcInstance)
name += target.getName() + "(" + ((L2NpcInstance) target).getTemplate().npcId + ")";
if (target instanceof L2PcInstance)
name = target.getName() + "(" + target.getObjectId() + ") ";
name += target.getLevel() + " lvl";
Log.add(activeChar.getName() + "(" + activeChar.getObjectId() + ") " + activeChar.getLevel() + " lvl did damage " + damage + " with skill " + skill.getName() + "(" + skill.getId() + ") to " + name, "damage_pdam");
}
if (damage > 0)
{
if (target != activeChar)
activeChar.sendDamageMessage(target, damage, false, crit, false);
else
{
SystemMessage smsg = new SystemMessage(SystemMessageId.S1_GAVE_YOU_S2_DMG);
smsg.addString(target.getName());
smsg.addNumber(damage);
activeChar.sendPacket(smsg);
}
if (target instanceof L2RaidBossInstance || target instanceof L2GrandBossInstance)
{
continue;
}
if (!target.isInvul())
{
if (skill.hasEffects())
{
if (target.reflectSkill(skill))
{
activeChar.stopSkillEffects(skill.getId());
skill.getEffects(null, activeChar, ss, sps, bss);
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
sm.addSkillName(skill.getId());
activeChar.sendPacket(sm);
sm = null;
}
else
{
// activate attacked effects, if any
if (f.calcSkillSuccess(activeChar, target, skill, soul, false, false))
{
// Like L2OFF must remove the first effect if the second effect lands
// target.stopSkillEffects(skill.getId());
skill.getEffects(activeChar, target, ss, sps, bss);
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);