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")]
|
||||
public class CharacterBaseSettings: ScriptableObject {
|
||||
[Header("Character Creation Defaults")]
|
||||
public DistributionPointsPerClass distributionPointsPerClass;
|
||||
public DistributionPointsPerClass[] distributionPointsPerClass;
|
||||
public EntityAttributes defaultEntityAttributes;
|
||||
public EntityStats defaultEntityStats;
|
||||
public PerksData defaultPerksData;
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
namespace Nox.Game {
|
||||
public interface IModfiersFactory {
|
||||
IReadOnlyCollection<ModifierDefinition> GetAll();
|
||||
ModifierDefinition GetById(string modifierId);
|
||||
ModifierDefinition GetById(ModifierIds modifierId);
|
||||
IReadOnlyCollection<ModifierDefinition> GetModifiersFor(CharacterDefinition character);
|
||||
bool TryAddModifier(CharacterDefinition character, string modiferId);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace Nox.Game {
|
||||
|
||||
[Serializable]
|
||||
public sealed class ModifierDefinition {
|
||||
public string id;
|
||||
public ModifierIds id;
|
||||
public ModifierType type;
|
||||
public float value;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace Nox.Game {
|
||||
public IReadOnlyCollection<ModifierDefinition> GetAll() {
|
||||
return modifiersRegistry.modifiersData.modifiers;
|
||||
}
|
||||
public ModifierDefinition GetById(string modifierId) {
|
||||
public ModifierDefinition GetById(ModifierIds modifierId) {
|
||||
return modifiersRegistry.modifiersData.modifiers.FirstOrDefault(m => m.id == modifierId);
|
||||
}
|
||||
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 {
|
||||
IReadOnlyCollection<PerkDefinition> GetAll();
|
||||
PerkDefinition GetById(string perkId);
|
||||
PerkDefinition GetById(PerksIds perkId);
|
||||
IReadOnlyCollection<PerkDefinition> GetPerksFor(CharacterDefinition character);
|
||||
bool TryAddPerk(CharacterDefinition character, string perkId);
|
||||
bool TryAddPerk(CharacterDefinition character, PerksIds perkId);
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerkDefinition {
|
||||
public string id;
|
||||
public PerksIds id;
|
||||
public string name;
|
||||
public ModifiersData modifiers = new ();
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace Nox.Game {
|
||||
}
|
||||
|
||||
public sealed class PerkFactory : IPerkFactory {
|
||||
private readonly Dictionary<string, PerkDefinition> perkPool = new ();
|
||||
private readonly Dictionary<PerksIds, PerkDefinition> perkPool = new ();
|
||||
|
||||
public PerkFactory(PerksRegistry perksRegistry) {
|
||||
if(!perksRegistry) {
|
||||
@@ -40,11 +40,7 @@ namespace Nox.Game {
|
||||
return perkPool.Values.ToList();
|
||||
}
|
||||
|
||||
public PerkDefinition GetById(string perkId) {
|
||||
if(string.IsNullOrWhiteSpace(perkId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public PerkDefinition GetById(PerksIds perkId) {
|
||||
perkPool.TryGetValue(perkId, out var perk);
|
||||
return perk;
|
||||
}
|
||||
@@ -55,15 +51,14 @@ namespace Nox.Game {
|
||||
}
|
||||
|
||||
var ownedPerkIds = character.perksData.perks
|
||||
.Where(p => p != null && !string.IsNullOrWhiteSpace(p.id))
|
||||
.Select(p => p.id)
|
||||
.ToHashSet();
|
||||
|
||||
return perkPool.Values.Where(p => !ownedPerkIds.Contains(p.id)).ToList();
|
||||
}
|
||||
|
||||
public bool TryAddPerk(CharacterDefinition character, string perkId) {
|
||||
if(character == null || string.IsNullOrWhiteSpace(perkId)) {
|
||||
public bool TryAddPerk(CharacterDefinition character, PerksIds perkId) {
|
||||
if(character == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,7 +66,7 @@ namespace Nox.Game {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!perkPool.TryGetValue(perkId, out PerkDefinition perk)) {
|
||||
if(!perkPool.TryGetValue(perkId, out var perk)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,20 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 1bbecc15c7cd4a7ca90ce17b3d3d75f0, type: 3}
|
||||
m_Name: 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:
|
||||
might: 0
|
||||
reflex: 0
|
||||
knowledge: 0
|
||||
perception: 0
|
||||
might: 1
|
||||
reflex: 1
|
||||
knowledge: 1
|
||||
perception: 1
|
||||
defaultEntityStats:
|
||||
health: 0
|
||||
stamina: 0
|
||||
@@ -26,7 +34,79 @@ MonoBehaviour:
|
||||
defaultPerksData:
|
||||
perks: []
|
||||
defaultModifiersData:
|
||||
modifiers:
|
||||
- id: 0
|
||||
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: []
|
||||
racialBonuses: []
|
||||
classBonuses: []
|
||||
maxPartySize: 4
|
||||
|
||||
Reference in New Issue
Block a user