Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/com/l2jserver/gameserver/model/actor/L2Playable.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/L2Playable.java (revision 2)
- +++ java/com/l2jserver/gameserver/model/actor/L2Playable.java (working copy)
- @@ -12,10 +12,14 @@
- */
- package com.l2jserver.gameserver.model.actor;
- +import java.util.LinkedList;
- +import java.util.List;
- +
- import com.l2jserver.gameserver.ai.CtrlEvent;
- import com.l2jserver.gameserver.model.CharEffectList;
- import com.l2jserver.gameserver.model.L2Effect;
- import com.l2jserver.gameserver.model.L2Skill;
- +import com.l2jserver.gameserver.model.L2World;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.actor.knownlist.PlayableKnownList;
- import com.l2jserver.gameserver.model.actor.stat.PlayableStat;
- @@ -25,6 +29,7 @@
- import com.l2jserver.gameserver.model.quest.QuestState;
- import com.l2jserver.gameserver.templates.chars.L2CharTemplate;
- import com.l2jserver.gameserver.templates.skills.L2EffectType;
- +import com.l2jserver.util.Rnd;
- /**
- * This class represents all Playable characters in the world.<BR>
- @@ -368,4 +373,62 @@
- }
- return _faction;
- }
- +
- + public static class HealerInfo
- + {
- + private final int _objectId;
- + private long _healAmount;
- + private long _lastHeal;
- +
- + HealerInfo(int objectId, long amount)
- + {
- + _objectId = objectId;
- + addAndRecord(amount);
- + }
- +
- + public void addAndRecord(long amount)
- + {
- + _healAmount += amount;
- + _lastHeal = System.currentTimeMillis();
- + }
- +
- + public L2PcInstance getHealer()
- + {
- + return L2World.getInstance().getPlayer(_objectId);
- + }
- +
- + public long getHeal()
- + {
- + return _healAmount;
- + }
- +
- + public long getLastHeal()
- + {
- + return _lastHeal;
- + }
- +
- + public boolean isNullOrLate()
- + {
- + return (getHealer() == null) || (getLastHeal() >= (System.currentTimeMillis() + (12 * 1000)));
- + }
- +
- + public boolean isCloseTo(L2PcInstance target)
- + {
- + L2PcInstance healer = getHealer();
- + return healer != null && healer.getDistanceSq(target) <= 1750;
- + }
- +
- + public boolean hasHealEnough()
- + {
- + L2PcInstance healer = getHealer();
- + return healer != null && Rnd.get(10, 20) * getHeal() >= healer.getLevel() * 341 * 100;
- + }
- + }
- +
- + public final List<HealerInfo> _healerInfo = new LinkedList<>();
- +
- + public void addHeal(int healerId, long amount)
- + {
- +
- + }
- }
- \ No newline at end of file
- Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 3)
- +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -5945,6 +5945,15 @@
- {
- setPvpKills(getPvpKills() + 1);
- + _healerInfo.removeIf(HealerInfo::isNullOrLate);
- +
- + _healerInfo.stream().filter(i -> i.hasHealEnough()).filter(i -> i.isCloseTo(this)).forEach(i ->
- + {
- + L2PcInstance healer = i.getHealer();
- + healer.setPvpKills(healer.getPvpKills() + 1);
- + _healerInfo.remove(i);
- + });
- +
- if (Config.ENABLED_COUPLE_SUPPORT_SYSTEM)
- {
- CoupleRevenge.checkForPartner(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement