forked from Shardstone/trail-into-darkness
24 lines
833 B
C#
24 lines
833 B
C#
using System;
|
|
|
|
namespace Nox.Game {
|
|
public interface ICharacterAttributesFactory {
|
|
EntityAttributes Create(EntityAttributes attributes);
|
|
}
|
|
|
|
public sealed class CharacterAttributesFactory : ICharacterAttributesFactory {
|
|
private readonly CharacterRegistry characterRegistry;
|
|
|
|
public CharacterAttributesFactory(CharacterRegistry characterRegistry) {
|
|
this.characterRegistry = characterRegistry;
|
|
}
|
|
|
|
public EntityAttributes Create(EntityAttributes attributes) {
|
|
if(attributes.might <= 0 || attributes.reflex <= 0 || attributes.knowledge <= 0 || attributes.perception <= 0) {
|
|
throw new ArgumentOutOfRangeException( "attributes cannot be zero or negative.", new ArgumentException() );
|
|
}
|
|
|
|
return attributes;
|
|
}
|
|
}
|
|
}
|