Просмотр исходного кода

BETA: Balance Life from skillhandlers to effecthandlers.

	Reviewed by: MELERIX, !UnAfraid, Zoey76
Adry_85 12 лет назад
Родитель
Сommit
e6ab7bf0de

+ 2 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java

@@ -25,6 +25,7 @@ import java.util.logging.Logger;
 import com.l2jserver.gameserver.handler.EffectHandler;
 
 import handlers.effecthandlers.AbortCast;
+import handlers.effecthandlers.BalanceLife;
 import handlers.effecthandlers.Betray;
 import handlers.effecthandlers.BigHead;
 import handlers.effecthandlers.BlockResurrection;
@@ -118,6 +119,7 @@ public final class EffectMasterHandler
 	private static final Class<?>[] _effects =
 	{
 		AbortCast.class,
+		BalanceLife.class,
 		Betray.class,
 		BigHead.class,
 		BlockResurrection.class,

+ 0 - 2
L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java

@@ -208,7 +208,6 @@ import handlers.itemhandlers.SpecialXMas;
 import handlers.itemhandlers.SpiritShot;
 import handlers.itemhandlers.SummonItems;
 import handlers.itemhandlers.TeleportBookmark;
-import handlers.skillhandlers.BalanceLife;
 import handlers.skillhandlers.BallistaBomb;
 import handlers.skillhandlers.BeastSkills;
 import handlers.skillhandlers.Blow;
@@ -545,7 +544,6 @@ public class MasterHandler
 			HealPercent.class,
 			CombatPointHeal.class,
 			ManaHeal.class,
-			BalanceLife.class,
 			Charge.class,
 			Continuous.class,
 			Detection.class,

+ 106 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/BalanceLife.java

@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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.L2Party;
+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;
+import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
+
+/**
+ * Balance Life effect.
+ * @author Adry_85, earendil
+ */
+public class BalanceLife extends L2Effect
+{
+	public BalanceLife(Env env, EffectTemplate template)
+	{
+		super(env, template);
+	}
+	
+	@Override
+	public L2EffectType getEffectType()
+	{
+		return L2EffectType.BALANCE_LIFE;
+	}
+	
+	@Override
+	public boolean onStart()
+	{
+		if (!getEffector().isPlayer() || !getEffector().isInParty())
+		{
+			return false;
+		}
+		
+		final L2Party party = getEffector().getActingPlayer().getParty();
+		double fullHP = 0;
+		double currentHPs = 0;
+		
+		for (L2PcInstance member : party.getMembers())
+		{
+			if (member.isDead())
+			{
+				continue;
+			}
+			
+			fullHP += member.getMaxHp();
+			currentHPs += member.getCurrentHp();
+		}
+		
+		double percentHP = currentHPs / fullHP;
+		
+		for (L2PcInstance member : party.getMembers())
+		{
+			if (member.isDead())
+			{
+				continue;
+			}
+			
+			double newHP = member.getMaxHp() * percentHP;
+			
+			if (newHP > member.getCurrentHp()) // The target gets healed
+			{
+				// The heal will be blocked if the current hp passes the limit
+				if (member.getCurrentHp() > member.getMaxRecoverableHp())
+				{
+					newHP = member.getCurrentHp();
+				}
+				else if (newHP > member.getMaxRecoverableHp())
+				{
+					newHP = member.getMaxRecoverableHp();
+				}
+			}
+			
+			member.setCurrentHp(newHP);
+			StatusUpdate su = new StatusUpdate(member);
+			su.addAttribute(StatusUpdate.CUR_HP, (int) member.getCurrentHp());
+			member.sendPacket(su);
+		}
+		return true;
+	}
+	
+	@Override
+	public boolean onActionTime()
+	{
+		return false;
+	}
+}

+ 0 - 136
L2J_DataPack_BETA/dist/game/data/scripts/handlers/skillhandlers/BalanceLife.java

@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2004-2013 L2J DataPack
- * 
- * This file is part of L2J DataPack.
- * 
- * L2J DataPack 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.
- * 
- * L2J DataPack 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.skillhandlers;
-
-import com.l2jserver.gameserver.handler.ISkillHandler;
-import com.l2jserver.gameserver.handler.SkillHandler;
-import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.skills.L2Skill;
-import com.l2jserver.gameserver.model.skills.L2SkillType;
-import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
-
-/**
- * @author earendil
- * @version $Revision: 1.1.2.2.2.4 $ $Date: 2005/04/06 16:13:48 $
- */
-public class BalanceLife implements ISkillHandler
-{
-	private static final L2SkillType[] SKILL_IDS =
-	{
-		L2SkillType.BALANCE_LIFE
-	};
-	
-	@Override
-	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
-	{
-		// L2Character activeChar = activeChar;
-		// check for other effects
-		ISkillHandler handler = SkillHandler.getInstance().getHandler(L2SkillType.BUFF);
-		
-		if (handler != null)
-		{
-			handler.useSkill(activeChar, skill, targets);
-		}
-		
-		L2PcInstance player = null;
-		if (activeChar.isPlayer())
-		{
-			player = activeChar.getActingPlayer();
-		}
-		
-		double fullHP = 0;
-		double currentHPs = 0;
-		
-		for (L2Character target : (L2Character[]) targets)
-		{
-			// We should not heal if char is dead/
-			if ((target == null) || target.isDead())
-			{
-				continue;
-			}
-			
-			// Player holding a cursed weapon can't be healed and can't heal
-			if (target != activeChar)
-			{
-				if (target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
-				{
-					continue;
-				}
-				else if ((player != null) && player.isCursedWeaponEquipped())
-				{
-					continue;
-				}
-			}
-			
-			fullHP += target.getMaxHp();
-			currentHPs += target.getCurrentHp();
-		}
-		
-		double percentHP = currentHPs / fullHP;
-		
-		for (L2Character target : (L2Character[]) targets)
-		{
-			if ((target == null) || target.isDead())
-			{
-				continue;
-			}
-			
-			// Player holding a cursed weapon can't be healed and can't heal
-			if (target != activeChar)
-			{
-				if (target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
-				{
-					continue;
-				}
-				else if ((player != null) && player.isCursedWeaponEquipped())
-				{
-					continue;
-				}
-			}
-			
-			double newHP = target.getMaxHp() * percentHP;
-			
-			if (newHP > target.getCurrentHp()) // The target gets healed
-			{
-				// The heal will be blocked if the current hp passes the limit
-				if (target.getCurrentHp() > target.getMaxRecoverableHp())
-				{
-					newHP = target.getCurrentHp();
-				}
-				else if (newHP > target.getMaxRecoverableHp())
-				{
-					newHP = target.getMaxRecoverableHp();
-				}
-			}
-			
-			target.setCurrentHp(newHP);
-			StatusUpdate su = new StatusUpdate(target);
-			su.addAttribute(StatusUpdate.CUR_HP, (int) target.getCurrentHp());
-			target.sendPacket(su);
-		}
-	}
-	
-	@Override
-	public L2SkillType[] getSkillIds()
-	{
-		return SKILL_IDS;
-	}
-}

+ 12 - 8
L2J_DataPack_BETA/dist/game/data/stats/skills/01300-01399.xml

@@ -811,17 +811,21 @@
 		<enchant1 name="npcId" val="#enchantNpcId" />
 	</skill>
 	<skill id="1335" levels="1" name="Balance Life">
-		<set name="mpInitialConsume" val="25" />
-		<set name="mpConsume" val="98" />
-		<set name="power" val="1000" />
-		<set name="target" val="TARGET_PARTY" />
-		<set name="skillRadius" val="1000" />
-		<set name="reuseDelay" val="30000" />
+		<!-- Confirmed CT2.5 -->
+		<set name="aggroPoints" val="398" />
 		<set name="hitTime" val="5000" />
-		<set name="skillType" val="BALANCE_LIFE" />
 		<set name="isMagic" val="1" /> <!-- Magic Skill -->
+		<set name="magicLvl" val="76" />
+		<set name="mpConsume" val="98" />
+		<set name="mpInitialConsume" val="25" />
 		<set name="operateType" val="A1" />
-		<set name="aggroPoints" val="398" />
+		<set name="power" val="1000" />
+		<set name="reuseDelay" val="30000" />
+		<set name="skillRadius" val="1000" />
+		<set name="target" val="TARGET_PARTY" />
+		<for>
+			<effect name="BalanceLife" noicon="1" val="0" />
+		</for>
 	</skill>
 	<skill id="1336" levels="1" name="Curse of Doom" enchantGroup1="6" enchantGroup2="6">
 		<table name="#enchantMagicLvl"> 81 81 81 82 82 82 83 83 83 84 84 84 85 85 85 </table>