public override float ComputeRating() { if (Raider.Self.Gold < 2) { return(NULL_RATING); } var self = Raider.Self; float distanceToTavern = Raider.DistanceToNextTavern(); float distanceToMine = Raider.DistanceToNextMine(); float distanceMod = Sigmoid(0.2f * (distanceToMine - distanceToTavern)); float income = 0.5f + 0.5f * self.MineRatio; float scared = 0.5f + 0.5f * Raider.GetThreat(5); //Range 0..1 float drinkValue = income * scared * distanceMod * Linstep(MAX_HP, MAX_HP - HP_PER_BEER, self.Life); //if drinking and no mine close fill HP up if (distanceToTavern == 1 && distanceToMine > 3 && self.Life < MAX_HP - 10) { drinkValue = 1; } return(base.ComputeRating() * drinkValue); }