}
}
// If there is no weapon equipped, check for an active summon.
else if (activeChar instanceof L2Summon)
{
L2Summon activeSummon = (L2Summon) activeChar;
if (skill.isMagic())
{
if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
{
bss = true;
activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
}
else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
{
sps = true;
activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
}
}
else
if (activeSummon.getChargedSoulShot() == L2ItemInstance.CHARGED_SOULSHOT)
{
ss = true;
activeSummon.setChargedSoulShot(L2ItemInstance.CHARGED_NONE);
}
}
for (int index = 0; index < targets.length; index++)
{
// Get a target
if (!(targets[index] instanceof L2Character)) continue;
L2Character target = (L2Character) targets[index];
if (target == null || target.isDead()) //bypass if target is null or dead
continue;
switch (type)
{
case BETRAY:
{
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
skill.getEffects(activeChar, target);
else
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getId());
activeChar.sendPacket(sm);
}
break;
}
case FAKE_DEATH:
{
// stun/fakedeath is not mdef dependant, it depends on lvl difference, target CON and power of stun
skill.getEffects(activeChar, target);
break;
}
case ROOT:
case STUN:
{
if(target.reflectSkill(skill))
target = activeChar;
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
skill.getEffects(activeChar, target);
else
{
if (activeChar instanceof L2PcInstance)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getDisplayId());
activeChar.sendPacket(sm);
}
}
break;
}
case SLEEP:
case PARALYZE: //use same as root for now
{
if(target.reflectSkill(skill))
target = activeChar;
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
skill.getEffects(activeChar, target);
else
{
if (activeChar instanceof L2PcInstance)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getDisplayId());
activeChar.sendPacket(sm);
}
}
break;
}
case CONFUSION:
case MUTE:
{
if(target.reflectSkill(skill))
target = activeChar;
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
{
// stop same type effect if avaiable
L2Effect[] effects = target.getAllEffects();
for (L2Effect e : effects)
if (e.getSkill().getSkillType() == type)
e.exit();
// then restart
// Make above skills mdef dependant
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
//if(Formulas.getInstance().calcMagicAffected(activeChar, target, skill))
skill.getEffects(activeChar, target);
else
{
if (activeChar instanceof L2PcInstance)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getDisplayId());
activeChar.sendPacket(sm);
}
}
}
else
{
if (activeChar instanceof L2PcInstance)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getDisplayId());
activeChar.sendPacket(sm);
}
}
break;
}
case CONFUSE_MOB_ONLY:
{
// do nothing if not on mob
if (target instanceof L2Attackable)
skill.getEffects(activeChar, target);
else
activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
break;
}
case AGGDAMAGE:
{
if (target instanceof L2Attackable)
target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, (int) ((150*skill.getPower())/(target.getLevel()+7)));
//TODO [Nemesiss] should this have 100% chance?
skill.getEffects(activeChar, target);
break;
}
case AGGREDUCE:
{
// these skills needs to be rechecked
if (target instanceof L2Attackable)
{
skill.getEffects(activeChar, target);
double aggdiff = ((L2Attackable)target).getHating(activeChar)
- target.calcStat(Stats.AGGRESSION, ((L2Attackable)target).getHating(activeChar), target, skill);
if (skill.getPower() > 0)
((L2Attackable)target).reduceHate(null, (int) skill.getPower());
else if (aggdiff > 0)
((L2Attackable)target).reduceHate(null, (int) aggdiff);
}
break;
}
case AGGREDUCE_CHAR:
{
// these skills needs to be rechecked
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
{
if (target instanceof L2Attackable)
{
L2Attackable targ = (L2Attackable)target;
targ.stopHating(activeChar);
if (targ.getMostHated() == null)
{
((L2AttackableAI)targ.getAI()).setGlobalAggro(-25);
targ.clearAggroList();
targ.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
targ.setWalking();
}
}
skill.getEffects(activeChar, target);
}
else
{
if (activeChar instanceof L2PcInstance)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getId());
activeChar.sendPacket(sm);
}
}
break;
}
case AGGREMOVE:
{
// these skills needs to be rechecked
if (target instanceof L2Attackable && !target.isRaid())
{
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
{
if (skill.getTargetType() == L2Skill.SkillTargetType.TARGET_UNDEAD)
{
if(target.isUndead())
((L2Attackable)target).reduceHate(null, ((L2Attackable)target).getHating(((L2Attackable)target).getMostHated()));
}
else
((L2Attackable)target).reduceHate(null, ((L2Attackable)target).getHating(((L2Attackable)target).getMostHated()));
}
else
{
if (activeChar instanceof L2PcInstance)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
sm.addString(target.getName());
sm.addSkillName(skill.getId());
activeChar.sendPacket(sm);
}
}
}
break;
}
case UNBLEED:
{
negateEffect(target,SkillType.BLEED,skill.getPower());
break;
}
case UNPOISON:
{
negateEffect(target,SkillType.POISON,skill.getPower());
break;
}
case ERASE:
{
if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss)
// doesn't affect siege golem or wild hog cannon
&& !(target instanceof L2SiegeSummonInstance)
)
{
L2PcInstance summonOwner = null;
L2Summon summonPet = null;
summonOwner = ((L2Summon)target).getOwner();
summonPet = summonOwner.getPet();
summonPet.unSummon(summonOwner);
SystemMessage sm = new SystemMessage(SystemMessageId.LETHAL_STRIKE);
summonOwner.sendPacket(sm);
}
else
{