Added a bunch of utilities and modfief the character data structue

This commit is contained in:
Sebastian Bularca
2026-03-29 18:31:03 +02:00
parent 4a9c00212a
commit ee97b2fec3
110 changed files with 6752 additions and 169 deletions

View File

@@ -1,31 +1,25 @@
using System;
using System.Linq;
namespace Nox.Game {
public interface ICharacterStatsFactory {
EntityStats Create(EntityAttributes attributes);
}
public sealed class CharacterStatsFactoryOptions {
public EntityStats entityStats = new EntityStats() {
health = 10,
stamina = 10,
level = 1,
experience = 0
};
}
public sealed class CharacterStatsFactory : ICharacterStatsFactory {
private readonly CharacterStatsFactoryOptions options;
private readonly CharacterRegistry characterRegistry;
public CharacterStatsFactory(CharacterStatsFactoryOptions options = null) {
this.options = options ?? new CharacterStatsFactoryOptions();
public CharacterStatsFactory(CharacterRegistry characterRegistry) {
this.characterRegistry = characterRegistry;
}
public EntityStats Create(EntityAttributes attributes) {
if(attributes == null) {
throw new ArgumentNullException(nameof(attributes));
if(attributes.attributes.All(a => a.value != 0)) {
throw new ArgumentOutOfRangeException( "attributes cannot be zero or negative.", new ArgumentException() );
}
//TODO: Create stats based on attributes
// int maxHealth = options.baseHealth + attributes.might * options.mightHealthBonus;
// int maxStamina = options.baseStamina +
// attributes.might * options.mightStaminaBonus +