Servitor Share effect.

Contributed by Patrioch.
This commit is contained in:
MobiusDev
2017-09-10 01:57:38 +00:00
parent af0d56b56a
commit 9c145fb785
51 changed files with 349 additions and 720 deletions

View File

@@ -16,58 +16,53 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.gameserver.ThreadPoolManager;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Servitor Share effect implementation.<br>
* Synchronizing effects on player and servitor if one of them gets removed for some reason the same will happen to another. Partner's effect exit is executed in own thread, since there is no more queue to schedule the effects,<br>
* partner's effect is called while this effect is still exiting issuing an exit call for the effect, causing a stack over flow.
* @author UnAfraid, Zoey76
* Servitor Share effect implementation.
*/
public final class ServitorShare extends AbstractEffect
{
private static final class ScheduledEffectExitTask implements Runnable
{
private final L2Character _effected;
private final int _skillId;
public ScheduledEffectExitTask(L2Character effected, int skillId)
{
_effected = effected;
_skillId = skillId;
}
@Override
public void run()
{
_effected.stopSkillEffects(false, _skillId);
}
}
private final Map<Stats, Float> _sharedStats = new HashMap<>();
public ServitorShare(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.SERVITOR_SHARE.getMask();
}
@Override
public void onExit(BuffInfo info)
{
final L2Character effected = info.getEffected().isSummon() ? ((L2Summon) info.getEffected()).getOwner() : info.getEffected();
if (effected != null)
if (params.isEmpty())
{
ThreadPoolManager.schedule(new ScheduledEffectExitTask(effected, info.getSkill().getId()), 100);
return;
}
for (Entry<String, Object> param : params.getSet().entrySet())
{
_sharedStats.put(Stats.valueOf(param.getKey()), (Float.parseFloat((String) param.getValue())) / 100);
}
}
}
@Override
public boolean canPump(L2Character effector, L2Character effected, Skill skill)
{
return effected.isSummon();
}
@Override
public void pump(L2Character effected, Skill skill)
{
final L2PcInstance owner = effected.getActingPlayer();
if (owner != null)
{
for (Entry<Stats, Float> stats : _sharedStats.entrySet())
{
effected.getStat().mergeAdd(stats.getKey(), owner.getStat().getValue(stats.getKey()) * stats.getValue());
}
}
}
}

View File

@@ -3427,14 +3427,10 @@
</effects>
</skill>
<skill id="1557" toLevel="1" name="Servitor Share">
<!-- High Five Skill -->
<!-- Totally Unconfirmed -->
<abnormalLvl>1</abnormalLvl>
<abnormalTime>1200</abnormalTime>
<abnormalType>ABILITY_CHANGE</abnormalType>
<castRange>400</castRange> <!-- No cast range -->
<effectPoint>379</effectPoint>
<effectRange>900</effectRange>
<hitTime>1000</hitTime>
<icon>icon.skill1557</icon>
<isMagic>1</isMagic> <!-- Magic Skill -->
@@ -3448,30 +3444,25 @@
<magicCriticalRate>5</magicCriticalRate>
<specialLevel>-1</specialLevel>
<irreplacableBuff>true</irreplacableBuff>
<!-- Should be self -->
<targetType>SELF</targetType>
<affectScope>SINGLE</affectScope>
<isSharedWithSummon>false</isSharedWithSummon>
<conditions>
<condition name="OpHaveSummon" />
</conditions>
<effects>
<!-- 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="rCrit" val="0.2" />
<share stat="pAtkSpd" val="0.1" />
<share stat="mAtkSpd" val="0.03" />
</effect>
<PHYSICAL_ATTACK>50</PHYSICAL_ATTACK>
<PHYSICAL_DEFENCE>50</PHYSICAL_DEFENCE>
<MAGIC_ATTACK>25</MAGIC_ATTACK>
<MAGICAL_DEFENCE>25</MAGICAL_DEFENCE>
<MAX_HP>10</MAX_HP>
<MAX_MP>10</MAX_MP>
<CRITICAL_RATE>20</CRITICAL_RATE>
<PHYSICAL_ATTACK_SPEED>10</PHYSICAL_ATTACK_SPEED>
<MAGIC_ATTACK_SPEED>3</MAGIC_ATTACK_SPEED>
</effect>
</effects>
<!-- Shouldn't have any self effects -->
<selfEffects>
<effect name="ServitorShare" /> <!-- This effect is used to cancel pet's effect when player's have been canceled. -->
</selfEffects>
</skill>
<skill id="1558" toLevel="24" name="Dimension Spiral">
<!-- Glory Days confirmed -->

View File

@@ -2950,16 +2950,30 @@
<condition name="OpHaveSummon" />
</conditions>
<effects>
<!-- Note: 0.5 means 50% of owner's patk! -->
<effect name="ServitorShare">
<share stat="pAtk" val="0.60" />
<share stat="pDef" val="0.50" />
<share stat="mDef" val="0.30" />
<share stat="maxHp" val="0.15" />
<share stat="maxMp" val="0.15" />
<share stat="pAtkSpd" val="0.10" />
<share stat="rCrit" val="0.30" />
<share stat="cAtk" val="0.15" />
<PHYSICAL_ATTACK>
<value level="1">60</value>
<value level="2">65</value>
<value level="3">70</value>
<value level="4">70</value>
</PHYSICAL_ATTACK>
<PHYSICAL_DEFENCE>
<value level="1">50</value>
<value level="2">53</value>
<value level="3">55</value>
<value level="4">60</value>
</PHYSICAL_DEFENCE>
<MAGICAL_DEFENCE>
<value level="1">30</value>
<value level="2">35</value>
<value level="3">40</value>
<value level="4">50</value>
</MAGICAL_DEFENCE>
<MAX_HP>15</MAX_HP>
<MAX_MP>15</MAX_MP>
<PHYSICAL_ATTACK_SPEED>10</PHYSICAL_ATTACK_SPEED>
<CRITICAL_RATE>30</CRITICAL_RATE>
<CRITICAL_DAMAGE>15</CRITICAL_DAMAGE>
</effect>
</effects>
</skill>