Index: C:/Users/Perry/workspace/l2jc4/java/net/sf/l2j/gameserver/model/L2Attackable.java =================================================================== --- C:/Users/Perry/workspace/l2jc4/java/net/sf/l2j/gameserver/model/L2Attackable.java (revision 2154) +++ C:/Users/Perry/workspace/l2jc4/java/net/sf/l2j/gameserver/model/L2Attackable.java (working copy) @@ -37,6 +37,7 @@ import net.sf.l2j.gameserver.ai.L2AttackableAI; import net.sf.l2j.gameserver.ai.L2CharacterAI; import net.sf.l2j.gameserver.lib.Rnd; +import net.sf.l2j.gameserver.model.L2Skill.SkillTargetType; import net.sf.l2j.gameserver.model.L2Skill.SkillType; import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance; import net.sf.l2j.gameserver.model.actor.instance.L2FolkInstance; @@ -647,45 +648,45 @@ if (actor.isCastingNow()) { L2Skill skill = actor.getAttackingCharSkill(); - int power; - int chance = 70; - int aggro = getHating(getMostHated()); - double damage = Formulas.getInstance().calcPhysDam(this, target, null, false, false, false, false); - if (skill != null && (skill.getSkillType() == SkillType.HEAL - || skill.getSkillType() == SkillType.HEAL_PERCENT - || skill.getSkillType() == SkillType.MANAHEAL)) + if (skill == null) continue; + + // Do analyse self skills + if (skill.getTargetType() == SkillTargetType.TARGET_SELF) continue; + + // Check the skill type + SkillType skTp = skill.getSkillType(); + if (skTp == SkillType.HEAL + || skTp == SkillType.HEAL_PERCENT + || skTp == SkillType.MANAHEAL + || skTp == SkillType.BUFF + || skTp == SkillType.HOT) { - L2Object[] targetList = skill.getTargetList(actor,true); - if(targetList != null && targetList.length != 0 - && (targetList[0] instanceof L2PcInstance - || targetList[0] instanceof L2SummonInstance - || targetList[0] instanceof L2PetInstance)) - { - power = Math.round((float)skill.getPower() * targetList.length); + L2Object[] targetList = skill.getTargetList(actor); + if (targetList == null || targetList.length == 0) continue; + + // check the main target of the healer + if (targetList[0] instanceof L2PcInstance + || targetList[0] instanceof L2SummonInstance + || targetList[0] instanceof L2PetInstance) + { + if (skill.getTargetType() == SkillTargetType.TARGET_ONE + && (L2Character)targetList[0] == actor) + continue; + + int multip = getHating((L2Character)targetList[0]) > 0 ? 1 : 2; + + int power = Math.round((float)skill.getPower() * targetList.length); + if (power <= 0) + power = skill.getMpConsume() * targetList.length; + power /= multip; + + double damage = Formulas.getInstance().calcPhysDam(this, target, null, false, false, false, false); + + int chance = 70; // ie 70% of chance that the healer is added to the aggrolist if (damage <= power && chance > Rnd.get(100)) - aggro += power; - else - aggro = power; - addDamageHate(actor, 0, aggro); - } + addDamageHate(actor, 0, power); + } } - else if (skill != null && (skill.getSkillType() == SkillType.BUFF - || skill.getSkillType() == SkillType.HOT)) - { - L2Object[] targetList = skill.getTargetList(actor,true); - if(targetList != null && targetList.length != 0 - && (targetList[0] instanceof L2PcInstance - || targetList[0] instanceof L2SummonInstance - || targetList[0] instanceof L2PetInstance)) - { - power = skill.getMpConsume() * targetList.length; - if (damage <= power && chance > Rnd.get(100)) - aggro += power; - else - aggro = power; - addDamageHate(actor, 0, aggro); - } - } } } }