forked from Shardstone/trail-into-darkness
Added some data
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Nox.Game {
|
|||||||
[CreateAssetMenu(fileName = "CharacterBaseSettings", menuName = "Nox/Database/Entities/CharacterBaseSettings")]
|
[CreateAssetMenu(fileName = "CharacterBaseSettings", menuName = "Nox/Database/Entities/CharacterBaseSettings")]
|
||||||
public class CharacterBaseSettings: ScriptableObject {
|
public class CharacterBaseSettings: ScriptableObject {
|
||||||
[Header("Character Creation Defaults")]
|
[Header("Character Creation Defaults")]
|
||||||
public DistributionPointsPerClass distributionPointsPerClass;
|
public DistributionPointsPerClass[] distributionPointsPerClass;
|
||||||
public EntityAttributes defaultEntityAttributes;
|
public EntityAttributes defaultEntityAttributes;
|
||||||
public EntityStats defaultEntityStats;
|
public EntityStats defaultEntityStats;
|
||||||
public PerksData defaultPerksData;
|
public PerksData defaultPerksData;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
namespace Nox.Game {
|
namespace Nox.Game {
|
||||||
public interface IModfiersFactory {
|
public interface IModfiersFactory {
|
||||||
IReadOnlyCollection<ModifierDefinition> GetAll();
|
IReadOnlyCollection<ModifierDefinition> GetAll();
|
||||||
ModifierDefinition GetById(string modifierId);
|
ModifierDefinition GetById(ModifierIds modifierId);
|
||||||
IReadOnlyCollection<ModifierDefinition> GetModifiersFor(CharacterDefinition character);
|
IReadOnlyCollection<ModifierDefinition> GetModifiersFor(CharacterDefinition character);
|
||||||
bool TryAddModifier(CharacterDefinition character, string modiferId);
|
bool TryAddModifier(CharacterDefinition character, string modiferId);
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ namespace Nox.Game {
|
|||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public sealed class ModifierDefinition {
|
public sealed class ModifierDefinition {
|
||||||
public string id;
|
public ModifierIds id;
|
||||||
public ModifierType type;
|
public ModifierType type;
|
||||||
public float value;
|
public float value;
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace Nox.Game {
|
|||||||
public IReadOnlyCollection<ModifierDefinition> GetAll() {
|
public IReadOnlyCollection<ModifierDefinition> GetAll() {
|
||||||
return modifiersRegistry.modifiersData.modifiers;
|
return modifiersRegistry.modifiersData.modifiers;
|
||||||
}
|
}
|
||||||
public ModifierDefinition GetById(string modifierId) {
|
public ModifierDefinition GetById(ModifierIds modifierId) {
|
||||||
return modifiersRegistry.modifiersData.modifiers.FirstOrDefault(m => m.id == modifierId);
|
return modifiersRegistry.modifiersData.modifiers.FirstOrDefault(m => m.id == modifierId);
|
||||||
}
|
}
|
||||||
public IReadOnlyCollection<ModifierDefinition> GetModifiersFor(CharacterDefinition character) {
|
public IReadOnlyCollection<ModifierDefinition> GetModifiersFor(CharacterDefinition character) {
|
||||||
|
|||||||
11
Assets/Code/GameState/Entities/ModifiersPerksList.cs
Normal file
11
Assets/Code/GameState/Entities/ModifiersPerksList.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Nox.Game {
|
||||||
|
public enum ModifierIds {
|
||||||
|
generic_mgt_health_multiplier,
|
||||||
|
warrior_mgt_health_multiplier,
|
||||||
|
generic_mgt_mana_multiplier,
|
||||||
|
generic_kno_mana_multiplier
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PerksIds{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fc2631d096794cea9ae7c9cd82a38c53
|
||||||
|
timeCreated: 1774366047
|
||||||
@@ -6,14 +6,14 @@ namespace Nox.Game {
|
|||||||
|
|
||||||
public interface IPerkFactory {
|
public interface IPerkFactory {
|
||||||
IReadOnlyCollection<PerkDefinition> GetAll();
|
IReadOnlyCollection<PerkDefinition> GetAll();
|
||||||
PerkDefinition GetById(string perkId);
|
PerkDefinition GetById(PerksIds perkId);
|
||||||
IReadOnlyCollection<PerkDefinition> GetPerksFor(CharacterDefinition character);
|
IReadOnlyCollection<PerkDefinition> GetPerksFor(CharacterDefinition character);
|
||||||
bool TryAddPerk(CharacterDefinition character, string perkId);
|
bool TryAddPerk(CharacterDefinition character, PerksIds perkId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public sealed class PerkDefinition {
|
public sealed class PerkDefinition {
|
||||||
public string id;
|
public PerksIds id;
|
||||||
public string name;
|
public string name;
|
||||||
public ModifiersData modifiers = new ();
|
public ModifiersData modifiers = new ();
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ namespace Nox.Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public sealed class PerkFactory : IPerkFactory {
|
public sealed class PerkFactory : IPerkFactory {
|
||||||
private readonly Dictionary<string, PerkDefinition> perkPool = new ();
|
private readonly Dictionary<PerksIds, PerkDefinition> perkPool = new ();
|
||||||
|
|
||||||
public PerkFactory(PerksRegistry perksRegistry) {
|
public PerkFactory(PerksRegistry perksRegistry) {
|
||||||
if(!perksRegistry) {
|
if(!perksRegistry) {
|
||||||
@@ -40,11 +40,7 @@ namespace Nox.Game {
|
|||||||
return perkPool.Values.ToList();
|
return perkPool.Values.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PerkDefinition GetById(string perkId) {
|
public PerkDefinition GetById(PerksIds perkId) {
|
||||||
if(string.IsNullOrWhiteSpace(perkId)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
perkPool.TryGetValue(perkId, out var perk);
|
perkPool.TryGetValue(perkId, out var perk);
|
||||||
return perk;
|
return perk;
|
||||||
}
|
}
|
||||||
@@ -55,15 +51,14 @@ namespace Nox.Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ownedPerkIds = character.perksData.perks
|
var ownedPerkIds = character.perksData.perks
|
||||||
.Where(p => p != null && !string.IsNullOrWhiteSpace(p.id))
|
|
||||||
.Select(p => p.id)
|
.Select(p => p.id)
|
||||||
.ToHashSet();
|
.ToHashSet();
|
||||||
|
|
||||||
return perkPool.Values.Where(p => !ownedPerkIds.Contains(p.id)).ToList();
|
return perkPool.Values.Where(p => !ownedPerkIds.Contains(p.id)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryAddPerk(CharacterDefinition character, string perkId) {
|
public bool TryAddPerk(CharacterDefinition character, PerksIds perkId) {
|
||||||
if(character == null || string.IsNullOrWhiteSpace(perkId)) {
|
if(character == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +66,7 @@ namespace Nox.Game {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!perkPool.TryGetValue(perkId, out PerkDefinition perk)) {
|
if(!perkPool.TryGetValue(perkId, out var perk)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,20 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 1bbecc15c7cd4a7ca90ce17b3d3d75f0, type: 3}
|
m_Script: {fileID: 11500000, guid: 1bbecc15c7cd4a7ca90ce17b3d3d75f0, type: 3}
|
||||||
m_Name: CharacterBaseSettings
|
m_Name: CharacterBaseSettings
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::Nox.Game.CharacterBaseSettings
|
m_EditorClassIdentifier: Assembly-CSharp::Nox.Game.CharacterBaseSettings
|
||||||
startAttributesPool: 12
|
distributionPointsPerClass:
|
||||||
|
- class: 1
|
||||||
|
points: 10
|
||||||
|
- class: 2
|
||||||
|
points: 10
|
||||||
|
- class: 3
|
||||||
|
points: 10
|
||||||
|
- class: 4
|
||||||
|
points: 10
|
||||||
defaultEntityAttributes:
|
defaultEntityAttributes:
|
||||||
might: 0
|
might: 1
|
||||||
reflex: 0
|
reflex: 1
|
||||||
knowledge: 0
|
knowledge: 1
|
||||||
perception: 0
|
perception: 1
|
||||||
defaultEntityStats:
|
defaultEntityStats:
|
||||||
health: 0
|
health: 0
|
||||||
stamina: 0
|
stamina: 0
|
||||||
@@ -26,7 +34,79 @@ MonoBehaviour:
|
|||||||
defaultPerksData:
|
defaultPerksData:
|
||||||
perks: []
|
perks: []
|
||||||
defaultModifiersData:
|
defaultModifiersData:
|
||||||
modifiers: []
|
modifiers:
|
||||||
racialBonuses: []
|
- id: 0
|
||||||
classBonuses: []
|
type: 3
|
||||||
|
value: 3
|
||||||
|
- id: 1
|
||||||
|
type: 3
|
||||||
|
value: 4
|
||||||
|
- id: 2
|
||||||
|
type: 3
|
||||||
|
value: 1
|
||||||
|
- id: 3
|
||||||
|
type: 3
|
||||||
|
value: 2
|
||||||
|
racialBonuses:
|
||||||
|
- race: 1
|
||||||
|
bonusAttributes:
|
||||||
|
might: 0
|
||||||
|
reflex: 0
|
||||||
|
knowledge: 1
|
||||||
|
perception: 0
|
||||||
|
bonusStats:
|
||||||
|
health: 0
|
||||||
|
stamina: 0
|
||||||
|
level: 0
|
||||||
|
experience: 0
|
||||||
|
startingPerks:
|
||||||
|
perks: []
|
||||||
|
permanentModifiers:
|
||||||
|
modifiers: []
|
||||||
|
- race: 2
|
||||||
|
bonusAttributes:
|
||||||
|
might: 0
|
||||||
|
reflex: 1
|
||||||
|
knowledge: 0
|
||||||
|
perception: 0
|
||||||
|
bonusStats:
|
||||||
|
health: 0
|
||||||
|
stamina: 0
|
||||||
|
level: 0
|
||||||
|
experience: 0
|
||||||
|
startingPerks:
|
||||||
|
perks: []
|
||||||
|
permanentModifiers:
|
||||||
|
modifiers: []
|
||||||
|
- race: 2
|
||||||
|
bonusAttributes:
|
||||||
|
might: 1
|
||||||
|
reflex: 0
|
||||||
|
knowledge: 0
|
||||||
|
perception: 0
|
||||||
|
bonusStats:
|
||||||
|
health: 0
|
||||||
|
stamina: 0
|
||||||
|
level: 0
|
||||||
|
experience: 0
|
||||||
|
startingPerks:
|
||||||
|
perks: []
|
||||||
|
permanentModifiers:
|
||||||
|
modifiers: []
|
||||||
|
classBonuses:
|
||||||
|
- class: 1
|
||||||
|
bonusAttributes:
|
||||||
|
might: 0
|
||||||
|
reflex: 0
|
||||||
|
knowledge: 0
|
||||||
|
perception: 0
|
||||||
|
bonusStats:
|
||||||
|
health: 0
|
||||||
|
stamina: 0
|
||||||
|
level: 0
|
||||||
|
experience: 0
|
||||||
|
startingPerks:
|
||||||
|
perks: []
|
||||||
|
permanentModifiers:
|
||||||
|
modifiers: []
|
||||||
maxPartySize: 4
|
maxPartySize: 4
|
||||||
|
|||||||
Reference in New Issue
Block a user