Secondary stats added to character prefabs

This commit is contained in:
Pedro Gomes 2024-08-12 23:45:16 +01:00
parent 0e6b93b028
commit 8743db5347
8 changed files with 90 additions and 3 deletions

View File

@ -81,6 +81,7 @@ namespace Kryz.CharacterStats.Examples
MaxHealth.RemoveAllModifiersFromSource(GameConstants.ObjectSources.VitalitySource);
Armor.RemoveAllModifiersFromSource(GameConstants.ObjectSources.StrengthSource);
Armor.RemoveAllModifiersFromSource(GameConstants.ObjectSources.AgilitySource);
Armor.RemoveAllModifiersFromSource(GameConstants.ObjectSources.VitalitySource);
MagicResistance.RemoveAllModifiersFromSource(GameConstants.ObjectSources.IntelligenceSource);
@ -106,6 +107,7 @@ namespace Kryz.CharacterStats.Examples
MaxHealth.AddModifier(new StatModifier(Vitality.Value * GameConstants.CharacterStatsBalancing.MaxHealthIncreaseFromVitality, StatModType.Flat, GameConstants.ObjectSources.VitalitySource));
Armor.AddModifier(new StatModifier(Strength.Value * GameConstants.CharacterStatsBalancing.ArmorIncreaseFromStrength, StatModType.Flat, GameConstants.ObjectSources.StrengthSource));
Armor.AddModifier(new StatModifier(Agility.Value * GameConstants.CharacterStatsBalancing.ArmorIncreaseFromAgility, StatModType.Flat, GameConstants.ObjectSources.AgilitySource));
Armor.AddModifier(new StatModifier(Vitality.Value * GameConstants.CharacterStatsBalancing.ArmorIncreaseFromVitality, StatModType.Flat, GameConstants.ObjectSources.VitalitySource));
MagicResistance.AddModifier(new StatModifier(Intelligence.Value * GameConstants.CharacterStatsBalancing.MagicResistanceIncreaseFromIntelligence, StatModType.Flat, GameConstants.ObjectSources.IntelligenceSource));

View File

@ -5339,6 +5339,27 @@ MonoBehaviour:
Vitality:
statTag: {fileID: 11400000, guid: 9bbf01c0977dc98408db3efec6685c56, type: 2}
BaseValue: 1
CritChance:
statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2}
BaseValue: 3
CritDamage:
statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2}
BaseValue: 50
AttackDamage:
statTag: {fileID: 11400000, guid: 09eb68d1a036a1643b74420197b999bd, type: 2}
BaseValue: 1
SpellDamage:
statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2}
BaseValue: 1
MaxHealth:
statTag: {fileID: 11400000, guid: 4242916f0b1bf6e4e8a04bce7028b3f4, type: 2}
BaseValue: 0
Armor:
statTag: {fileID: 11400000, guid: 9ffd1c81aeea68b4eb6b0f054f0d989f, type: 2}
BaseValue: 1
MagicResistance:
statTag: {fileID: 11400000, guid: 5ff891a32306c504f8f6159f69a1866e, type: 2}
BaseValue: 1
onUpdateStatValues:
m_PersistentCalls:
m_Calls: []

View File

@ -390,6 +390,27 @@ MonoBehaviour:
Vitality:
statTag: {fileID: 11400000, guid: 9bbf01c0977dc98408db3efec6685c56, type: 2}
BaseValue: 5
CritChance:
statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2}
BaseValue: 5
CritDamage:
statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2}
BaseValue: 50
AttackDamage:
statTag: {fileID: 11400000, guid: 09eb68d1a036a1643b74420197b999bd, type: 2}
BaseValue: 1
SpellDamage:
statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2}
BaseValue: 1
MaxHealth:
statTag: {fileID: 11400000, guid: 4242916f0b1bf6e4e8a04bce7028b3f4, type: 2}
BaseValue: 0
Armor:
statTag: {fileID: 11400000, guid: 9ffd1c81aeea68b4eb6b0f054f0d989f, type: 2}
BaseValue: 1
MagicResistance:
statTag: {fileID: 11400000, guid: 5ff891a32306c504f8f6159f69a1866e, type: 2}
BaseValue: 1
onUpdateStatValues:
m_PersistentCalls:
m_Calls: []

View File

@ -482,6 +482,27 @@ MonoBehaviour:
Vitality:
statTag: {fileID: 11400000, guid: 9bbf01c0977dc98408db3efec6685c56, type: 2}
BaseValue: 1
CritChance:
statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2}
BaseValue: 3
CritDamage:
statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2}
BaseValue: 50
AttackDamage:
statTag: {fileID: 11400000, guid: 09eb68d1a036a1643b74420197b999bd, type: 2}
BaseValue: 1
SpellDamage:
statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2}
BaseValue: 1
MaxHealth:
statTag: {fileID: 11400000, guid: 4242916f0b1bf6e4e8a04bce7028b3f4, type: 2}
BaseValue: 0
Armor:
statTag: {fileID: 11400000, guid: 9ffd1c81aeea68b4eb6b0f054f0d989f, type: 2}
BaseValue: 1
MagicResistance:
statTag: {fileID: 11400000, guid: 5ff891a32306c504f8f6159f69a1866e, type: 2}
BaseValue: 1
onUpdateStatValues:
m_PersistentCalls:
m_Calls: []

View File

@ -475,6 +475,27 @@ MonoBehaviour:
Vitality:
statTag: {fileID: 11400000, guid: 9bbf01c0977dc98408db3efec6685c56, type: 2}
BaseValue: 1
CritChance:
statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2}
BaseValue: 5
CritDamage:
statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2}
BaseValue: 50
AttackDamage:
statTag: {fileID: 11400000, guid: 09eb68d1a036a1643b74420197b999bd, type: 2}
BaseValue: 1
SpellDamage:
statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2}
BaseValue: 1
MaxHealth:
statTag: {fileID: 11400000, guid: 4242916f0b1bf6e4e8a04bce7028b3f4, type: 2}
BaseValue: 0
Armor:
statTag: {fileID: 11400000, guid: 9ffd1c81aeea68b4eb6b0f054f0d989f, type: 2}
BaseValue: 1
MagicResistance:
statTag: {fileID: 11400000, guid: 5ff891a32306c504f8f6159f69a1866e, type: 2}
BaseValue: 1
onUpdateStatValues:
m_PersistentCalls:
m_Calls: []

View File

@ -80,7 +80,8 @@ public static class GameConstants
public const float MaxHealthIncreaseFromVitality = 1f; //100% vit => MaxHP
public const float ArmorIncreaseFromStrength = 0.1f; //10% str => Armor
public const float ArmorIncreaseFromVitality = 0.2f; //20% vit => Armor
public const float ArmorIncreaseFromAgility = 0.1f; // 10% agi => Armor
public const float ArmorIncreaseFromVitality = 0.3f; //30% vit => Armor
public const float MagicResistanceIncreaseFromIntelligence = 0.1f; // 10% int => MagicRess
public const float MagicResistanceIncreaseFromSpirit = 1f; //100% spi => MagicRes

View File

@ -154,7 +154,7 @@ public class Health : Resource
public virtual void CalculateMaxValueBasedOnStat()
{
maxValue = baseMaxValue + character.Vitality.Value * GameConstants.CharacterStatsBalancing.VitalityToHealthRate;
maxValue = baseMaxValue + character.MaxHealth.Value;
CalculateRegenValueBasedOnStat();

View File

@ -15,7 +15,7 @@ public class PlayerHealth : Health
{
currentLevel = ((PlayerCharacterStats)character).level.currentLevel - 1;
maxValue = (baseMaxValue + (baseMaxValue * currentLevel * GameConstants.CharacterStatsBalancing.BaseMaxHealthGrowthPerLevel)) + character.Vitality.Value * GameConstants.CharacterStatsBalancing.VitalityToHealthRate;
maxValue = (baseMaxValue + (baseMaxValue * currentLevel * GameConstants.CharacterStatsBalancing.BaseMaxHealthGrowthPerLevel)) + character.MaxHealth.Value;
CalculateRegenValueBasedOnStat();