Some renaming and added more settings

This commit is contained in:
Sebastian Bularca
2026-03-29 19:16:39 +02:00
parent 71b432e253
commit 00c1764fdb
59 changed files with 149 additions and 183 deletions

View File

@@ -60,6 +60,7 @@ namespace Nox.Game {
}
}
[Serializable]
public sealed record Attribute {
private readonly int values;
public AttributeType attribute;
@@ -71,12 +72,7 @@ namespace Nox.Game {
[Serializable]
public sealed class EntityAttributes {
public Attribute[] attributes = {
new(AttributeType.Might, 1),
new(AttributeType.Reflex, 1),
new(AttributeType.Knowledge, 1),
new(AttributeType.Perception, 1)
};
public Attribute[] attributes;
public static EntityAttributes operator +(EntityAttributes a, EntityAttributes b) {
return new EntityAttributes {
@@ -90,12 +86,7 @@ namespace Nox.Game {
[Serializable]
public sealed class EntityStats {
public Stat[] stats = {
new(StatType.Health, 0),
new(StatType.Stamina, 0),
new(StatType.Level, 1),
new(StatType.Experience, 0)
};
public Stat[] stats;
public int GetValue(StatType statType) {
return stats.First(stat => stat.type == statType).value;

View File

@@ -1,7 +1,7 @@
using Jovian.InspectorTools;
using System;
using System.Collections.Generic;
using System.Linq;
using Jovian.Utilities;
namespace Nox.Game {
public interface IModfiersFactory {
@@ -11,7 +11,7 @@ namespace Nox.Game {
bool TryAddModifier(CharacterDefinition character, string modiferId);
}
public enum ModifierRole {
public enum ModifierOperation {
None,
Flat,
Addition,
@@ -21,10 +21,12 @@ namespace Nox.Game {
[Serializable]
public sealed class ModifierDefinition {
public System.Guid id = Guid.NewGuid();
public string name;
[ReadOnly]
public Guid id = Guid.NewGuid();
public StatType statType;
public AttributeType attributeType;
public ModifierRole role;
public ModifierOperation operation;
public float value;
}
@@ -35,10 +37,14 @@ namespace Nox.Game {
public class ModifiersFactory : IModfiersFactory {
private readonly ModifiersRegistry modifiersRegistry;
private readonly Dictionary<string, ModifierDefinition> modifierPool = new ();
private readonly Dictionary<Guid, ModifierDefinition> modifierPool = new ();
public ModifiersFactory(ModifiersRegistry modifiersRegistry) {
this.modifiersRegistry = modifiersRegistry;
var allAvailableModifiers = modifiersRegistry.modifiersData;
foreach(var modifier in allAvailableModifiers.modifiers) {
modifierPool.Add(modifier.id, modifier);
}
}
public IReadOnlyCollection<ModifierDefinition> GetAll() {

View File

@@ -1,3 +1,4 @@
using Jovian.InspectorTools;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,8 +14,9 @@ namespace Nox.Game {
[Serializable]
public sealed class PerkDefinition {
public Guid id;
public string name;
[ReadOnly]
public Guid id;
public ModifiersData modifiers = new ();
}

View File

@@ -21,92 +21,59 @@ MonoBehaviour:
points: 10
- class: 4
points: 10
defaultEntityAttributes:
attributes:
- attribute: 1
value: 1
- attribute: 2
value: 1
- attribute: 3
value: 1
- attribute: 4
value: 1
defaultEntityStats:
stats:
- type: 0
value: 0
- type: 3
value: 1
- type: 1
value: 0
- type: 2
value: 1
- type: 3
value: 0
- type: 4
value: 0
defaultPerksData:
perks: []
defaultModifiersData:
modifiers:
- id: 0
type: 3
- name: Global Health Modifier per MGT
statType: 1
attributeType: 0
operation: 3
value: 3
- id: 2
type: 3
- name: Global Stamina modifier per MGT
statType: 2
attributeType: 0
operation: 3
value: 1
- id: 3
type: 3
- name: Global Stamina Modifier per KNO
statType: 2
attributeType: 0
operation: 3
value: 2
racialBonuses:
- race: 1
bonusStats:
stats:
- type: 0
value: 10
- type: 0
value: 10
- type: 0
value: 1
- type: 0
value: 0
startingPerks:
perks: []
permanentModifiers:
modifiers: []
- race: 2
bonusStats:
stats:
- type: 0
value: 10
- type: 0
value: 10
- type: 0
value: 1
- type: 0
value: 0
startingPerks:
perks: []
permanentModifiers:
modifiers: []
- race: 2
bonusStats:
stats:
- type: 0
value: 10
- type: 0
value: 10
- type: 0
value: 1
- type: 0
value: 0
startingPerks:
perks: []
permanentModifiers:
modifiers: []
racialBonuses: []
classBonuses:
- class: 1
bonusAttributes:
attributes: []
bonusStats:
stats:
- type: 0
value: 10
- type: 0
value: 10
- type: 0
value: 1
- type: 0
value: 0
stats: []
startingPerks:
perks: []
permanentModifiers:
modifiers:
- id: 1
type: 3
- name: Warrior Health per MGT
statType: 1
attributeType: 0
operation: 3
value: 4
maxPartySize: 4