Addition of ReuseSkillByDamageId effect.
Contributed by nasseka.
This commit is contained in:
@@ -314,6 +314,7 @@ public class EffectMasterHandler
|
|||||||
EffectHandler.getInstance().registerHandler("Resurrection", Resurrection::new);
|
EffectHandler.getInstance().registerHandler("Resurrection", Resurrection::new);
|
||||||
EffectHandler.getInstance().registerHandler("ResurrectionSpecial", ResurrectionSpecial::new);
|
EffectHandler.getInstance().registerHandler("ResurrectionSpecial", ResurrectionSpecial::new);
|
||||||
EffectHandler.getInstance().registerHandler("Reuse", Reuse::new);
|
EffectHandler.getInstance().registerHandler("Reuse", Reuse::new);
|
||||||
|
EffectHandler.getInstance().registerHandler("ReuseSkillByDamageId", ReuseSkillByDamageId::new);
|
||||||
EffectHandler.getInstance().registerHandler("ReuseSkillById", ReuseSkillById::new);
|
EffectHandler.getInstance().registerHandler("ReuseSkillById", ReuseSkillById::new);
|
||||||
EffectHandler.getInstance().registerHandler("Root", Root::new);
|
EffectHandler.getInstance().registerHandler("Root", Root::new);
|
||||||
EffectHandler.getInstance().registerHandler("SacrificeSummon", SacrificeSummon::new);
|
EffectHandler.getInstance().registerHandler("SacrificeSummon", SacrificeSummon::new);
|
||||||
|
129
L2J_Mobius_10.0_MasterClass/dist/game/data/scripts/handlers/effecthandlers/ReuseSkillByDamageId.java
vendored
Normal file
129
L2J_Mobius_10.0_MasterClass/dist/game/data/scripts/handlers/effecthandlers/ReuseSkillByDamageId.java
vendored
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDamageReceived;
|
||||||
|
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||||
|
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author NasSeKa
|
||||||
|
*/
|
||||||
|
public class ReuseSkillByDamageId extends AbstractEffect
|
||||||
|
{
|
||||||
|
private final int _minAttackerLevel;
|
||||||
|
private final int _maxAttackerLevel;
|
||||||
|
private final int _minDamage;
|
||||||
|
private final int _chance;
|
||||||
|
private final int _hpPercent;
|
||||||
|
private final int _skillId;
|
||||||
|
private final int _amount;
|
||||||
|
private final InstanceType _attackerType;
|
||||||
|
|
||||||
|
public ReuseSkillByDamageId(StatSet params)
|
||||||
|
{
|
||||||
|
_minAttackerLevel = params.getInt("minAttackerLevel", 1);
|
||||||
|
_maxAttackerLevel = params.getInt("maxAttackerLevel", Integer.MAX_VALUE);
|
||||||
|
_minDamage = params.getInt("minDamage", 1);
|
||||||
|
_chance = params.getInt("chance", 100);
|
||||||
|
_hpPercent = params.getInt("hpPercent", 100);
|
||||||
|
_skillId = params.getInt("skillId", 0);
|
||||||
|
_amount = params.getInt("amount", 0);
|
||||||
|
_attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.Creature);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onDamageReceivedEvent(OnCreatureDamageReceived event)
|
||||||
|
{
|
||||||
|
if (event.isDamageOverTime() || (_chance == 0))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAttacker() == event.getTarget())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((event.getAttacker().getLevel() < _minAttackerLevel) || (event.getAttacker().getLevel() > _maxAttackerLevel))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getDamage() < _minDamage)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((_chance < 100) && (Rnd.get(100) > _chance))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((_hpPercent < 100) && (event.getAttacker().getCurrentHpPercent() > _hpPercent))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!event.getAttacker().getInstanceType().isType(_attackerType))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Player player = (Player) event.getTarget();
|
||||||
|
final Skill s = player.getKnownSkill(_skillId);
|
||||||
|
if (s != null)
|
||||||
|
{
|
||||||
|
if (_amount > 0)
|
||||||
|
{
|
||||||
|
final long reuse = player.getSkillRemainingReuseTime(s.getReuseHashCode());
|
||||||
|
if (reuse > 0)
|
||||||
|
{
|
||||||
|
player.removeTimeStamp(s);
|
||||||
|
player.addTimeStamp(s, Math.max(0, reuse - _amount));
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.removeTimeStamp(s);
|
||||||
|
player.enableSkill(s);
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||||
|
{
|
||||||
|
effected.removeListenerIf(EventType.ON_CREATURE_DAMAGE_RECEIVED, listener -> listener.getOwner() == this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||||
|
{
|
||||||
|
effected.addListener(new ConsumerEventListener(effected, EventType.ON_CREATURE_DAMAGE_RECEIVED, (OnCreatureDamageReceived event) -> onDamageReceivedEvent(event), this));
|
||||||
|
}
|
||||||
|
}
|
@@ -1040,6 +1040,18 @@
|
|||||||
<effect name="GetDamageLimit">
|
<effect name="GetDamageLimit">
|
||||||
<amount>500</amount>
|
<amount>500</amount>
|
||||||
</effect>
|
</effect>
|
||||||
|
<effect name="ReuseSkillByDamageId">
|
||||||
|
<skillId>30963</skillId>
|
||||||
|
<chance>70</chance>
|
||||||
|
</effect>
|
||||||
|
<effect name="ReuseSkillByDamageId">
|
||||||
|
<skillId>30964</skillId>
|
||||||
|
<chance>70</chance>
|
||||||
|
</effect>
|
||||||
|
<effect name="ReuseSkillByDamageId">
|
||||||
|
<skillId>30965</skillId>
|
||||||
|
<chance>70</chance>
|
||||||
|
</effect>
|
||||||
</effects>
|
</effects>
|
||||||
</skill>
|
</skill>
|
||||||
<skill id="30957" toLevel="9" name="Hell Slash">
|
<skill id="30957" toLevel="9" name="Hell Slash">
|
||||||
@@ -2616,25 +2628,25 @@
|
|||||||
<operateType>A1</operateType>
|
<operateType>A1</operateType>
|
||||||
</skill>
|
</skill>
|
||||||
<skill id="30989" toLevel="1" name="Mocking Barrier">
|
<skill id="30989" toLevel="1" name="Mocking Barrier">
|
||||||
<icon>icon.skill0000</icon>
|
<icon>icon.skill0000</icon>
|
||||||
<operateType>A2</operateType>
|
<operateType>A2</operateType>
|
||||||
<basicProperty>NONE</basicProperty>
|
<basicProperty>NONE</basicProperty>
|
||||||
<magicCriticalRate>5</magicCriticalRate>
|
<magicCriticalRate>5</magicCriticalRate>
|
||||||
<abnormalLevel>1</abnormalLevel>
|
<abnormalLevel>1</abnormalLevel>
|
||||||
<abnormalTime>5</abnormalTime>
|
<abnormalTime>5</abnormalTime>
|
||||||
<targetType>SELF</targetType>
|
<targetType>SELF</targetType>
|
||||||
<affectScope>SINGLE</affectScope>
|
<affectScope>SINGLE</affectScope>
|
||||||
<effects>
|
<effects>
|
||||||
<effect name="PhysicalDefence">
|
<effect name="PhysicalDefence">
|
||||||
<amount>100</amount>
|
<amount>20</amount>
|
||||||
<mode>PER</mode>
|
<mode>PER</mode>
|
||||||
</effect>
|
</effect>
|
||||||
<effect name="MagicalDefence">
|
<effect name="MagicalDefence">
|
||||||
<amount>100</amount>
|
<amount>20</amount>
|
||||||
<mode>PER</mode>
|
<mode>PER</mode>
|
||||||
</effect>
|
</effect>
|
||||||
</effects>
|
</effects>
|
||||||
</skill>
|
</skill>
|
||||||
<skill id="30990" toLevel="2" name="Test - Acquired XP/ SP_Level Difference_Sum">
|
<skill id="30990" toLevel="2" name="Test - Acquired XP/ SP_Level Difference_Sum">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
||||||
<icon>icon.skill0000</icon>
|
<icon>icon.skill0000</icon>
|
||||||
|
@@ -281,6 +281,7 @@ RestorationRandom: Creates items randomly from a specified list. Its multiplied
|
|||||||
Resurrection: Resurrects target Player or Summon.
|
Resurrection: Resurrects target Player or Summon.
|
||||||
ResurrectionSpecial: Resurrects target Player or Summon only in specified instance IDs.
|
ResurrectionSpecial: Resurrects target Player or Summon only in specified instance IDs.
|
||||||
Reuse: Decreases skill reuse time based on its magic type.
|
Reuse: Decreases skill reuse time based on its magic type.
|
||||||
|
ReuseSkillByDamageId: Resets reuse time for the skill with the specific damage id. (l2jmobius)
|
||||||
ReuseSkillById: Resets reuse time for the skill with the specific id. (l2jmobius)
|
ReuseSkillById: Resets reuse time for the skill with the specific id. (l2jmobius)
|
||||||
Root: Stops movement.
|
Root: Stops movement.
|
||||||
SacrificeSummon: Sacrifices the players summon. (l2jmobius)
|
SacrificeSummon: Sacrifices the players summon. (l2jmobius)
|
||||||
|
@@ -311,6 +311,7 @@ public class EffectMasterHandler
|
|||||||
EffectHandler.getInstance().registerHandler("Resurrection", Resurrection::new);
|
EffectHandler.getInstance().registerHandler("Resurrection", Resurrection::new);
|
||||||
EffectHandler.getInstance().registerHandler("ResurrectionSpecial", ResurrectionSpecial::new);
|
EffectHandler.getInstance().registerHandler("ResurrectionSpecial", ResurrectionSpecial::new);
|
||||||
EffectHandler.getInstance().registerHandler("Reuse", Reuse::new);
|
EffectHandler.getInstance().registerHandler("Reuse", Reuse::new);
|
||||||
|
EffectHandler.getInstance().registerHandler("ReuseSkillByDamageId", ReuseSkillByDamageId::new);
|
||||||
EffectHandler.getInstance().registerHandler("ReuseSkillById", ReuseSkillById::new);
|
EffectHandler.getInstance().registerHandler("ReuseSkillById", ReuseSkillById::new);
|
||||||
EffectHandler.getInstance().registerHandler("Root", Root::new);
|
EffectHandler.getInstance().registerHandler("Root", Root::new);
|
||||||
EffectHandler.getInstance().registerHandler("SacrificeSummon", SacrificeSummon::new);
|
EffectHandler.getInstance().registerHandler("SacrificeSummon", SacrificeSummon::new);
|
||||||
|
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDamageReceived;
|
||||||
|
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||||
|
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author NasSeKa
|
||||||
|
*/
|
||||||
|
public class ReuseSkillByDamageId extends AbstractEffect
|
||||||
|
{
|
||||||
|
private final int _minAttackerLevel;
|
||||||
|
private final int _maxAttackerLevel;
|
||||||
|
private final int _minDamage;
|
||||||
|
private final int _chance;
|
||||||
|
private final int _hpPercent;
|
||||||
|
private final int _skillId;
|
||||||
|
private final int _amount;
|
||||||
|
private final InstanceType _attackerType;
|
||||||
|
|
||||||
|
public ReuseSkillByDamageId(StatSet params)
|
||||||
|
{
|
||||||
|
_minAttackerLevel = params.getInt("minAttackerLevel", 1);
|
||||||
|
_maxAttackerLevel = params.getInt("maxAttackerLevel", Integer.MAX_VALUE);
|
||||||
|
_minDamage = params.getInt("minDamage", 1);
|
||||||
|
_chance = params.getInt("chance", 100);
|
||||||
|
_hpPercent = params.getInt("hpPercent", 100);
|
||||||
|
_skillId = params.getInt("skillId", 0);
|
||||||
|
_amount = params.getInt("amount", 0);
|
||||||
|
_attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.Creature);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onDamageReceivedEvent(OnCreatureDamageReceived event)
|
||||||
|
{
|
||||||
|
if (event.isDamageOverTime() || (_chance == 0))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAttacker() == event.getTarget())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((event.getAttacker().getLevel() < _minAttackerLevel) || (event.getAttacker().getLevel() > _maxAttackerLevel))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getDamage() < _minDamage)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((_chance < 100) && (Rnd.get(100) > _chance))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((_hpPercent < 100) && (event.getAttacker().getCurrentHpPercent() > _hpPercent))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!event.getAttacker().getInstanceType().isType(_attackerType))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Player player = (Player) event.getTarget();
|
||||||
|
final Skill s = player.getKnownSkill(_skillId);
|
||||||
|
if (s != null)
|
||||||
|
{
|
||||||
|
if (_amount > 0)
|
||||||
|
{
|
||||||
|
final long reuse = player.getSkillRemainingReuseTime(s.getReuseHashCode());
|
||||||
|
if (reuse > 0)
|
||||||
|
{
|
||||||
|
player.removeTimeStamp(s);
|
||||||
|
player.addTimeStamp(s, Math.max(0, reuse - _amount));
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.removeTimeStamp(s);
|
||||||
|
player.enableSkill(s);
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||||
|
{
|
||||||
|
effected.removeListenerIf(EventType.ON_CREATURE_DAMAGE_RECEIVED, listener -> listener.getOwner() == this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||||
|
{
|
||||||
|
effected.addListener(new ConsumerEventListener(effected, EventType.ON_CREATURE_DAMAGE_RECEIVED, (OnCreatureDamageReceived event) -> onDamageReceivedEvent(event), this));
|
||||||
|
}
|
||||||
|
}
|
@@ -279,6 +279,7 @@ RestorationRandom: Creates items randomly from a specified list. Its multiplied
|
|||||||
Resurrection: Resurrects target Player or Summon.
|
Resurrection: Resurrects target Player or Summon.
|
||||||
ResurrectionSpecial: Resurrects target Player or Summon only in specified instance IDs.
|
ResurrectionSpecial: Resurrects target Player or Summon only in specified instance IDs.
|
||||||
Reuse: Decreases skill reuse time based on its magic type.
|
Reuse: Decreases skill reuse time based on its magic type.
|
||||||
|
ReuseSkillByDamageId: Resets reuse time for the skill with the specific damage id. (l2jmobius)
|
||||||
ReuseSkillById: Resets reuse time for the skill with the specific id. (l2jmobius)
|
ReuseSkillById: Resets reuse time for the skill with the specific id. (l2jmobius)
|
||||||
Root: Stops movement.
|
Root: Stops movement.
|
||||||
SacrificeSummon: Sacrifices the players summon. (l2jmobius)
|
SacrificeSummon: Sacrifices the players summon. (l2jmobius)
|
||||||
|
Reference in New Issue
Block a user