public static int FoodAmountNeeded(Species species, int level, double tamingSpeedMultiplier, string foodName, bool nonViolent = false) { if (species != null) { double affinityNeeded = species.taming.affinityNeeded0 + species.taming.affinityIncreasePL * level; bool specialFood = species.taming.specialFoodValues != null && species.taming.specialFoodValues.ContainsKey(foodName); if (!specialFood && !Values.V.defaultFoodData.ContainsKey(foodName)) { return(0); } TamingFood food = specialFood ? species.taming.specialFoodValues[foodName] : Values.V.defaultFoodData[foodName]; double foodAffinity; foodAffinity = food.affinity; if (nonViolent) { foodAffinity *= species.taming.wakeAffinityMult; } foodAffinity *= tamingSpeedMultiplier * 2; // *2 in accordance with the permament 2x taming-bonus that was introduced in the game on 2016-12-12 if (foodAffinity > 0) { // amount of food needed for the affinity int quantity = food.quantity; if (quantity < 1) { quantity = 1; } return((int)Math.Ceiling(affinityNeeded / (foodAffinity * quantity))); } } return(0); }