public IEnumerable <Action> Do(HeroController controller, TurnState turn, TacticScore tacticScore) { var healingPotions = turn.Game.Items .Where(x => x.IsPotion == 1 && x.Health > 0 && x.ItemCost <= turn.Gold) .OrderByDescending(x => x.Health) .ToList(); yield return(() => controller.Buy(healingPotions.First().ItemName, "Ahh that's better. Come on!")); }
public IEnumerable <Action> Do(HeroController controller, TurnState turn, TacticScore tacticScore) { IEnumerable <Item> itemsIWant = turn.My.Hero.IsRanged ? turn.Game.Items.Where(x => x.IsPotion == 0 && x.Damage > 0 && x.ItemCost <= turn.Gold).ToList() : turn.Game.Items.Where(x => x.IsPotion == 0 && x.Health > 0 && x.ItemCost <= turn.Gold).ToList(); foreach (var item in itemsIWant) { yield return(() => controller.Buy(item.ItemName, "Ho ho ho.")); } }