瀏覽代碼

2 New effects
* MaxHp
* MaxCp
Both support diff and per
Fix problem while increase and then regenerate hp
Require core!

Zealar 10 年之前
父節點
當前提交
f83f916a7f

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

@@ -119,6 +119,8 @@ public final class EffectMasterHandler
 		ManaHealByLevel.class,
 		ManaHealOverTime.class,
 		ManaHealPercent.class,
+		MaxCp.class,
+		MaxHp.class,
 		MpConsumePerLevel.class,
 		Mute.class,
 		NoblesseBless.class,

+ 104 - 0
L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/MaxCp.java

@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2004-2015 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.enums.EffectCalculationType;
+import com.l2jserver.gameserver.model.StatsSet;
+import com.l2jserver.gameserver.model.actor.stat.CharStat;
+import com.l2jserver.gameserver.model.conditions.Condition;
+import com.l2jserver.gameserver.model.effects.AbstractEffect;
+import com.l2jserver.gameserver.model.skills.BuffInfo;
+import com.l2jserver.gameserver.model.stats.Stats;
+import com.l2jserver.gameserver.model.stats.functions.FuncAdd;
+import com.l2jserver.gameserver.model.stats.functions.FuncMul;
+
+/**
+ * @author Zealar
+ */
+public final class MaxCp extends AbstractEffect
+{
+	private final double _power;
+	private final EffectCalculationType _type;
+	private final boolean _heal;
+	
+	public MaxCp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
+	{
+		super(attachCond, applyCond, set, params);
+		
+		_power = 1 + (params.getInt("power", 0) / 100.0);
+		_type = params.getEnum("type", EffectCalculationType.class, EffectCalculationType.DIFF);
+		_heal = params.getBoolean("heal", false);
+		
+		if (params.isEmpty())
+		{
+			_log.warning(getClass().getSimpleName() + ": must have parameters.");
+		}
+	}
+	
+	@Override
+	public void onStart(BuffInfo info)
+	{
+		final CharStat charStat = info.getEffected().getStat();
+		
+		synchronized (charStat)
+		{
+			final double currentCp = info.getEffected().getCurrentCp();
+			switch (_type)
+			{
+				case DIFF:
+				{
+					charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_CP, 1, null, _power, null));
+				}
+				case PER:
+				{
+					charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_CP, 1, null, _power, null));
+					break;
+				}
+			}
+			
+			if (_heal)
+			{
+				info.getEffected().setCurrentCp((currentCp * _power));
+			}
+		}
+	}
+	
+	@Override
+	public void onExit(BuffInfo info)
+	{
+		final CharStat charStat = info.getEffected().getStat();
+		synchronized (charStat)
+		{
+			switch (_type)
+			{
+				case DIFF:
+				{
+					charStat.getActiveChar().removeStatFunc(new FuncAdd(Stats.MAX_CP, 1, null, _power, null));
+					break;
+				}
+				case PER:
+				{
+					charStat.getActiveChar().removeStatFunc(new FuncMul(Stats.MAX_CP, 1, null, _power, null));
+					break;
+				}
+			}
+		}
+	}
+	
+}

+ 104 - 0
L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/MaxHp.java

@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2004-2015 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.enums.EffectCalculationType;
+import com.l2jserver.gameserver.model.StatsSet;
+import com.l2jserver.gameserver.model.actor.stat.CharStat;
+import com.l2jserver.gameserver.model.conditions.Condition;
+import com.l2jserver.gameserver.model.effects.AbstractEffect;
+import com.l2jserver.gameserver.model.skills.BuffInfo;
+import com.l2jserver.gameserver.model.stats.Stats;
+import com.l2jserver.gameserver.model.stats.functions.FuncAdd;
+import com.l2jserver.gameserver.model.stats.functions.FuncMul;
+
+/**
+ * @author Zealar
+ */
+public final class MaxHp extends AbstractEffect
+{
+	private final double _power;
+	private final EffectCalculationType _type;
+	private final boolean _heal;
+	
+	public MaxHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
+	{
+		super(attachCond, applyCond, set, params);
+		
+		_power = 1 + (params.getInt("power", 0) / 100.0);
+		_type = params.getEnum("type", EffectCalculationType.class, EffectCalculationType.DIFF);
+		_heal = params.getBoolean("heal", false);
+		
+		if (params.isEmpty())
+		{
+			_log.warning(getClass().getSimpleName() + ": must have parameters.");
+		}
+	}
+	
+	@Override
+	public void onStart(BuffInfo info)
+	{
+		final CharStat charStat = info.getEffected().getStat();
+		
+		synchronized (charStat)
+		{
+			final double currentHp = info.getEffected().getCurrentHp();
+			switch (_type)
+			{
+				case DIFF:
+				{
+					charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_HP, 1, null, _power, null));
+				}
+				case PER:
+				{
+					charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_HP, 1, null, _power, null));
+					break;
+				}
+			}
+			
+			if (_heal)
+			{
+				info.getEffected().setCurrentHp((currentHp * _power));
+			}
+		}
+	}
+	
+	@Override
+	public void onExit(BuffInfo info)
+	{
+		final CharStat charStat = info.getEffected().getStat();
+		synchronized (charStat)
+		{
+			switch (_type)
+			{
+				case DIFF:
+				{
+					charStat.getActiveChar().removeStatFunc(new FuncAdd(Stats.MAX_HP, 1, null, _power, null));
+					break;
+				}
+				case PER:
+				{
+					charStat.getActiveChar().removeStatFunc(new FuncMul(Stats.MAX_HP, 1, null, _power, null));
+					break;
+				}
+			}
+		}
+	}
+	
+}

+ 9 - 12
L2J_DataPack/dist/game/data/stats/skills/00100-00199.xml

@@ -674,10 +674,9 @@
 	</skill>
 	<skill id="121" levels="6" name="Battle Roar" enchantGroup1="1" enchantGroup2="1">
 		<table name="#abnormalLvls"> 1 2 3 4 5 6 </table>
-		<table name="#amount"> 10 15 20 25 30 35 </table>
+		<table name="#power"> 10 15 20 25 30 35 </table>
 		<table name="#effectPoints"> 268 379 467 549 597 635 </table>
 		<table name="#magicLvl"> 28 40 49 58 64 70 </table>
-		<table name="#maxHp"> 1.1 1.15 1.2 1.25 1.3 1.35 </table>
 		<table name="#mpConsume"> 13 18 22 27 30 33 </table>
 		<table name="#ench1Reuse"> 148000 145000 143000 140000 138000 135000 133000 130000 128000 125000 123000 120000 118000 115000 113000 110000 108000 105000 103000 100000 98000 95000 93000 90000 88000 85000 83000 80000 78000 75000 </table>
 		<table name="#ench2pAtk"> 1 1 1 2 2 2 3 3 3 4 4 4 4 5 5 5 6 6 6 7 7 7 7 8 8 8 9 9 9 10 </table>
@@ -698,20 +697,18 @@
 		<enchant1 name="reuseDelay" val="#ench1Reuse" />
 		<enchant2 name="magicLvl" val="#enchMagicLvl" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="#maxHp" />
-			</effect>
-			<effect name="HealPercent">
-				<param power="#amount" />
+			<effect name="MaxHp">
+				<param power="#power" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
 		</for>
 		<enchant2for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.35" />
-				<add stat="pAtk" val="#ench2pAtk" />
-			</effect>
-			<effect name="HealPercent">
+			<effect name="MaxHp">
 				<param power="35" />
+				<param type="PER" />
+				<param heal="true" />
+				<add stat="pAtk" val="#ench2pAtk" />
 			</effect>
 		</enchant2for>
 	</skill>

+ 4 - 5
L2J_DataPack/dist/game/data/stats/skills/00700-00799.xml

@@ -364,12 +364,14 @@
 		<set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
 		<set name="targetType" val="SERVITOR" />
 		<for>
-			<effect name="Buff">
+			<effect name="MaxHp">
+				<param power="20" />
+				<param type="PER" />
+				<param heal="true" />
 				<mul stat="rCrit" val="1.2" />
 				<mul stat="pAtk" val="1.1" />
 				<mul stat="cAtk" val="1.2" />
 				<mul stat="pAtkSpd" val="1.2" />
-				<mul stat="maxHp" val="1.2" />
 				<mul stat="runSpd" val="0.8" />
 				<add stat="accCombat" val="4" />
 				<mul stat="pDef" val="1.2" />
@@ -378,9 +380,6 @@
 				<mul stat="mAtkSpd" val="1.2" />
 				<sub stat="debuffVuln" val="20" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="20" />
-			</effect>
 		</for>
 	</skill>
 	<skill id="713" levels="1" name="Divine Summoner Servitor Hill">

+ 17 - 22
L2J_DataPack/dist/game/data/stats/skills/01300-01399.xml

@@ -344,10 +344,9 @@
 	</skill>
 	<skill id="1311" levels="6" name="Body Of Avatar" enchantGroup1="1" enchantGroup2="1">
 		<table name="#abnormalLvls"> 1 2 3 4 5 6 </table>
-		<table name="#amount"> 10 15 20 25 30 35 </table>
+		<table name="#MaxHp"> 10 15 20 25 30 35 </table>
 		<table name="#effectPoints"> 457 532 566 597 624 646 </table>
 		<table name="#magicLvl"> 48 56 60 64 68 72 </table>
-		<table name="#maxHp"> 1.1 1.15 1.2 1.25 1.3 1.35 </table>
 		<table name="#mpConsume"> 273 326 352 378 402 424 </table>
 		<table name="#mpInitialConsume"> 69 82 88 95 101 106 </table>
 		<table name="#ench1AbnormalTimes"> 1240 1280 1320 1360 1400 1440 1480 1520 1560 1600 1640 1680 1720 1760 1800 1840 1880 1920 1960 2000 2040 2080 2120 2160 2200 2240 2280 2320 2360 2400 </table>
@@ -375,11 +374,10 @@
 		<enchant2 name="mpConsume" val="#ench2MpConsume" />
 		<enchant2 name="mpInitialConsume" val="#ench2mpInitialConsume" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="#maxHp" />
-			</effect>
-			<effect name="HealPercent">
-				<param power="#amount" />
+			<effect name="MaxHp">
+				<param power="#MaxHp" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
 		</for>
 	</skill>
@@ -1555,12 +1553,14 @@
 		<enchant2 name="mpConsume" val="#ench2mpConsume" />
 		<enchant2 name="mpInitialConsume" val="#ench2mpInitialConsume" />
 		<for>
-			<effect name="Buff">
+			<effect name="MaxHp">
+				<param power="20" />
+				<param type="PER" />
+				<param heal="true" />
 				<mul stat="rCrit" val="1.2" />
 				<mul stat="pAtk" val="1.1" />
 				<mul stat="cAtk" val="1.2" />
 				<mul stat="pAtkSpd" val="1.2" />
-				<mul stat="maxHp" val="1.2" />
 				<mul stat="runSpd" val="0.8" />
 				<add stat="accCombat" val="4" />
 				<mul stat="pDef" val="1.2" />
@@ -1569,9 +1569,6 @@
 				<mul stat="mAtkSpd" val="1.2" />
 				<sub stat="debuffVuln" val="20" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="20" />
-			</effect>
 		</for>
 	</skill>
 	<skill id="1350" levels="1" name="Warrior Bane">
@@ -2133,8 +2130,10 @@
 		<enchant2 name="mpInitialConsume" val="#ench2mpInitialConsume" />
 		<enchant3 name="magicLvl" val="#enchMagicLvl" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.2" />
+			<effect name="MaxHp">
+				<param power="20" />
+				<param type="PER" />
+				<param heal="true" />
 				<add stat="mCritRate" val="2" />
 				<mul stat="cAtk" val="1.2" />
 				<mul stat="pAtk" val="1.1" />
@@ -2147,13 +2146,12 @@
 				<add stat="accCombat" val="4" />
 				<mul stat="runSpd" val="0.8" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="20" />
-			</effect>
 		</for>
 		<enchant3for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.2" />
+			<effect name="MaxHp">
+				<param power="20" />
+				<param type="PER" />
+				<param heal="true" />
 				<add stat="mCritRate" val="2" />
 				<mul stat="cAtk" val="1.2" />
 				<mul stat="pAtk" val="1.1" />
@@ -2166,9 +2164,6 @@
 				<add stat="accCombat" val="4" />
 				<mul stat="runSpd" val="#ench3Spd" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="20" />
-			</effect>
 		</enchant3for>
 	</skill>
 	<skill id="1364" levels="1" name="Eye of Pa'agrio" enchantGroup1="5" enchantGroup2="5">

+ 5 - 7
L2J_DataPack/dist/game/data/stats/skills/01500-01599.xml

@@ -1893,9 +1893,8 @@
 	<skill id="1561" levels="5" name="Battle Cry">
 		<!-- High Five Skill -->
 		<table name="#abnormalLvls"> 2 3 4 5 6 </table>
-		<table name="#amount"> 15 20 25 30 35 </table>
+		<table name="#MaxHp"> 15 20 25 30 35 </table>
 		<table name="#magicLvl"> 40 49 58 64 70 </table>
-		<table name="#maxHp"> 1.15 1.2 1.25 1.3 1.35 </table>
 		<table name="#mpConsume"> 18 22 27 30 33 </table>
 		<set name="abnormalLvl" val="#abnormalLvls" />
 		<set name="abnormalTime" val="600" />
@@ -1910,11 +1909,10 @@
 		<set name="rideState" val="NONE" />
 		<set name="targetType" val="SELF" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="#maxHp" />
-			</effect>
-			<effect name="HealPercent">
-				<param power="#amount" />
+			<effect name="MaxHp">
+				<param power="#MaxHp" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
 		</for>
 	</skill>

+ 3 - 4
L2J_DataPack/dist/game/data/stats/skills/03100-03199.xml

@@ -685,11 +685,10 @@
 		<set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
 		<set name="targetType" val="SELF" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.03" />
-			</effect>
-			<effect name="HealPercent">
+			<effect name="MaxHp">
 				<param power="3" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
 		</for>
 	</skill>

+ 5 - 5
L2J_DataPack/dist/game/data/stats/skills/04000-04099.xml

@@ -1747,8 +1747,7 @@
 		<!-- Confirmed CT2.5 -->
 		<table name="#accCombat"> 3 7 7 </table>
 		<table name="#magicLvl"> 40 60 75 </table>
-		<table name="#maxHp"> 1.14 1.21 1.21 </table>
-		<table name="#maxHpHeal"> 14 21 21 </table>
+		<table name="#MaxHp"> 14 21 21 </table>
 		<table name="#mpConsume"> 18 18 19 </table>
 		<table name="#pAtk"> 1.05 1.15 1.15 </table>
 		<table name="#pDef"> 1.1 1.3 1.3 </table>
@@ -1771,12 +1770,13 @@
 				<mul stat="runSpd" val="#runSpd" />
 				<mul stat="pAtk" val="#pAtk" />
 				<mul stat="pDef" val="#pDef" />
-				<mul stat="maxHp" val="#maxHp" />
 				<sub stat="rEvas" val="#rEvas" />
 				<add stat="accCombat" val="#accCombat" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="#maxHpHeal" />
+			<effect name="MaxHp">
+				<param power="#MaxHp" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
 		</for>
 	</skill>

+ 3 - 4
L2J_DataPack/dist/game/data/stats/skills/04500-04599.xml

@@ -313,11 +313,10 @@
 		<set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
 		<set name="targetType" val="ONE" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.3" />
-			</effect>
-			<effect name="HealPercent">
+			<effect name="MaxHp">
 				<param power="30" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
 		</for>
 	</skill>

+ 4 - 5
L2J_DataPack/dist/game/data/stats/skills/07000-07099.xml

@@ -961,8 +961,10 @@
 		<set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
 		<set name="targetType" val="ONE" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.2" />
+			<effect name="MaxHp">
+				<param power="20" />
+				<param type="PER" />
+				<param heal="true" />
 				<add stat="mCritRate" val="2" />
 				<mul stat="cAtk" val="1.2" />
 				<mul stat="pAtk" val="1.1" />
@@ -975,9 +977,6 @@
 				<add stat="accCombat" val="4" />
 				<mul stat="runSpd" val="0.8" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="20" />
-			</effect>
 		</for>
 	</skill>
 	<skill id="7065" levels="1" name="Test - Charge">

+ 7 - 7
L2J_DataPack/dist/game/data/stats/skills/20000-20099.xml

@@ -85,15 +85,15 @@
 		<set name="rideState" val="NONE" />
 		<set name="targetType" val="SELF" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.15" />
-				<mul stat="maxCp" val="1.15" />
-			</effect>
-			<effect name="CpHealPercent">
+			<effect name="MaxHp">
 				<param power="15" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="15" />
+			<effect name="MaxCp">
+				<param power="20" />
+				<param type="PER" />
+				<param heal="true" />
 			</effect>
 		</for>
 	</skill>

+ 4 - 5
L2J_DataPack/dist/game/data/stats/skills/23200-23299.xml

@@ -1198,8 +1198,10 @@
 		<set name="rideState" val="NONE" />
 		<set name="targetType" val="AURA" />
 		<for>
-			<effect name="Buff">
-				<mul stat="maxHp" val="1.2" />
+			<effect name="MaxHp">
+				<param power="20" />
+				<param type="PER" />
+				<param heal="true" />
 				<add stat="mCritRate" val="2" />
 				<mul stat="cAtk" val="1.2" />
 				<mul stat="pAtk" val="1.1" />
@@ -1212,9 +1214,6 @@
 				<add stat="accCombat" val="4" />
 				<mul stat="runSpd" val="0.8" />
 			</effect>
-			<effect name="HealPercent">
-				<param power="20" />
-			</effect>
 		</for>
 	</skill>
 	<skill id="23277" levels="1" name="Master's Blessing - Improve Combat">

+ 8 - 0
L2J_DataPack/dist/game/data/xsd/skills.xsd

@@ -138,11 +138,19 @@
 		<xs:attribute type="xs:byte" name="addName" use="optional" />
 		<xs:attribute type="xs:string" name="msg" use="optional" />
 	</xs:complexType>
+	<xs:simpleType name="operation">
+		<xs:restriction base="xs:string">
+			<xs:enumeration value="DIFF" />
+			<xs:enumeration value="PER" />
+		</xs:restriction>
+	</xs:simpleType>
 	<xs:complexType name="paramType">
 		<xs:simpleContent>
 			<xs:extension base="xs:string">
 				<xs:attribute type="xs:string" name="chance" use="optional" />
 				<xs:attribute type="xs:string" name="power" use="optional" />
+				<xs:attribute type="operation" name="type" use="optional" />
+				<xs:attribute type="xs:boolean" name="heal" use="optional" />
 				<xs:attribute type="xs:byte" name="criticalChance" use="optional" />
 				<xs:attribute type="xs:string" name="charge" use="optional" />
 				<xs:attribute type="xs:byte" name="cubicId" use="optional" />