forked from Shardstone/trail-into-darkness
added logger to character creation, default character setup, gameplay flow and textmeshpro stuff
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZLinq;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -34,6 +35,15 @@ namespace Nox.Game {
|
||||
Perception
|
||||
}
|
||||
|
||||
public enum CombatScoreType {
|
||||
None,
|
||||
ATK,
|
||||
DEF,
|
||||
INIT,
|
||||
SPD,
|
||||
RES
|
||||
}
|
||||
|
||||
public enum CharacterRole {
|
||||
None,
|
||||
Protagonist,
|
||||
@@ -93,6 +103,10 @@ namespace Nox.Game {
|
||||
public int GetValue(AttributeType attributeType) {
|
||||
return attributes.AsValueEnumerable().First(attr => attr.attribute == attributeType).value;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return $"Attributes: {string.Join(", ", attributes.Select(attr => $"{attr.attribute}: {attr.value}"))}";
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@@ -106,6 +120,10 @@ namespace Nox.Game {
|
||||
var match = stats.AsValueEnumerable().FirstOrDefault(stat => stat.stat == statType);
|
||||
return match?.value ?? 0;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return $"Stats: {string.Join(", ", stats.Select(stat => $"{stat.stat}: {stat.value}"))}";
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Jovian.Logger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZLinq;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -32,16 +33,21 @@ namespace Nox.Game {
|
||||
[Serializable]
|
||||
public sealed class ModifierDefinition : IModifier {
|
||||
[field: SerializeField] public string Name { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[field: SerializeField] public StatType StatType { get; set; }
|
||||
[field: SerializeField] public AttributeType AttributeType { get; set; }
|
||||
[field: SerializeField] public ModifierOperation Operation { get; set; }
|
||||
[field: SerializeField] public CombatScoreType CombatScoreType { get; set; }
|
||||
[field: SerializeField] public float Value { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ModifiersData {
|
||||
public List<ModifierDefinition> modifiers = new ();
|
||||
|
||||
public override string ToString() {
|
||||
return $"Modifiers: {string.Join(", ", modifiers.Select(modifier => $"{modifier.Name}"))}";
|
||||
}
|
||||
}
|
||||
|
||||
public class ModifiersFactory : IModifiersFactory {
|
||||
|
||||
@@ -15,9 +15,6 @@ namespace Nox.Game {
|
||||
[Header("Party Definition Sets")]
|
||||
public List<PartyDefinitionSet> testPartyDefinitionSets;
|
||||
|
||||
[Header("Testing Party Definition Sets")]
|
||||
public StarterCharacterSettings[] testStarterCharacterSettings;
|
||||
|
||||
private void OnValidate() {
|
||||
if(String.IsNullOrEmpty(testStartingSetId)) {
|
||||
Debug.LogError("DefaultPartySettings: startingSetId cannot be null or empty");
|
||||
@@ -35,13 +32,6 @@ namespace Nox.Game {
|
||||
}
|
||||
}
|
||||
|
||||
if(testPartyDefinitionSets.AsValueEnumerable().FirstOrDefault(pds => pds.id == partyDefinitionSet.id && pds.isTestingSet) != null) {
|
||||
var testingSet = testPartyDefinitionSets.AsValueEnumerable().FirstOrDefault(pds => pds.id == partyDefinitionSet.id && pds.isTestingSet);
|
||||
foreach(var characterSetting in testStarterCharacterSettings) {
|
||||
ApplyClassAndRacialBonuses(testingSet, characterSetting);
|
||||
}
|
||||
}
|
||||
|
||||
if(partyDefinition.members.Count <= partyDefinition.maxPartySize) {
|
||||
continue;
|
||||
}
|
||||
@@ -49,17 +39,6 @@ namespace Nox.Game {
|
||||
partyDefinition.members.RemoveRange(partyDefinition.maxPartySize, partyDefinition.members.Count - partyDefinition.maxPartySize);
|
||||
}
|
||||
}
|
||||
private void ApplyClassAndRacialBonuses(PartyDefinitionSet testingSet, StarterCharacterSettings starterCharacterSettings) {
|
||||
var partyDefinition = testingSet.partyDefinition;
|
||||
foreach(var member in partyDefinition.members) {
|
||||
var baseSettings = starterCharacterSettings.defaultEntityAttributes;
|
||||
var classAttributes = starterCharacterSettings.classBonuses.AsValueEnumerable().FirstOrDefault(c => c.@class == member.Class)?.bonusAttributes;
|
||||
var racialAttributes = starterCharacterSettings.racialBonuses.AsValueEnumerable().FirstOrDefault(rb => rb.race == member.Race)?.bonusAttributes;
|
||||
if (classAttributes != null && racialAttributes != null) {
|
||||
member.Attributes += baseSettings + classAttributes + racialAttributes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Jovian.Logger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZLinq;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -23,12 +24,16 @@ namespace Nox.Game {
|
||||
public sealed class PerkDefinition : IPerk {
|
||||
[field: SerializeField] public string Name { get; set; }
|
||||
[field: SerializeField] public ModifiersData Modifiers { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerksData {
|
||||
public List<PerkDefinition> perks = new ();
|
||||
|
||||
public override string ToString() {
|
||||
return $"Perks: {string.Join(", ", perks.Select(perk => $"{perk.Name}"))}";
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PerkFactory : IPerkFactory {
|
||||
|
||||
Reference in New Issue
Block a user