Added resolver

This commit is contained in:
Sebastian Bularca
2026-03-30 01:17:25 +02:00
parent e7d5acac7c
commit cfac76ed25
9 changed files with 147 additions and 45 deletions

View File

@@ -15,7 +15,7 @@ namespace Nox.Game {
public CharacterClass Class { get; set; } = (CharacterClass)GetRandomInt(1, Enum.GetValues(typeof(CharacterClass)).Length-1);
public CharacterRole Role { get; set; } = CharacterRole.Companion;
public EntityAttributes Attributes { get; set; } = GetDefaultAttributes();
public EntityStats Stats { get; set; } = new();
public EntityStats Stats { get; set; } = new() { stats = Array.Empty<Stat>() };
public PerksData Perks { get; set; } = new();
public ModifiersData Modifiers { get; set; } = new();
@@ -36,15 +36,15 @@ namespace Nox.Game {
[Serializable]
public sealed class CustomCharacterCreationRequest : IEntityDefinition {
public Guid Id { get; set; }
public Guid Id { get; set; } = Guid.Empty;
public string Name { get; set; }
public CharacterRace Race { get; set; }
public CharacterClass Class { get; set; }
public CharacterRole Role { get; set; }
public CharacterRole Role { get; set; } = CharacterRole.Protagonist;
public EntityAttributes Attributes { get; set; }
public EntityStats Stats { get; set; }
public PerksData Perks { get; set; }
public ModifiersData Modifiers { get; set; }
public EntityStats Stats { get; set; } = new() { stats = Array.Empty<Stat>() };
public PerksData Perks { get; set; } = new();
public ModifiersData Modifiers { get; set; } = new();
}
public sealed class CharacterFactory : ICharacterFactory {
@@ -69,7 +69,7 @@ namespace Nox.Game {
throw new ArgumentNullException(nameof(request));
}
var attributes = attributesFactory.Create(request.Attributes);
var attributes = attributesFactory.Create(request);
var stats = statsFactory.Create(request);
var character = new CharacterDefinition {
@@ -79,6 +79,7 @@ namespace Nox.Game {
Class = request.Class,
Role = CharacterRole.Protagonist,
Attributes = attributes,
Stats = stats,
Perks = request.Perks ?? new PerksData(),
Modifiers = request.Modifiers ?? new ModifiersData()
};
@@ -101,7 +102,7 @@ namespace Nox.Game {
Race = template.Race,
Class = template.Class,
Role = role,
Attributes = attributesFactory.Create(template.Attributes),
Attributes = attributesFactory.Create(template),
Stats = statsFactory.Create(template),
Perks = template.Perks,
Modifiers = template.Modifiers