forked from Shardstone/trail-into-darkness
Added a bunch of utilities and modfief the character data structue
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Nox.Game {
|
||||
public interface ICharacterAttributesFactory {
|
||||
EntityAttributes Create(EntityAttributes attributes);
|
||||
EntityAttributes Create(EntityAttributes entityAttributes);
|
||||
}
|
||||
|
||||
public sealed class CharacterAttributesFactory : ICharacterAttributesFactory {
|
||||
@@ -12,12 +13,12 @@ namespace Nox.Game {
|
||||
this.characterRegistry = characterRegistry;
|
||||
}
|
||||
|
||||
public EntityAttributes Create(EntityAttributes attributes) {
|
||||
if(attributes.might <= 0 || attributes.reflex <= 0 || attributes.knowledge <= 0 || attributes.perception <= 0) {
|
||||
public EntityAttributes Create(EntityAttributes entityAttributes) {
|
||||
if(entityAttributes.attributes.All(a => a.value != 0)) {
|
||||
throw new ArgumentOutOfRangeException( "attributes cannot be zero or negative.", new ArgumentException() );
|
||||
}
|
||||
|
||||
return attributes;
|
||||
//TODO: Handle attributes modifiers and perks
|
||||
return entityAttributes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user