Browse Source

BETA: DP-Part for [L5071]

Rumen Nikiforov 13 years ago
parent
commit
61a3154e1d

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

@@ -32,6 +32,7 @@ import handlers.effecthandlers.EffectCombatPointHealOverTime;
 import handlers.effecthandlers.EffectConfuseMob;
 import handlers.effecthandlers.EffectConfusion;
 import handlers.effecthandlers.EffectCpDamPercent;
+import handlers.effecthandlers.EffectCpHealPercent;
 import handlers.effecthandlers.EffectDamOverTime;
 import handlers.effecthandlers.EffectDebuff;
 import handlers.effecthandlers.EffectDisarm;
@@ -42,6 +43,7 @@ import handlers.effecthandlers.EffectFear;
 import handlers.effecthandlers.EffectFusion;
 import handlers.effecthandlers.EffectGrow;
 import handlers.effecthandlers.EffectHealOverTime;
+import handlers.effecthandlers.EffectHealPercent;
 import handlers.effecthandlers.EffectHide;
 import handlers.effecthandlers.EffectImmobileBuff;
 import handlers.effecthandlers.EffectImmobilePetBuff;
@@ -49,6 +51,7 @@ import handlers.effecthandlers.EffectIncreaseCharges;
 import handlers.effecthandlers.EffectInvincible;
 import handlers.effecthandlers.EffectManaDamOverTime;
 import handlers.effecthandlers.EffectManaHealOverTime;
+import handlers.effecthandlers.EffectManaHealPercent;
 import handlers.effecthandlers.EffectMpConsumePerLevel;
 import handlers.effecthandlers.EffectMute;
 import handlers.effecthandlers.EffectNegate;
@@ -105,6 +108,7 @@ public final class EffectMasterHandler
 		EffectHandler.getInstance().registerHandler("ConfuseMob", EffectConfuseMob.class);
 		EffectHandler.getInstance().registerHandler("Confusion", EffectConfusion.class);
 		EffectHandler.getInstance().registerHandler("CpDamPercent", EffectCpDamPercent.class);
+		EffectHandler.getInstance().registerHandler("CpHealPercent", EffectCpHealPercent.class);
 		EffectHandler.getInstance().registerHandler("DamOverTime", EffectDamOverTime.class);
 		EffectHandler.getInstance().registerHandler("Debuff", EffectDebuff.class);
 		EffectHandler.getInstance().registerHandler("DispelBySlot", EffectDispelBySlot.class);
@@ -115,6 +119,7 @@ public final class EffectMasterHandler
 		EffectHandler.getInstance().registerHandler("Fusion", EffectFusion.class);
 		EffectHandler.getInstance().registerHandler("Grow", EffectGrow.class);
 		EffectHandler.getInstance().registerHandler("HealOverTime", EffectHealOverTime.class);
+		EffectHandler.getInstance().registerHandler("HealPercent", EffectHealPercent.class);
 		EffectHandler.getInstance().registerHandler("Hide", EffectHide.class);
 		EffectHandler.getInstance().registerHandler("ImmobileBuff", EffectImmobileBuff.class);
 		EffectHandler.getInstance().registerHandler("IncreaseCharges", EffectIncreaseCharges.class);
@@ -122,6 +127,7 @@ public final class EffectMasterHandler
 		EffectHandler.getInstance().registerHandler("Invincible", EffectInvincible.class);
 		EffectHandler.getInstance().registerHandler("ManaDamOverTime", EffectManaDamOverTime.class);
 		EffectHandler.getInstance().registerHandler("ManaHealOverTime", EffectManaHealOverTime.class);
+		EffectHandler.getInstance().registerHandler("ManaHealPercent", EffectManaHealPercent.class);
 		EffectHandler.getInstance().registerHandler("MpConsumePerLevel", EffectMpConsumePerLevel.class);
 		EffectHandler.getInstance().registerHandler("Mute", EffectMute.class);
 		EffectHandler.getInstance().registerHandler("Negate", EffectNegate.class);

+ 73 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/EffectCpHealPercent.java

@@ -0,0 +1,73 @@
+/**
+ * 
+ */
+package handlers.effecthandlers;
+
+import com.l2jserver.gameserver.model.L2Effect;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.skills.Env;
+import com.l2jserver.gameserver.templates.effects.EffectTemplate;
+import com.l2jserver.gameserver.templates.skills.L2EffectType;
+
+/**
+ * @author UnAfraid
+ *
+ */
+public class EffectCpHealPercent extends L2Effect
+{
+	public EffectCpHealPercent(Env env, EffectTemplate template)
+	{
+		super(env, template);
+	}
+	
+	@Override
+	public L2EffectType getEffectType()
+	{
+		return L2EffectType.CPHEAL_PERCENT;
+	}
+	
+	@Override
+	public boolean onStart()
+	{
+		L2Character target = getEffected();
+		if (target == null || target.isDead() || target instanceof L2DoorInstance)
+			return false;
+		StatusUpdate su = new StatusUpdate(target);
+		double amount = 0;
+		double power = calc();
+		boolean full = (power == 100.0);
+		
+		if (full)
+			amount = target.getMaxCp();
+		else
+			amount = target.getMaxCp() * power / 100.0;
+		
+		amount = Math.min(amount, target.getMaxRecoverableCp() - target.getCurrentCp());
+		
+		// Prevent negative amounts
+		if (amount < 0)
+			amount = 0;
+		
+		// To prevent -value heals, set the value only if current Cp is less than max recoverable.
+		if (target.getCurrentCp() < target.getMaxRecoverableCp())
+			target.setCurrentCp(amount + target.getCurrentCp());
+		
+		SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_WILL_BE_RESTORED);
+		sm.addNumber((int) amount);
+		target.sendPacket(sm);
+		su.addAttribute(StatusUpdate.CUR_CP, (int) target.getCurrentCp());
+		target.sendPacket(su);
+		
+		return true;
+	}
+	
+	@Override
+	public boolean onActionTime()
+	{
+		return false;
+	}
+}

+ 83 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/EffectHealPercent.java

@@ -0,0 +1,83 @@
+/**
+ * 
+ */
+package handlers.effecthandlers;
+
+import com.l2jserver.gameserver.model.L2Effect;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.skills.Env;
+import com.l2jserver.gameserver.templates.effects.EffectTemplate;
+import com.l2jserver.gameserver.templates.skills.L2EffectType;
+
+/**
+ * @author UnAfraid
+ *
+ */
+public class EffectHealPercent extends L2Effect
+{
+	public EffectHealPercent(Env env, EffectTemplate template)
+	{
+		super(env, template);
+	}
+
+	
+	@Override
+	public L2EffectType getEffectType()
+	{
+		return L2EffectType.HEAL_PERCENT;
+	}
+	
+	@Override
+	public boolean onStart()
+	{
+		L2Character target = getEffected();
+		if (target == null || target.isDead() || target instanceof L2DoorInstance)
+			return false;
+		
+		StatusUpdate su = new StatusUpdate(target);
+		double amount = 0;
+		double power = calc();
+		boolean full = (power == 100.0);
+		
+		if (full)
+			amount = target.getMaxHp();
+		else
+			amount = target.getMaxHp() * power / 100.0;
+		
+		amount = Math.min(amount, target.getMaxRecoverableHp() - target.getCurrentHp());
+		
+		// Prevent negative amounts
+		if (amount < 0)
+			amount = 0;
+		
+		// To prevent -value heals, set the value only if current hp is less than max recoverable.
+		if (target.getCurrentHp() < target.getMaxRecoverableHp())
+			target.setCurrentHp(amount + target.getCurrentHp());
+		
+		SystemMessage sm;
+		if (getEffector().getObjectId() != target.getObjectId())
+		{
+			sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HP_RESTORED_BY_C1);
+			sm.addCharName(getEffector());
+		}
+		else
+			sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HP_RESTORED);
+		
+		sm.addNumber((int)amount);
+		target.sendPacket(sm);
+		su.addAttribute(StatusUpdate.CUR_HP, (int) target.getCurrentHp());
+		target.sendPacket(su);
+		
+		return true;
+	}
+	
+	@Override
+	public boolean onActionTime()
+	{
+		return false;
+	}
+}

+ 80 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/EffectManaHealPercent.java

@@ -0,0 +1,80 @@
+/**
+ * 
+ */
+package handlers.effecthandlers;
+
+import com.l2jserver.gameserver.model.L2Effect;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.skills.Env;
+import com.l2jserver.gameserver.templates.effects.EffectTemplate;
+import com.l2jserver.gameserver.templates.skills.L2EffectType;
+
+/**
+ * @author UnAfraid
+ *
+ */
+public class EffectManaHealPercent extends L2Effect
+{
+	public EffectManaHealPercent(Env env, EffectTemplate template)
+	{
+		super(env, template);
+	}
+	
+	@Override
+	public L2EffectType getEffectType()
+	{
+		return L2EffectType.MANAHEAL_PERCENT;
+	}
+	
+	@Override
+	public boolean onStart()
+	{
+		L2Character target = getEffected();
+		if (target == null || target.isDead() || target instanceof L2DoorInstance)
+			return false;
+		StatusUpdate su = new StatusUpdate(target);
+		double amount = 0;
+		double power = calc();
+		boolean full = (power == 100.0);
+		
+		if (full)
+			amount = target.getMaxMp();
+		else
+			amount = target.getMaxMp() * power / 100.0;
+		
+		amount = Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp());
+		
+		// Prevent negative amounts
+		if (amount < 0)
+			amount = 0;
+		
+		// To prevent -value heals, set the value only if current mp is less than max recoverable.
+		if (target.getCurrentMp() < target.getMaxRecoverableMp())
+			target.setCurrentMp(amount + target.getCurrentMp());
+		
+		SystemMessage sm;
+		if (getEffector().getObjectId() != target.getObjectId())
+		{
+			sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_RESTORED_BY_C1);
+			sm.addCharName(getEffector());
+		}
+		else
+			sm = SystemMessage.getSystemMessage(SystemMessageId.S1_MP_RESTORED);
+		sm.addNumber((int) amount);
+		target.sendPacket(sm);
+		su.addAttribute(StatusUpdate.CUR_MP, (int) target.getCurrentMp());
+		target.sendPacket(su);
+		
+		return true;
+	}
+	
+	@Override
+	public boolean onActionTime()
+	{
+		return false;
+	}
+}

+ 13 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/skillhandlers/Dummy.java

@@ -41,6 +41,7 @@ public class Dummy implements ISkillHandler
 	 * 
 	 * @see com.l2jserver.gameserver.handler.ISkillHandler#useSkill(com.l2jserver.gameserver.model.actor.L2Character, com.l2jserver.gameserver.model.L2Skill, com.l2jserver.gameserver.model.L2Object[])
 	 */
+	@Override
 	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
 	{
 		if (!(activeChar instanceof L2PcInstance))
@@ -56,6 +57,17 @@ public class Dummy implements ISkillHandler
 					useBlockCheckerSkill((L2PcInstance)activeChar, skill, obj);
 				break;
 			}
+			default:
+			{
+				if (skill.hasEffects())
+				{
+					for (L2Character cha : (L2Character[]) targets)
+					{
+						skill.getEffects(activeChar, cha);
+					}
+				}
+				break;
+			}
 		}
 	}
 	
@@ -63,6 +75,7 @@ public class Dummy implements ISkillHandler
 	 * 
 	 * @see com.l2jserver.gameserver.handler.ISkillHandler#getSkillIds()
 	 */
+	@Override
 	public L2SkillType[] getSkillIds()
 	{
 		return SKILL_IDS;