From bf92ee7a3e57c5fc5e735aebb55390047ae11c56 Mon Sep 17 00:00:00 2001 From: Joe0 Date: Thu, 15 Mar 2012 01:25:02 -0500 Subject: [PATCH] Resolves errors being thrown randomly due to divide by 0 --- .../src/org/moparscape/msc/gs/model/mini/Damage.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/GameServer/src/org/moparscape/msc/gs/model/mini/Damage.java b/GameServer/src/org/moparscape/msc/gs/model/mini/Damage.java index ea54c63..a6f35f1 100644 --- a/GameServer/src/org/moparscape/msc/gs/model/mini/Damage.java +++ b/GameServer/src/org/moparscape/msc/gs/model/mini/Damage.java @@ -64,14 +64,23 @@ public class Damage { } public double getRangePortion() { + if (getTotalDamage() == 0) { + return 0; + } return getRangeDamage() / getTotalDamage(); } public double getMagicPortion() { + if (getTotalDamage() == 0) { + return 0; + } return getMagicDamage() / getTotalDamage(); } public double getCombatPortion() { + if (getTotalDamage() == 0) { + return 0; + } return getCombatDamage() / getTotalDamage(); } } \ No newline at end of file