From 4066f79145dd1748b20f41a7333f1991fc4647fb Mon Sep 17 00:00:00 2001 From: Rumen Nikiforov <unafraid89@gmail.com> Date: Fri, 2 Nov 2012 18:48:33 +0000 Subject: [PATCH] BETA: Implementing Servitor Share skill (The sharing part). * Reported by: Nair, Tavo22, Vulcan * Note: H5 feature. --- .../scripts/handlers/EffectMasterHandler.java | 2 + .../effecthandlers/ServitorShare.java | 88 +++++++++++++++++++ .../game/data/stats/skills/01500-01599.xml | 22 ++--- 3 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/ServitorShare.java diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java index f6b9bb269c..2502784fe8 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -74,6 +74,7 @@ import handlers.effecthandlers.Relax; import handlers.effecthandlers.RemoveTarget; import handlers.effecthandlers.RestorationRandom; import handlers.effecthandlers.Root; +import handlers.effecthandlers.ServitorShare; import handlers.effecthandlers.Signet; import handlers.effecthandlers.SignetAntiSummon; import handlers.effecthandlers.SignetMDam; @@ -166,6 +167,7 @@ public final class EffectMasterHandler RemoveTarget.class, RestorationRandom.class, Root.class, + ServitorShare.class, Signet.class, SignetAntiSummon.class, SignetMDam.class, diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/ServitorShare.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/ServitorShare.java new file mode 100644 index 0000000000..640830ec5e --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/ServitorShare.java @@ -0,0 +1,88 @@ +/* + * 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 com.l2jserver.gameserver.model.CharEffectList; +import com.l2jserver.gameserver.model.actor.L2Summon; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.effects.EffectTemplate; +import com.l2jserver.gameserver.model.effects.L2Effect; +import com.l2jserver.gameserver.model.effects.L2EffectType; +import com.l2jserver.gameserver.model.stats.Env; + +/** + * @author UnAfraid + */ +public class ServitorShare extends L2Effect +{ + public ServitorShare(Env env, EffectTemplate template) + { + super(env, template); + } + + @Override + public L2EffectType getEffectType() + { + return L2EffectType.BUFF; + } + + @Override + public void onExit() + { + // Synchronizing effects on player and pet if one of them get's removed for some reason the same will happen to another. + L2Effect[] effects = null; + if (getEffected().isPlayer()) + { + L2Summon summon = getEffector().getPet(); + effects = summon.getAllEffects(); + } + else if (getEffected().isSummon()) + { + L2PcInstance owner = getEffected().getActingPlayer(); + effects = owner.getAllEffects(); + } + + if (effects != null) + { + for (L2Effect eff : effects) + { + if (eff.getSkill().getId() == getSkill().getId()) + { + eff.exit(); + break; + } + } + } + super.onExit(); + } + + @Override + public boolean onActionTime() + { + return false; + } + + @Override + public boolean canBeStolen() + { + return false; + } + + @Override + public int getEffectFlags() + { + return CharEffectList.EFFECT_FLAG_SERVITOR_SHARE; + } +} diff --git a/L2J_DataPack_BETA/dist/game/data/stats/skills/01500-01599.xml b/L2J_DataPack_BETA/dist/game/data/stats/skills/01500-01599.xml index b69023a8e0..cb7062d78a 100644 --- a/L2J_DataPack_BETA/dist/game/data/stats/skills/01500-01599.xml +++ b/L2J_DataPack_BETA/dist/game/data/stats/skills/01500-01599.xml @@ -1492,16 +1492,18 @@ <set name="skillType" val="BUFF" /> <set name="target" val="TARGET_PET" /> <for> - <effect name="Buff" abnormalTime="1200" val="0"> - <mul order="0x30" stat="pAtk" val="1.5" /> - <mul order="0x30" stat="pDef" val="1.5" /> - <mul order="0x30" stat="mAtk" val="1.25" /> - <mul order="0x30" stat="mDef" val="1.25" /> - <mul order="0x30" stat="maxHp" val="1.1" /> - <mul order="0x30" stat="maxMp" val="1.1" /> - <basemul order="0x30" stat="rCrit" val="0.2" /> - <mul order="0x30" stat="pAtkSpd" val="1.1" /> - <mul order="0x30" stat="mAtkSpd" val="1.03" /> + <!-- Note: 0.5 means 50% of owner's patk! --> + <effect self="1" name="ServitorShare" abnormalTime="1200" val="0" /> <!-- This effect is used to cancel pet's effect when player's have been canceled. --> + <effect name="ServitorShare" abnormalTime="1200" noicon="1" val="0"> + <share order="0x40" stat="pAtk" val="0.5" /> + <share order="0x40" stat="pDef" val="0.5" /> + <share order="0x40" stat="mAtk" val="0.25" /> + <share order="0x40" stat="mDef" val="0.25" /> + <share order="0x40" stat="maxHp" val="0.1" /> + <share order="0x40" stat="maxMp" val="0.1" /> + <share order="0x40" stat="rCrit" val="0.2" /> + <share order="0x40" stat="pAtkSpd" val="0.1" /> + <share order="0x40" stat="mAtkSpd" val="0.03" /> </effect> </for> </skill> -- GitLab