internal static void PrintBodyPartsStat(IInhabitant inhabitant) { foreach (var bodyPart in inhabitant.Body) { ConsoleHelper.LogMessage("{0}: Health - {1}/{2}hp, Defense - {3} ", bodyPart.Title, bodyPart.Health, bodyPart.MaxHealth, bodyPart.Defense); } }
public void Run() { string input = Console.ReadLine(); var inhabitants = new List <IInhabitant>(); while (input != "End") { IInhabitant inhabitant = inhabitantFactory.CreateInhabitant(input); inhabitants.Add(inhabitant); input = Console.ReadLine(); } input = Console.ReadLine(); foreach (var item in inhabitants) { if (item.Id.EndsWith($"{input}")) { Console.WriteLine(item.Id); } } }
internal static int GetTotalHealth(IInhabitant inhabitant) { return(inhabitant.Body.Sum(x => x.Health)); }