From c748e0b7b5f687b30e2fac44835edd8018cfec37 Mon Sep 17 00:00:00 2001 From: Sn0wStorm Date: Sun, 1 Sep 2013 18:58:51 +0200 Subject: [PATCH] Reduced Difficulty for small Ingredient amounts --- src/com/dre/brewery/BIngredients.java | 4 ++-- src/com/dre/brewery/BRecipe.java | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/com/dre/brewery/BIngredients.java b/src/com/dre/brewery/BIngredients.java index b85c967..cc9930a 100644 --- a/src/com/dre/brewery/BIngredients.java +++ b/src/com/dre/brewery/BIngredients.java @@ -226,7 +226,7 @@ public class BIngredients { badStuff++; if (badStuff < ingredients.size()) { // when there are other ingredients - quality -= count * 2; + quality -= count * (recipe.getDifficulty() / 2); continue; } else { // ingredients dont fit at all @@ -234,7 +234,7 @@ public class BIngredients { } } // calculate the quality - quality -= (((float) Math.abs(count - recipe.amountOf(ingredient)) / recipe.allowedCountDiff(recipe.amountOf(ingredient))) * 10.0); + quality -= ((float) Math.abs(count - recipe.amountOf(ingredient)) / recipe.allowedCountDiff(recipe.amountOf(ingredient))) * 10.0; } if (quality >= 0) { return Math.round(quality); diff --git a/src/com/dre/brewery/BRecipe.java b/src/com/dre/brewery/BRecipe.java index bc5415b..e5f8bb3 100644 --- a/src/com/dre/brewery/BRecipe.java +++ b/src/com/dre/brewery/BRecipe.java @@ -47,7 +47,11 @@ public class BRecipe { for (String effectString : effectStringList) { String[] effectSplit = effectString.split("/"); String effect = effectSplit[0]; - if (effect.equalsIgnoreCase("WEAKNESS") || effect.equalsIgnoreCase("INCREASE_DAMAGE") || effect.equalsIgnoreCase("SLOW") || effect.equalsIgnoreCase("SPEED") || effect.equalsIgnoreCase("REGERATION")) { + if (effect.equalsIgnoreCase("WEAKNESS") || + effect.equalsIgnoreCase("INCREASE_DAMAGE") || + effect.equalsIgnoreCase("SLOW") || + effect.equalsIgnoreCase("SPEED") || + effect.equalsIgnoreCase("REGENERATION")) { // hide these effects as they put crap into lore effect = effect + "X"; } @@ -62,6 +66,9 @@ public class BRecipe { // allowed deviation to the recipes count of ingredients at the given difficulty public int allowedCountDiff(int count) { + if (count < 8) { + count = 8; + } int allowedCountDiff = Math.round((float) ((11.0 - difficulty) * (count / 10.0))); if (allowedCountDiff == 0) {