Add project files.
This commit is contained in:
31
RPGLibrary.Implementation/Character.cs
Normal file
31
RPGLibrary.Implementation/Character.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using RPGLibrary.Abstraction.Character;
|
||||
|
||||
namespace RPGLibrary.Implementation
|
||||
{
|
||||
public class Character : ICharacter
|
||||
{
|
||||
public Character(string name, HP hp, StrengthAttribute strength, DefenseAttribute defense)
|
||||
{
|
||||
Name = name;
|
||||
HP = hp;
|
||||
Strength = strength;
|
||||
Defense = defense;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public HP HP { get; private set; }
|
||||
|
||||
public StrengthAttribute Strength { get; }
|
||||
|
||||
public DefenseAttribute Defense { get; }
|
||||
|
||||
public override string? ToString()
|
||||
{
|
||||
return $"{HP}, {Strength}, {Defense}";
|
||||
}
|
||||
|
||||
public ICharacter With(HP hp) => new Character(Name, hp, Strength, Defense);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user