예제 #1
0
  // returns the currently best matching recipe for distilling for the
  // ingredients and cooking time
  public BRecipe getdistillRecipe(float wood, float time) {
    BRecipe bestRecipe = getBestRecipe(wood, time, true);

    // Check if best recipe needs to be destilled
    if (bestRecipe != null) {
      if (bestRecipe.needsDistilling()) {
        return bestRecipe;
      }
    }
    return null;
  }
예제 #2
0
  // returns the quality regarding the cooking-time conditioning given Recipe
  public int getCookingQuality(BRecipe recipe, boolean distilled) {
    if (!recipe.needsDistilling() == distilled) {
      return -1;
    }
    int quality =
        10
            - (int)
                Math.round(
                    ((float) Math.abs(cookedTime - recipe.getCookingTime())
                            / recipe.allowedTimeDiff(recipe.getCookingTime()))
                        * 10.0);

    if (quality >= 0) {
      if (cookedTime <= 1) {
        return 0;
      }
      return quality;
    }
    return -1;
  }
예제 #3
0
 // returns pseudo quality of distilling. 0 if doesnt match the need of the recipes distilling
 public int getDistillQuality(BRecipe recipe, int distillRuns) {
   if (recipe.needsDistilling() != distillRuns > 0) {
     return 0;
   }
   return 10 - Math.abs(recipe.getDistillRuns() - distillRuns);
 }