}
}
for (int index = 0; index < targets.length; index++)
{
L2Character target = (L2Character) targets[index];
if (activeChar instanceof L2PcInstance && target instanceof L2PcInstance
&& target.isAlikeDead() && target.isFakeDeath())
{
target.stopFakeDeath(null);
}
else if (target.isAlikeDead())
{
continue;
}
// if (skill != null)
// if (skill.isOffensive())
// {
// boolean acted;
// if (skill.getSkillType() == L2Skill.SkillType.DOT || skill.getSkillType() == L2Skill.SkillType.MDOT)
// acted = Formulas.getInstance().calcSkillSuccess(
// activeChar, target, skill);
// else
// acted = Formulas.getInstance().calcMagicAffected(
// activeChar, target, skill);
// if (!acted) {
// activeChar.sendPacket(new SystemMessage(SystemMessage.MISSED_TARGET));
// continue;
// }
//
// }
boolean mcrit = Formulas.getInstance().calcMCrit(activeChar.getMCriticalHit(target, skill));
int damage = (int) Formulas.getInstance().calcMagicDam(activeChar, target, skill, ss, bss,
mcrit);
if (damage > 5000 && 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_mdam");
}
// Why are we trying to reduce the current target HP here?
// Why not inside the below "if" condition, after the effects processing as it should be?
// It doesn't seem to make sense for me. I'm moving this line inside the "if" condition, right after the effects processing...
// [changed by nexus - 2006-08-15]
//target.reduceCurrentHp(damage, activeChar);
if (damage > 0)
{
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.getInstance().calcAtkBreak(target, damage))
{
target.breakAttack();
target.breakCast();
}
activeChar.sendDamageMessage(target, damage, mcrit, false, false);
if (skill.hasEffects())
{
if (target.reflectSkill(skill))
{
activeChar.stopSkillEffects(skill.getId());
skill.getEffects(null, activeChar);
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
sm.addSkillName(skill.getId());
activeChar.sendPacket(sm);
}
else
{
// activate attacked effects, if any
target.stopSkillEffects(skill.getId());
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, false, ss, bss))
skill.getEffects(activeChar, target);
else
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getDisplayId());
activeChar.sendPacket(sm);
}
}
}
target.reduceCurrentHp(damage, activeChar);
}
}
// self Effect :]
L2Effect effect = activeChar.getFirstEffect(skill.getId());
if (effect != null && effect.isSelfEffect())