From 377d93062a1335e9a19b034988696e55690f4979 Mon Sep 17 00:00:00 2001 From: aPunch Date: Tue, 21 Feb 2012 01:43:42 -0600 Subject: [PATCH] changes to reforge calculations --- src/net/apunch/blacksmith/BlacksmithCharacter.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/net/apunch/blacksmith/BlacksmithCharacter.java b/src/net/apunch/blacksmith/BlacksmithCharacter.java index 90ad265..5d162a7 100644 --- a/src/net/apunch/blacksmith/BlacksmithCharacter.java +++ b/src/net/apunch/blacksmith/BlacksmithCharacter.java @@ -164,11 +164,15 @@ public class BlacksmithCharacter extends Character { } } // Damage the item - if (random.nextInt(3) == 0) { - reforge.setDurability(reforge.getDurability() + reforge.getDurability() * random.nextInt(3) < reforge - .getType().getMaxDurability() ? (short) (reforge.getDurability() + reforge.getDurability() - * random.nextInt(3)) : (short) (reforge.getType().getMaxDurability() - 10)); - } + short durability = (short) (reforge.getDurability() + reforge.getDurability() * random.nextInt(5)); + System.out.println("durability: " + durability); + short maxDurability = reforge.getType().getMaxDurability(); + if (durability <= 0) + durability = (short) (maxDurability / 3); + else if (reforge.getDurability() + durability > maxDurability) + durability = (short) (maxDurability - random.nextInt(maxDurability - 25)); + System.out.println("durabilityModified: " + durability); + reforge.setDurability((short) (durability)); return false; } int chance = 50;