Retail Servitor Share implementation.
Contributed by Sahar.
This commit is contained in:
parent
c8507e2052
commit
9d1ea96db9
@ -16,14 +16,16 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.conditions.Condition;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import org.l2jmobius.gameserver.model.effects.EffectType;
|
||||
import org.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
|
||||
/**
|
||||
* Servitor Share effect implementation.<br>
|
||||
@ -33,27 +35,16 @@ import org.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
*/
|
||||
public class ServitorShare extends AbstractEffect
|
||||
{
|
||||
private static final class ScheduledEffectExitTask implements Runnable
|
||||
{
|
||||
private final Creature _effected;
|
||||
private final int _skillId;
|
||||
|
||||
public ScheduledEffectExitTask(Creature effected, int skillId)
|
||||
{
|
||||
_effected = effected;
|
||||
_skillId = skillId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_effected.stopSkillEffects(false, _skillId);
|
||||
}
|
||||
}
|
||||
private final Map<Stat, Double> _stats = new HashMap<>(9);
|
||||
|
||||
public ServitorShare(Condition attachCond, Condition applyCond, StatSet set, StatSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
for (String key : params.getSet().keySet())
|
||||
{
|
||||
_stats.put(Stat.valueOfXml(key), params.getDouble(key, 1.));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,13 +59,34 @@ public class ServitorShare extends AbstractEffect
|
||||
return EffectType.BUFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
super.onStart(info);
|
||||
|
||||
info.getEffected().getActingPlayer().setServitorShare(_stats);
|
||||
if (info.getEffected().getActingPlayer().getSummon() != null)
|
||||
{
|
||||
info.getEffected().getActingPlayer().getSummon().broadcastInfo();
|
||||
info.getEffected().getActingPlayer().getSummon().getStatus().startHpMpRegeneration();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(BuffInfo info)
|
||||
{
|
||||
final Creature effected = info.getEffected().isPlayer() ? info.getEffected().getSummon() : info.getEffected().getActingPlayer();
|
||||
if (effected != null)
|
||||
info.getEffected().getActingPlayer().setServitorShare(null);
|
||||
if (info.getEffected().getSummon() != null)
|
||||
{
|
||||
ThreadPool.schedule(new ScheduledEffectExitTask(effected, info.getSkill().getId()), 100);
|
||||
if (info.getEffected().getSummon().getCurrentHp() > info.getEffected().getSummon().getMaxHp())
|
||||
{
|
||||
info.getEffected().getSummon().setCurrentHp(info.getEffected().getSummon().getMaxHp());
|
||||
}
|
||||
if (info.getEffected().getSummon().getCurrentMp() > info.getEffected().getSummon().getMaxMp())
|
||||
{
|
||||
info.getEffected().getSummon().setCurrentMp(info.getEffected().getSummon().getMaxMp());
|
||||
}
|
||||
info.getEffected().getSummon().broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1445,24 +1445,4 @@
|
||||
<effect name="Fear" />
|
||||
</for>
|
||||
</skill>
|
||||
<!-- For 20 minutes, increases the user's P. Atk. by 3%, M. Atk. by 3%, skill P. Atk. by 5%, Atk. Spd. by 2%, Casting Spd. by 1%, and Critical Rate by 5%. The master's abilities are extended to the servitor. -->
|
||||
<!-- Increases Resistance to Earth attacks by 10 for 20 minutes. -->
|
||||
<!-- For 20 minutes, increases the elemental attribute of all party members by 20. -->
|
||||
<!-- Cures all poisoned party members. -->
|
||||
<!-- Cancels paralysis and petrification effects, and also cures poison and bleed condition of all party members. -->
|
||||
<!-- Restores HP of party members with 796 Power, and also cures poison and bleed condition of all party members. -->
|
||||
<!-- Recovers the target and the 10 most injured allies around the target by 30% of their Max HP. The recovery amount decreases starting from the most injured person. Requires 4 Spirit Ore. -->
|
||||
<!-- Inflicts non-attribute damage on the target and enemies around the target with 141 Power added to M. Atk., and recovers MP. Inflicts additional non-attribute damage with 58 Power if the target is a monster. -->
|
||||
<!-- Inflicts non-attribute damage on the enemy with 178 Power added to M. Atk. and recovers MP. Inflicts additional non-attribute damage with 124 Power if the target is a monster. -->
|
||||
<!-- For 10 seconds, decreases the damage received by 70% and turns the remaining damage into MP consumption. When MP becomes 0, the skill's effect disappears. -->
|
||||
<!-- Extends the summoner's abilities to the servitor. Using the summoner's abilities as the basis, extends to the servitor P. Atk./P. Def. by 50%, M. Atk./M. Def. by 25%, Max HP/MP by 10%, Critical Rate by 20%, Atk. Spd. by 10%, and Casting Spd. by 3%. -->
|
||||
<!-- Note: 0.5 means 50% of owner's patk! -->
|
||||
<!-- Creates a tear in the dimension to inflict damage on the enemy with 57 Power added to M. Atk. Over-hit is possible. -->
|
||||
<!-- When equipped with a dagger or a dual dagger, increases Critical Rate by 20% and Critical Damage by 177. Requires a light armor to be equipped. -->
|
||||
<!-- Attacks the target's vital points with 11234 Power added to P. Atk., causing a Spoiled state. Lethal strike, half Kill, critical hit, and over-hit are possible. Requires a dual dagger. -->
|
||||
<!-- Regenerates 15% of Max HP and increases one's own Max HP by 15% for 10 minutes. -->
|
||||
<!-- Decreases all party members' P. Def. by 5%, M. Def. by 10% and Evasion by 2, and increases P. Atk. by 5%, M. Atk. by 10%, Atk. Spd. by 5%, Casting Spd. by 5%, and Speed by 5 for 20 minutes. -->
|
||||
<!-- Increases party or clan members' Atk. Spd. by 15% for 20 minutes. -->
|
||||
<!-- Chance to decrease the enemy's P. Def. by 23% under normal attacks. -->
|
||||
<!-- Increases Max MP by 70. -->
|
||||
</list>
|
||||
|
@ -808,6 +808,8 @@ public class PlayerInstance extends Playable
|
||||
|
||||
private Future<?> _autoSaveTask = null;
|
||||
|
||||
private Map<Stat, Double> _servitorShare;
|
||||
|
||||
/**
|
||||
* Creates a player.
|
||||
* @param objectId the object ID
|
||||
@ -14456,4 +14458,26 @@ public class PlayerInstance extends Playable
|
||||
_questTimers.remove(questTimer);
|
||||
}
|
||||
}
|
||||
|
||||
public void setServitorShare(Map<Stat, Double> map)
|
||||
{
|
||||
_servitorShare = map;
|
||||
}
|
||||
|
||||
public double getServitorShareBonus(Stat stat)
|
||||
{
|
||||
final Map<Stat, Double> stats = _servitorShare;
|
||||
if (stats == null)
|
||||
{
|
||||
return 1.0d;
|
||||
}
|
||||
|
||||
final Double val = stats.get(stat);
|
||||
if (val == null)
|
||||
{
|
||||
return 1.0d;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import org.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import org.l2jmobius.gameserver.model.skills.EffectScope;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SetSummonRemainTime;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
@ -444,4 +445,58 @@ public class ServitorInstance extends Summon implements Runnable
|
||||
sendPacket(new SetSummonRemainTime(_lifeTime, _lifeTimeRemaining));
|
||||
updateEffectIcons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMAtk(Creature target, Skill skill)
|
||||
{
|
||||
return super.getMAtk(target, skill) + (getActingPlayer().getMAtk(target, skill) * (getActingPlayer().getServitorShareBonus(Stat.MAGIC_ATTACK) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMDef(Creature target, Skill skill)
|
||||
{
|
||||
return super.getMDef(target, skill) + (getActingPlayer().getMDef(target, skill) * (getActingPlayer().getServitorShareBonus(Stat.MAGIC_DEFENCE) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPAtk(Creature target)
|
||||
{
|
||||
return super.getPAtk(target) + (getActingPlayer().getPAtk(target) * (getActingPlayer().getServitorShareBonus(Stat.POWER_ATTACK) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPDef(Creature target)
|
||||
{
|
||||
return super.getPDef(target) + (getActingPlayer().getPDef(target) * (getActingPlayer().getServitorShareBonus(Stat.POWER_DEFENCE) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMAtkSpd()
|
||||
{
|
||||
return (int) (super.getMAtkSpd() + (getActingPlayer().getMAtkSpd() * (getActingPlayer().getServitorShareBonus(Stat.MAGIC_ATTACK_SPEED) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHp()
|
||||
{
|
||||
return (int) (super.getMaxHp() + (getActingPlayer().getMaxHp() * (getActingPlayer().getServitorShareBonus(Stat.MAX_HP) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMp()
|
||||
{
|
||||
return (int) (super.getMaxMp() + (getActingPlayer().getMaxMp() * (getActingPlayer().getServitorShareBonus(Stat.MAX_MP) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCriticalHit(Creature target, Skill skill)
|
||||
{
|
||||
return (int) (super.getCriticalHit(target, skill) + ((getActingPlayer().getCriticalHit(target, skill)) * (getActingPlayer().getServitorShareBonus(Stat.CRITICAL_RATE) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPAtkSpd()
|
||||
{
|
||||
return super.getPAtkSpd() + (getActingPlayer().getPAtkSpd() * (getActingPlayer().getServitorShareBonus(Stat.POWER_ATTACK_SPEED) - 1.0));
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package org.l2jmobius.gameserver.model.skills;
|
||||
*/
|
||||
public enum AbnormalType
|
||||
{
|
||||
ABILITY_CHANGE,
|
||||
ABNORMAL_INVINCIBILITY,
|
||||
ABNORMAL_ITEM,
|
||||
AB_HAWK_EYE,
|
||||
|
@ -16,14 +16,16 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.conditions.Condition;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import org.l2jmobius.gameserver.model.effects.EffectType;
|
||||
import org.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
|
||||
/**
|
||||
* Servitor Share effect implementation.<br>
|
||||
@ -33,27 +35,16 @@ import org.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
*/
|
||||
public class ServitorShare extends AbstractEffect
|
||||
{
|
||||
private static final class ScheduledEffectExitTask implements Runnable
|
||||
{
|
||||
private final Creature _effected;
|
||||
private final int _skillId;
|
||||
|
||||
public ScheduledEffectExitTask(Creature effected, int skillId)
|
||||
{
|
||||
_effected = effected;
|
||||
_skillId = skillId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_effected.stopSkillEffects(false, _skillId);
|
||||
}
|
||||
}
|
||||
private final Map<Stat, Double> _stats = new HashMap<>(9);
|
||||
|
||||
public ServitorShare(Condition attachCond, Condition applyCond, StatSet set, StatSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
for (String key : params.getSet().keySet())
|
||||
{
|
||||
_stats.put(Stat.valueOfXml(key), params.getDouble(key, 1.));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,13 +59,34 @@ public class ServitorShare extends AbstractEffect
|
||||
return EffectType.BUFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
super.onStart(info);
|
||||
|
||||
info.getEffected().getActingPlayer().setServitorShare(_stats);
|
||||
if (info.getEffected().getActingPlayer().getSummon() != null)
|
||||
{
|
||||
info.getEffected().getActingPlayer().getSummon().broadcastInfo();
|
||||
info.getEffected().getActingPlayer().getSummon().getStatus().startHpMpRegeneration();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(BuffInfo info)
|
||||
{
|
||||
final Creature effected = info.getEffected().isPlayer() ? info.getEffected().getSummon() : info.getEffected().getActingPlayer();
|
||||
if (effected != null)
|
||||
info.getEffected().getActingPlayer().setServitorShare(null);
|
||||
if (info.getEffected().getSummon() != null)
|
||||
{
|
||||
ThreadPool.schedule(new ScheduledEffectExitTask(effected, info.getSkill().getId()), 100);
|
||||
if (info.getEffected().getSummon().getCurrentHp() > info.getEffected().getSummon().getMaxHp())
|
||||
{
|
||||
info.getEffected().getSummon().setCurrentHp(info.getEffected().getSummon().getMaxHp());
|
||||
}
|
||||
if (info.getEffected().getSummon().getCurrentMp() > info.getEffected().getSummon().getMaxMp())
|
||||
{
|
||||
info.getEffected().getSummon().setCurrentMp(info.getEffected().getSummon().getMaxMp());
|
||||
}
|
||||
info.getEffected().getSummon().broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1721,35 +1721,31 @@
|
||||
</skill>
|
||||
<skill id="1557" levels="1" name="Servitor Share">
|
||||
<!-- Extends the summoner's abilities to the servitor. Using the summoner's abilities as the basis, extends to the servitor P. Atk./P. Def. by 50%, M. Atk./M. Def. by 25%, Max HP/MP by 10%, Critical Rate by 20%, Atk. Spd. by 10%, and Casting Spd. by 3%. -->
|
||||
<set name="abnormalLevel" val="1" />
|
||||
<set name="abnormalTime" val="1200" />
|
||||
<set name="castRange" val="400" />
|
||||
<set name="abnormalType" val="ABILITY_CHANGE" />
|
||||
<set name="effectPoint" val="669" />
|
||||
<set name="effectRange" val="900" />
|
||||
<set name="hitTime" val="1000" />
|
||||
<set name="icon" val="icon.skill1557" />
|
||||
<set name="isMagic" val="1" /> <!-- Magic Skill -->
|
||||
<set name="magicLevel" val="83" />
|
||||
<set name="mpConsume" val="35" />
|
||||
<set name="operateType" val="A2" />
|
||||
<set name="reuseDelay" val="60000" />
|
||||
<set name="targetType" val="SERVITOR" />
|
||||
<set name="targetType" val="SELF" />
|
||||
<set name="canBeDispeled" val="false" />
|
||||
<for>
|
||||
<!-- Note: 0.5 means 50% of owner's patk! -->
|
||||
<effect name="ServitorShare">
|
||||
<share stat="pAtk" val="0.5" />
|
||||
<share stat="pDef" val="0.5" />
|
||||
<share stat="mAtk" val="0.25" />
|
||||
<share stat="mDef" val="0.25" />
|
||||
<share stat="maxHp" val="0.1" />
|
||||
<share stat="maxMp" val="0.1" />
|
||||
<share stat="critRate" val="0.2" />
|
||||
<share stat="pAtkSpd" val="0.1" />
|
||||
<share stat="mAtkSpd" val="0.03" />
|
||||
<param pAtk="1.5" />
|
||||
<param mAtk="1.25" />
|
||||
<param pDef="1.5" />
|
||||
<param mDef="1.25" />
|
||||
<param maxHp="1.1" />
|
||||
<param maxMp="1.1" />
|
||||
<param pAtkSpd="1.1" />
|
||||
<param mAtkSpd="1.03" />
|
||||
<param critRate="1.2" />
|
||||
</effect>
|
||||
</for>
|
||||
<selfEffects>
|
||||
<effect name="ServitorShare" /> <!-- This effect is used to cancel pet's effect when player's have been canceled. -->
|
||||
</selfEffects>
|
||||
</skill>
|
||||
<skill id="1558" levels="24" name="Dimension Spiral">
|
||||
<!-- Creates a tear in the dimension to inflict damage on the enemy with 57 Power added to M. Atk. Over-hit is possible. -->
|
||||
|
@ -827,6 +827,8 @@ public class PlayerInstance extends Playable
|
||||
|
||||
private Future<?> _autoSaveTask = null;
|
||||
|
||||
private Map<Stat, Double> _servitorShare;
|
||||
|
||||
/**
|
||||
* Creates a player.
|
||||
* @param objectId the object ID
|
||||
@ -14550,4 +14552,26 @@ public class PlayerInstance extends Playable
|
||||
_questTimers.remove(questTimer);
|
||||
}
|
||||
}
|
||||
|
||||
public void setServitorShare(Map<Stat, Double> map)
|
||||
{
|
||||
_servitorShare = map;
|
||||
}
|
||||
|
||||
public double getServitorShareBonus(Stat stat)
|
||||
{
|
||||
final Map<Stat, Double> stats = _servitorShare;
|
||||
if (stats == null)
|
||||
{
|
||||
return 1.0d;
|
||||
}
|
||||
|
||||
final Double val = stats.get(stat);
|
||||
if (val == null)
|
||||
{
|
||||
return 1.0d;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import org.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import org.l2jmobius.gameserver.model.skills.EffectScope;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SetSummonRemainTime;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
@ -444,4 +445,58 @@ public class ServitorInstance extends Summon implements Runnable
|
||||
sendPacket(new SetSummonRemainTime(_lifeTime, _lifeTimeRemaining));
|
||||
updateEffectIcons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMAtk(Creature target, Skill skill)
|
||||
{
|
||||
return super.getMAtk(target, skill) + (getActingPlayer().getMAtk(target, skill) * (getActingPlayer().getServitorShareBonus(Stat.MAGIC_ATTACK) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMDef(Creature target, Skill skill)
|
||||
{
|
||||
return super.getMDef(target, skill) + (getActingPlayer().getMDef(target, skill) * (getActingPlayer().getServitorShareBonus(Stat.MAGIC_DEFENCE) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPAtk(Creature target)
|
||||
{
|
||||
return super.getPAtk(target) + (getActingPlayer().getPAtk(target) * (getActingPlayer().getServitorShareBonus(Stat.POWER_ATTACK) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPDef(Creature target)
|
||||
{
|
||||
return super.getPDef(target) + (getActingPlayer().getPDef(target) * (getActingPlayer().getServitorShareBonus(Stat.POWER_DEFENCE) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMAtkSpd()
|
||||
{
|
||||
return (int) (super.getMAtkSpd() + (getActingPlayer().getMAtkSpd() * (getActingPlayer().getServitorShareBonus(Stat.MAGIC_ATTACK_SPEED) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHp()
|
||||
{
|
||||
return (int) (super.getMaxHp() + (getActingPlayer().getMaxHp() * (getActingPlayer().getServitorShareBonus(Stat.MAX_HP) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMp()
|
||||
{
|
||||
return (int) (super.getMaxMp() + (getActingPlayer().getMaxMp() * (getActingPlayer().getServitorShareBonus(Stat.MAX_MP) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCriticalHit(Creature target, Skill skill)
|
||||
{
|
||||
return (int) (super.getCriticalHit(target, skill) + ((getActingPlayer().getCriticalHit(target, skill)) * (getActingPlayer().getServitorShareBonus(Stat.CRITICAL_RATE) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPAtkSpd()
|
||||
{
|
||||
return super.getPAtkSpd() + (getActingPlayer().getPAtkSpd() * (getActingPlayer().getServitorShareBonus(Stat.POWER_ATTACK_SPEED) - 1.0));
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package org.l2jmobius.gameserver.model.skills;
|
||||
*/
|
||||
public enum AbnormalType
|
||||
{
|
||||
ABILITY_CHANGE,
|
||||
ABNORMAL_INVINCIBILITY,
|
||||
ABNORMAL_ITEM,
|
||||
AB_HAWK_EYE,
|
||||
|
Loading…
Reference in New Issue
Block a user