Servitor Share effect.
Contributed by Patrioch.
This commit is contained in:
@ -239,7 +239,6 @@ public abstract class DocumentBase
|
||||
case "mul":
|
||||
case "div":
|
||||
case "set":
|
||||
case "share":
|
||||
case "enchant":
|
||||
case "enchanthp":
|
||||
{
|
||||
|
@ -27,7 +27,6 @@ public enum StatFunction
|
||||
ENCHANTHP("EnchantHp", 40),
|
||||
MUL("Mul", 20),
|
||||
SET("Set", 0),
|
||||
SHARE("Share", 30),
|
||||
SUB("Sub", 30);
|
||||
|
||||
String name;
|
||||
|
@ -3009,7 +3009,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
{
|
||||
broadcastPacket(su);
|
||||
}
|
||||
if (hasServitors() && isAffected(EffectFlag.SERVITOR_SHARE))
|
||||
if (hasServitors() && hasAbnormalType(AbnormalType.ABILITY_CHANGE))
|
||||
{
|
||||
getServitors().values().forEach(L2Summon::broadcastStatusUpdate);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import com.l2jmobius.gameserver.enums.Position;
|
||||
import com.l2jmobius.gameserver.model.CharEffectList;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.SkillConditionScope;
|
||||
@ -784,6 +785,19 @@ public class CharStat
|
||||
.forEach(effect -> effect.pump(info.getEffected(), info.getSkill())));
|
||||
//@formatter:on
|
||||
|
||||
if (_activeChar.isSummon() && (_activeChar.getActingPlayer() != null) && _activeChar.getActingPlayer().hasAbnormalType(AbnormalType.ABILITY_CHANGE))
|
||||
{
|
||||
//@formatter:off
|
||||
_activeChar.getActingPlayer().getEffectList().getEffects().stream()
|
||||
.filter(BuffInfo::isInUse)
|
||||
.filter(info -> info.isAbnormalType(AbnormalType.ABILITY_CHANGE))
|
||||
.forEach(info -> info.getEffects().stream()
|
||||
.filter(effect -> effect.canStart(info))
|
||||
.filter(effect -> effect.canPump(_activeChar, _activeChar, info.getSkill()))
|
||||
.forEach(effect -> effect.pump(_activeChar, info.getSkill())));
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
// Merge with additional stats
|
||||
_additionalAdd.stream().filter(holder -> holder.verifyCondition(_activeChar)).forEach(holder -> mergeAdd(holder.getStat(), holder.getValue()));
|
||||
_additionalMul.stream().filter(holder -> holder.verifyCondition(_activeChar)).forEach(holder -> mergeMul(holder.getStat(), holder.getValue()));
|
||||
|
@ -31,6 +31,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLevel
|
||||
import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.model.stats.Stats;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
@ -667,13 +668,7 @@ public class PcStat extends PlayableStat
|
||||
super.onRecalculateStats(broadcast);
|
||||
|
||||
final L2PcInstance player = getActiveChar();
|
||||
|
||||
// Upon master stats recalculation trigger pet/servitor recalculation too
|
||||
if (player.hasPet())
|
||||
{
|
||||
player.getPet().getStat().recalculateStats(broadcast);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
if (player.hasAbnormalType(AbnormalType.ABILITY_CHANGE) && player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(servitor -> servitor.getStat().recalculateStats(broadcast));
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ public enum EffectFlag
|
||||
DEBUFF_BLOCK,
|
||||
ABNORMAL_SHIELD,
|
||||
BLOCK_RESURRECTION,
|
||||
SERVITOR_SHARE,
|
||||
UNTARGETABLE,
|
||||
CANNOT_ESCAPE,
|
||||
DOUBLE_CAST,
|
||||
|
@ -451,4 +451,9 @@ public final class BuffInfo
|
||||
_scheduledFutureTimeTask = ThreadPoolManager.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000L);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAbnormalType(AbnormalType type)
|
||||
{
|
||||
return _skill.getAbnormalType().equals(type);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ public enum CommonSkill
|
||||
ONYX_BEAST_TRANSFORMATION(617, 1),
|
||||
CREATE_COMMON(1320, 1),
|
||||
DIVINE_INSPIRATION(1405, 1),
|
||||
SERVITOR_SHARE(1557, 1),
|
||||
CARAVANS_SECRET_MEDICINE(2341, 1),
|
||||
SHILENS_BREATH(14571, 1),
|
||||
IMPRIT_OF_LIGHT(19034, 1),
|
||||
|
@ -1525,7 +1525,7 @@ public final class Skill implements IIdentifiable
|
||||
*/
|
||||
public boolean canBeStolen()
|
||||
{
|
||||
return !isPassive() && !isToggle() && !isDebuff() && !isHeroSkill() && !isGMSkill() && !(isStatic() && (getId() != CommonSkill.CARAVANS_SECRET_MEDICINE.getId())) && canBeDispelled() && (getId() != CommonSkill.SERVITOR_SHARE.getId());
|
||||
return !isPassive() && !isToggle() && !isDebuff() && !isIrreplacableBuff() && !isHeroSkill() && !isGMSkill() && !(isStatic() && (getId() != CommonSkill.CARAVANS_SECRET_MEDICINE.getId())) && canBeDispelled();
|
||||
}
|
||||
|
||||
public boolean isClanSkill()
|
||||
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.stats.functions;
|
||||
|
||||
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.conditions.Condition;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Stats;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class FuncShare extends AbstractFunction
|
||||
{
|
||||
public FuncShare(Stats stat, int order, Object owner, double value, Condition applayCond)
|
||||
{
|
||||
super(stat, order, owner, value, applayCond);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
|
||||
{
|
||||
if ((getApplayCond() == null) || getApplayCond().test(effector, effected, skill))
|
||||
{
|
||||
if ((effector != null) && effector.isServitor())
|
||||
{
|
||||
final L2Summon summon = (L2Summon) effector;
|
||||
final L2PcInstance player = summon.getOwner();
|
||||
if (player != null)
|
||||
{
|
||||
return initVal + (getBaseValue(getStat(), player) * getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return initVal;
|
||||
}
|
||||
|
||||
public static double getBaseValue(Stats stat, L2PcInstance player)
|
||||
{
|
||||
switch (stat)
|
||||
{
|
||||
case MAX_HP:
|
||||
{
|
||||
return player.getMaxHp();
|
||||
}
|
||||
case MAX_MP:
|
||||
{
|
||||
return player.getMaxMp();
|
||||
}
|
||||
case PHYSICAL_ATTACK:
|
||||
{
|
||||
return player.getPAtk();
|
||||
}
|
||||
case MAGIC_ATTACK:
|
||||
{
|
||||
return player.getMAtk();
|
||||
}
|
||||
case PHYSICAL_DEFENCE:
|
||||
{
|
||||
return player.getPDef();
|
||||
}
|
||||
case MAGICAL_DEFENCE:
|
||||
{
|
||||
return player.getMDef();
|
||||
}
|
||||
case CRITICAL_RATE:
|
||||
{
|
||||
return player.getCriticalHit();
|
||||
}
|
||||
case PHYSICAL_ATTACK_SPEED:
|
||||
{
|
||||
return player.getPAtkSpd();
|
||||
}
|
||||
case MAGIC_ATTACK_SPEED:
|
||||
{
|
||||
return player.getMAtkSpd();
|
||||
}
|
||||
default:
|
||||
{
|
||||
return player.getStat().getValue(stat, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user