diff --git a/PeopleVille/Equipment/Food.cs b/PeopleVille/Equipment/Food.cs index 7610688..4046156 100644 --- a/PeopleVille/Equipment/Food.cs +++ b/PeopleVille/Equipment/Food.cs @@ -20,7 +20,7 @@ namespace PeopleVille.Equipment public void Use(Person person) { person.Health += HealthPoints; - Console.WriteLine($"{person.Name} ate food and healed {HealthPoints}"); + Console.WriteLine($"{person.Name} spiste og healede {HealthPoints}"); person.Inventory.Remove(this); } } diff --git a/PeopleVille/Location/Bank.cs b/PeopleVille/Location/Bank.cs index f153f79..1c9714e 100644 --- a/PeopleVille/Location/Bank.cs +++ b/PeopleVille/Location/Bank.cs @@ -1,7 +1,14 @@ +using PeopleVille.Persons; + namespace PeopleVille.Locations { public class Bank : Location { - + public override void UseLocation(Person person) + { + int amount = RNG.Range(100, 501); + person.Money += amount; + Console.WriteLine($"{person.Name} hæver {amount} kr. i {Name}"); + } } } \ No newline at end of file diff --git a/PeopleVille/Location/EggStore.cs b/PeopleVille/Location/EggStore.cs index 6822768..384c3c0 100644 --- a/PeopleVille/Location/EggStore.cs +++ b/PeopleVille/Location/EggStore.cs @@ -1,7 +1,24 @@ +using PeopleVille.Equipment; +using PeopleVille.Persons; + namespace PeopleVille.Locations { public class EggStore : Store { - + public override void UseLocation(Person person) + { + if (person.Money >= 100) + { + person.Money -= 100; + person.Inventory.Add(new Food { Name = "Bakke Æg", HealthPoints = 60 }); + Console.WriteLine($"{person.Name} køber Bakke Æg for 100 kr. i {Name}"); + } + else if (person.Money >= 20) + { + person.Money -= 20; + person.Inventory.Add(new Food { Name = "Æg", HealthPoints = 10 }); + Console.WriteLine($"{person.Name} køber Æg for 20 kr. i {Name}"); + } + } } } \ No newline at end of file diff --git a/PeopleVille/Location/GunStore.cs b/PeopleVille/Location/GunStore.cs index 31365f7..241b161 100644 --- a/PeopleVille/Location/GunStore.cs +++ b/PeopleVille/Location/GunStore.cs @@ -1,7 +1,43 @@ +using PeopleVille.Equipment; +using PeopleVille.Persons; + namespace PeopleVille.Locations { public class GunStore : Store { + public GunStore() + { + Inventory = new Dictionary + { + { new Gun { Name = "Pistol", Damage = 15 }, 200 }, + { new Gun { Name = "Riffel", Damage = 30 }, 500 }, + { new Gun { Name = "Shotgun", Damage = 50 }, 800 }, + }; + } + public override void UseLocation(Person person) + { + if (person.Inventory.OfType().Any()) + return; + + if (person.Money >= 800) + { + person.Money -= 800; + person.Inventory.Add(new Gun { Name = "Shotgun", Damage = 50 }); + Console.WriteLine($"{person.Name} køber Shotgun for 800 kr. i {Name}"); + } + else if (person.Money >= 500) + { + person.Money -= 500; + person.Inventory.Add(new Gun { Name = "Riffel", Damage = 30 }); + Console.WriteLine($"{person.Name} køber Riffel for 500 kr. i {Name}"); + } + else if (person.Money >= 200) + { + person.Money -= 200; + person.Inventory.Add(new Gun { Name = "Pistol", Damage = 15 }); + Console.WriteLine($"{person.Name} køber Pistol for 200 kr. i {Name}"); + } + } } } \ No newline at end of file diff --git a/PeopleVille/Person/AdultCitizen.cs b/PeopleVille/Person/AdultCitizen.cs index d437109..37c2627 100644 --- a/PeopleVille/Person/AdultCitizen.cs +++ b/PeopleVille/Person/AdultCitizen.cs @@ -58,7 +58,7 @@ namespace PeopleVille.Persons var otherLocations = World.Locations.Where(x => x != CurrentLocation).ToList(); if (otherLocations.Count > 0) Walk(otherLocations[RNG.ThrowDice(new Die(otherLocations.Count)) - 1]); - Console.WriteLine($"{Name} Walked to {CurrentLocation.Name}"); + Console.WriteLine($"{Name} Gik hen til {CurrentLocation.Name}"); break; case 3: //Do nothing