瀏覽代碼

BETA: Retail-like Support for Weight Limit and Weight Penalty
* Using Retail-Like formula for max weight limit.
* Added new effect weightPenalty to calculate point at which a weight penalty is applied.
* Updated effect maxLoad now called weightPenalty.
* Removed _LOAD field from char_templates.sql.
* Now each Character will have proper weightLimit depending of CON amount.

Thanks '''MELERIX''', '''UnAfraid''' and '''Zoey76''' for help.

Adry_85 13 年之前
父節點
當前提交
36320b56f5

+ 5 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -194,6 +194,7 @@ import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSiegeFlag;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSummon;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillTrap;
 import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
+import com.l2jserver.gameserver.model.stats.BaseStats;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Formulas;
 import com.l2jserver.gameserver.model.stats.Stats;
@@ -2315,14 +2316,10 @@ public final class L2PcInstance extends L2Playable
 	 */
 	public int getMaxLoad()
 	{
-		// Weight Limit = (CON Modifier*69000)*Skills
+		// Weight Limit = (CON Modifier*69000) * Skills
 		// Source http://l2p.bravehost.com/weightlimit.html (May 2007)
-		// Fitted exponential curve to the data
-		int con = getCON();
-		if (con < 1) return 31000;
-		if (con > 59) return 176000;
-		double baseLoad = Math.pow(1.029993928, con)*30495.627366;
-		return (int)calcStat(Stats.MAX_LOAD, baseLoad*Config.ALT_WEIGHT_LIMIT, this, null);
+		double baseLoad = Math.floor(BaseStats.CON.calcBonus(this) * 69000 * Config.ALT_WEIGHT_LIMIT);
+		return (int)calcStat(Stats.WEIGHT_LIMIT, baseLoad, this, null);
 	}
 	
 	public int getExpertiseArmorPenalty()
@@ -2350,8 +2347,7 @@ public final class L2PcInstance extends L2Playable
 		int maxLoad = getMaxLoad();
 		if (maxLoad > 0)
 		{
-			long weightproc = (long)getCurrentLoad() * 1000 / maxLoad;
-			weightproc *= calcStat(Stats.WEIGHT_LIMIT, 1, this, null);
+			long weightproc = (long) ((getCurrentLoad() - calcStat(Stats.WEIGHT_PENALTY, 1, this, null)) * 1000 / maxLoad);
 			int newWeightPenalty;
 			if (weightproc < 500 || _dietMode)
 			{

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java

@@ -1295,8 +1295,7 @@ public class L2PetInstance extends L2Summon
 		int maxLoad = getMaxLoad();
 		if (maxLoad > 0)
 		{
-			int weightproc = getCurrentLoad() * 1000 / maxLoad;
-			weightproc *= (int) calcStat(Stats.WEIGHT_LIMIT, 1, this, null);
+			long weightproc = (long) ((getCurrentLoad() - calcStat(Stats.WEIGHT_PENALTY, 1, this, null)) * 1000 / maxLoad);
 			int newWeightPenalty;
 			if (weightproc < 500 || getOwner().getDietMode())
 			{

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerWeight.java

@@ -42,8 +42,7 @@ public class ConditionPlayerWeight extends Condition
 		final L2PcInstance player = env.getPlayer();
 		if ((player != null) && (player.getMaxLoad() > 0))
 		{
-			int weightproc = (player.getCurrentLoad() * 100) / player.getMaxLoad();
-			weightproc *= (int) player.calcStat(Stats.WEIGHT_LIMIT, 1, player, null);
+			int weightproc = (int) (((player.getCurrentLoad() - player.calcStat(Stats.WEIGHT_PENALTY, 1, player, null)) * 100) / player.getMaxLoad());
 			return (weightproc < _weight) || player.getDietMode();
 		}
 		return true;

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetWeight.java

@@ -45,8 +45,7 @@ public class ConditionTargetWeight extends Condition
 			final L2PcInstance target = targetObj.getActingPlayer();
 			if (!target.getDietMode() && (target.getMaxLoad() > 0))
 			{
-				int weightproc = (target.getCurrentLoad() * 100) / target.getMaxLoad();
-				weightproc *= (int) target.calcStat(Stats.WEIGHT_LIMIT, 1, target, null);
+				int weightproc = (int) (((target.getCurrentLoad() - target.calcStat(Stats.WEIGHT_PENALTY, 1, target, null)) * 100) / target.getMaxLoad());
 				return (weightproc < _weight);
 			}
 		}

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Stats.java

@@ -206,8 +206,8 @@ public enum Stats
 	TRANSFER_DAMAGE_TO_PLAYER("transDamToPlayer"),
 	ABSORB_MANA_DAMAGE_PERCENT("absorbDamMana"),
 	
-	MAX_LOAD("maxLoad"),
 	WEIGHT_LIMIT("weightLimit"),
+	WEIGHT_PENALTY("weightPenalty"),
 	
 	PATK_PLANTS("pAtk-plants"),
 	PATK_INSECTS("pAtk-insects"),