forked from Shardstone/trail-into-darkness
25 lines
871 B
C#
25 lines
871 B
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace Nox.Game {
|
|
public interface ICharacterAttributesFactory {
|
|
EntityAttributes Create(EntityAttributes entityAttributes);
|
|
}
|
|
|
|
public sealed class CharacterAttributesFactory : ICharacterAttributesFactory {
|
|
private readonly CharacterRegistry characterRegistry;
|
|
|
|
public CharacterAttributesFactory(CharacterRegistry characterRegistry) {
|
|
this.characterRegistry = characterRegistry;
|
|
}
|
|
|
|
public EntityAttributes Create(EntityAttributes entityAttributes) {
|
|
if(entityAttributes.attributes.Any(a => a.value <= 0)) {
|
|
throw new ArgumentOutOfRangeException( "attributes cannot be zero or negative.", new ArgumentException() );
|
|
}
|
|
//TODO: Handle attributes modifiers and perks
|
|
return entityAttributes;
|
|
}
|
|
}
|
|
}
|