UseLocation methods, and text updated.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,43 @@
|
||||
using PeopleVille.Equipment;
|
||||
using PeopleVille.Persons;
|
||||
|
||||
namespace PeopleVille.Locations
|
||||
{
|
||||
public class GunStore : Store
|
||||
{
|
||||
public GunStore()
|
||||
{
|
||||
Inventory = new Dictionary<object, int>
|
||||
{
|
||||
{ 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<Gun>().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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user