瀏覽代碼

BETA: Unhardcoded !calcBlowSuccess and minor improvements.

	Reviewed by: Zoey76
Adry_85 12 年之前
父節點
當前提交
76f7e95fb4

+ 2 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/stat/CharStat.java

@@ -181,12 +181,7 @@ public class CharStat
 		
 		int criticalHit = (int) calcStat(Stats.CRITICAL_RATE, _activeChar.getTemplate().getBaseCritRate(), target, skill);
 		// Set a cap of Critical Hit at 500
-		if (criticalHit > Config.MAX_PCRIT_RATE)
-		{
-			criticalHit = Config.MAX_PCRIT_RATE;
-		}
-		
-		return criticalHit;
+		return Math.min(criticalHit, Config.MAX_PCRIT_RATE);
 	}
 	
 	/**
@@ -198,7 +193,6 @@ public class CharStat
 		{
 			return 1;
 		}
-		
 		return (int) calcStat(Stats.STAT_DEX, _activeChar.getTemplate().getBaseDEX());
 	}
 	
@@ -431,11 +425,7 @@ public class CharStat
 		
 		double mrate = calcStat(Stats.MCRITICAL_RATE, 1, target, skill) * 10;
 		// Set a cap of Magical Critical Hit at 200
-		if (mrate > Config.MAX_MCRIT_RATE)
-		{
-			mrate = Config.MAX_MCRIT_RATE;
-		}
-		return (int) mrate;
+		return (int) Math.min(mrate, Config.MAX_MCRIT_RATE);
 	}
 	
 	/**

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

@@ -20,7 +20,6 @@ package com.l2jserver.gameserver.model.stats;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.Config;
@@ -2355,33 +2354,22 @@ public final class Formulas
 	{
 		int blowChance = skill.getBlowChance();
 		
-		// Skill is blow and it has 0% to make dmg... thats just wrong
-		if (blowChance == 0)
-		{
-			_log.log(Level.WARNING, "Skill " + skill.getId() + " - " + skill.getName() + " has 0 blow land chance, yet its a blow skill!");
-			// TODO: return false;
-			// lets add 20 for now, till all skills are corrected
-			blowChance = 20;
-		}
-		
 		if (isBehind(target, activeChar))
 		{
 			blowChance *= 2; // double chance from behind
 		}
 		else if (isInFrontOf(target, activeChar))
 		{
+			// base chance from front
 			if ((skill.getCondition() & L2Skill.COND_BEHIND) != 0)
 			{
 				return false;
 			}
-			
-			// base chance from front
 		}
 		else
 		{
 			blowChance *= 1.5; // 50% better chance from side
 		}
-		
 		return activeChar.calcStat(Stats.BLOW_RATE, blowChance * (1.0 + ((activeChar.getDEX()) / 100.)), target, null) > Rnd.get(100);
 	}