forked from Shardstone/trail-into-darkness
Some renaming and added more settings
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user