Skip to content
Snippets Groups Projects
Commit 98fb9376 authored by Zoey76's avatar Zoey76
Browse files

BETA: Datapack for [L5149].

parent d9216703
No related branches found
No related tags found
No related merge requests found
......@@ -18,9 +18,9 @@ import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.TimeStamp;
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.TimeStamp;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
......
......@@ -40,7 +40,6 @@ public class StealBuffs implements ISkillHandler
};
/**
*
* @see com.l2jserver.gameserver.handler.ISkillHandler#useSkill(com.l2jserver.gameserver.model.actor.L2Character, com.l2jserver.gameserver.model.skills.L2Skill, com.l2jserver.gameserver.model.L2Object[])
*/
@Override
......@@ -53,9 +52,13 @@ public class StealBuffs implements ISkillHandler
if (skill.isMagic())
{
if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
{
weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
}
else if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT)
{
weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
}
}
}
else if (activeChar instanceof L2Summon)
......@@ -65,29 +68,41 @@ public class StealBuffs implements ISkillHandler
if (skill.isMagic())
{
if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
{
activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
}
else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
{
activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
}
}
}
else if (activeChar instanceof L2Npc)
{
((L2Npc) activeChar)._spiritshotcharged = false;
}
L2Character target;
L2Effect effect;
int count = (int)skill.getPower();
for (L2Object obj: targets)
int count = (int) skill.getPower();
for (L2Object obj : targets)
{
if (!(obj instanceof L2Character))
{
continue;
target = (L2Character)obj;
}
target = (L2Character) obj;
if (target.isDead())
{
continue;
}
if (!(target instanceof L2PcInstance))
{
continue;
}
Env env;
int lastSkillId = 0;
......@@ -98,7 +113,9 @@ public class StealBuffs implements ISkillHandler
{
effect = effects[i];
if (effect == null)
{
continue;
}
if (!effect.canBeStolen()) // remove effect if can't be stolen
{
......@@ -108,7 +125,7 @@ public class StealBuffs implements ISkillHandler
// if eff time is smaller than 5 sec, will not be stolen, just to save CPU,
// avoid synchronization(?) problems and NPEs
if (effect.getAbnormalTime() - effect.getTime() < 5)
if ((effect.getAbnormalTime() - effect.getTime()) < 5)
{
effects[i] = null;
continue;
......@@ -116,7 +133,9 @@ public class StealBuffs implements ISkillHandler
// first pass - only dances/songs
if (!effect.getSkill().isDance())
{
continue;
}
if (effect.getSkill().getId() != lastSkillId)
{
......@@ -126,7 +145,9 @@ public class StealBuffs implements ISkillHandler
toSteal.add(effect);
if (count == 0)
{
break;
}
}
if (count > 0) // second pass
......@@ -136,11 +157,15 @@ public class StealBuffs implements ISkillHandler
{
effect = effects[i];
if (effect == null)
{
continue;
}
// second pass - all except dances/songs
if (effect.getSkill().isDance())
{
continue;
}
if (effect.getSkill().getId() != lastSkillId)
{
......@@ -150,27 +175,31 @@ public class StealBuffs implements ISkillHandler
toSteal.add(effect);
if (count == 0)
{
break;
}
}
}
if (toSteal.size() == 0)
{
continue;
}
// stealing effects
for (L2Effect eff : toSteal)
{
env = new Env();
env.player = target;
env.target = activeChar;
env.skill = eff.getSkill();
env.setCharacter(target);
env.setTarget(activeChar);
env.setSkill(eff.getSkill());
try
{
effect = eff.getEffectTemplate().getStolenEffect(env, eff);
if (effect != null)
{
effect.scheduleEffect();
if (effect.getShowIcon() && activeChar instanceof L2PcInstance)
if (effect.getShowIcon() && (activeChar instanceof L2PcInstance))
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
sm.addSkillName(effect);
......@@ -186,7 +215,7 @@ public class StealBuffs implements ISkillHandler
}
}
//Possibility of a lethal strike
// Possibility of a lethal strike
Formulas.calcLethalHit(activeChar, target, skill);
}
......@@ -194,9 +223,9 @@ public class StealBuffs implements ISkillHandler
{
// Applying self-effects
effect = activeChar.getFirstEffect(skill.getId());
if (effect != null && effect.isSelfEffect())
if ((effect != null) && effect.isSelfEffect())
{
//Replace old effect with new one.
// Replace old effect with new one.
effect.exit();
}
skill.getEffectsSelf(activeChar);
......@@ -204,7 +233,6 @@ public class StealBuffs implements ISkillHandler
}
/**
*
* @see com.l2jserver.gameserver.handler.ISkillHandler#getSkillIds()
*/
@Override
......@@ -213,4 +241,4 @@ public class StealBuffs implements ISkillHandler
return SKILL_IDS;
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment