public override float ComputeRating() { var self = Raider.Self; float distanceToNext = Raider.DistanceToNextMine(); float hpAtNextMine = self.Life - distanceToNext; float threat = Raider.GetThreat(5); float needMines = 1.0f - 0.5f * self.MineRatio; //Range 0..1 float mineValue = needMines * (1 - threat) * Step(MINING_MIN_HP, hpAtNextMine); return(base.ComputeRating() * mineValue); }
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); }