external lib

This commit is contained in:
2026-03-26 14:08:11 +01:00
parent 4315b709cb
commit 25b09b7c0d
6 changed files with 50 additions and 18 deletions

View File

@@ -0,0 +1,23 @@
using PeopleVille.Equipment;
using PeopleVille.Persons;
namespace PeopleVille.Extension.Mod1;
public class Snake : IEquipment
{
public void Equip()
{
throw new NotImplementedException();
}
public void Unequip()
{
throw new NotImplementedException();
}
public void Use(Person person)
{
Console.WriteLine($"{person.Name} brugte en slange, lol");
}
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../PeopleVille/PeopleVille.csproj" />
</ItemGroup>
</Project>

View File

@@ -29,7 +29,7 @@ namespace PeopleVille.Persons
// 50/50 om vi gør noget eller ej
if (RNG.ThrowDice(Dices.D3) == 1)
return;
switch (RNG.ThrowDice(Dices.D3))
switch (RNG.ThrowDice(Dices.D4))
{
case 1:
bool hasGun = Inventory.OfType<Gun>().Any();
@@ -61,6 +61,17 @@ namespace PeopleVille.Persons
Console.WriteLine($"{Name} Gik hen til {CurrentLocation.Name}");
break;
case 3:
try
{
var items = this.Inventory.Where(x => x is not Gun && x is not Food).ToList();
items[RNG.Range(0, items.Count)].Use(this);
} catch
{
Console.WriteLine($"{this.Name} brugte ikke nogle items");
}
break;
case 4:
//Do nothing
break;
}

View File

@@ -24,6 +24,7 @@ var world = new WorldBuilder()
.AddGameManager()
.AddEquipment()
.FromRange([gun, kage])
.FromFolder("/home/smallbenji/school/hf2/HF2-peopleville/PeopleVille.Extension.Mod1/bin/Debug/net10.0")
.AddLocations()
.FromRange(locationBuilder.CreateLocations(15))
.AddPersons()

View File

@@ -39,21 +39,4 @@ namespace PeopleVille.WorldBuilder
IPersonBuilder WithRandomItems(int number);
IWorldBuilder EndWorldBuilding();
}
// public interface ITownBuilder
// {
// ITownBuilder AddGunStore(string name);
// ITownBuilder AddEggStore(string name);
// ITownBuilder AddBank(string name);
// List<Location> BuildTown();
// }
// public interface ICitizenBuilder
// {
// ICitizenBuilder CreateAdult(string name, int health);
// ICitizenBuilder CreateChild(string name, int health);
// ICitizenBuilder WithGun(string name, int damage);
// ICitizenBuilder WithFood(string name, int healthPoints);
// List<Person> BuildCitizens();
// }
}

View File

@@ -1,3 +1,4 @@
<Solution>
<Project Path="PeopleVille.Extension.Mod1/PeopleVille.Extension.Mod1.csproj" />
<Project Path="PeopleVille/PeopleVille.csproj" />
</Solution>