Reworked Barrel Wood Type

This commit is contained in:
Sn0wStorm
2013-09-05 17:09:20 +02:00
parent a990e91496
commit 8a5f19899c
5 changed files with 124 additions and 68 deletions
+10 -9
View File
@@ -129,7 +129,7 @@ public class BIngredients {
// best recipe for current state of potion, STILL not always returns the
// correct one...
public BRecipe getBestRecipe(byte wood, float time, boolean distilled) {
public BRecipe getBestRecipe(float wood, float time, boolean distilled) {
float quality = 0;
int ingredientQuality = 0;
int cookingQuality = 0;
@@ -141,7 +141,7 @@ public class BIngredients {
cookingQuality = getCookingQuality(recipe, distilled);
if (ingredientQuality > -1 && cookingQuality > -1) {
if (recipe.needsToAge()) {
if (recipe.needsToAge() || time > 0.5) {
// needs riping in barrel
ageQuality = getAgeQuality(recipe, time);
woodQuality = getWoodQuality(recipe, wood);
@@ -172,7 +172,7 @@ public class BIngredients {
// returns recipe that is cooking only and matches the ingredients and
// cooking time
public BRecipe getCookRecipe() {
BRecipe bestRecipe = getBestRecipe((byte) 0, 0, false);
BRecipe bestRecipe = getBestRecipe(0, 0, false);
// Check if best recipe is cooking only
if (bestRecipe != null) {
@@ -185,8 +185,8 @@ public class BIngredients {
// returns the currently best matching recipe for distilling for the
// ingredients and cooking time
public BRecipe getdistillRecipe() {
BRecipe bestRecipe = getBestRecipe((byte) 0, 0, true);
public BRecipe getdistillRecipe(float wood, float time) {
BRecipe bestRecipe = getBestRecipe(wood, time, true);
// Check if best recipe needs to be destilled
if (bestRecipe != null) {
@@ -199,7 +199,7 @@ public class BIngredients {
// returns currently best matching recipe for ingredients, cooking- and
// ageingtime
public BRecipe getAgeRecipe(byte wood, float time, boolean distilled) {
public BRecipe getAgeRecipe(float wood, float time, boolean distilled) {
BRecipe bestRecipe = getBestRecipe(wood, time, distilled);
if (bestRecipe != null) {
@@ -273,12 +273,13 @@ public class BIngredients {
}
// returns the quality regarding the barrel wood conditioning given Recipe
public int getWoodQuality(BRecipe recipe, byte wood) {
if (recipe.getWood() == 0x8) {
public int getWoodQuality(BRecipe recipe, float wood) {
if (recipe.getWood() == 0) {
// type of wood doesnt matter
return 10;
}
int quality = 10 - (recipe.getWoodDiff(wood) * recipe.getDifficulty());
int quality = 10 - Math.round(recipe.getWoodDiff(wood) * recipe.getDifficulty());
P.p.log("wood: " + wood + " needed: " + recipe.getWood() + " diff: " + recipe.getWoodDiff(wood));
if (quality > 0) {
return quality;