44 lines
2.0 KiB
C#
44 lines
2.0 KiB
C#
using Kryz.CharacterStats.Examples;
|
|
using Kryz.CharacterStats;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "UnitDifficultySettings", menuName = "RiftMayhem/Settings/Difficulty/UnitDifficultySettings", order = 0)]
|
|
public class UnitDifficultySettings : ScriptableObject
|
|
{
|
|
[Header("Attack Modifiers:")]
|
|
public float attackDamangeFlatIncrease;
|
|
public float attackDamangePercentIncrease;
|
|
[Header("Spell Modifiers:")]
|
|
public float spellDamangeFlatIncrease;
|
|
public float spellDamangePercentIncrease;
|
|
[Header("Resources Modifiers:")]
|
|
public float maxHealthFlatIncrease;
|
|
public float maxHealthPercentIncrease;
|
|
|
|
public float maxManaPercentIncrease;
|
|
|
|
|
|
|
|
public void SetDifficulty(ref Health health, ref Mana mana, ref CharacterStats stats)
|
|
{
|
|
stats.GetStat("maxhealth").BaseValue += maxHealthFlatIncrease;
|
|
stats.GetStat("maxhealth").RemoveAllModifiersFromSource(GameConstants.ObjectSources.LevelSource);
|
|
stats.GetStat("maxhealth").AddModifier(new StatModifier(maxHealthPercentIncrease, StatModType.PercentAdd, GameConstants.ObjectSources.LevelSource));
|
|
|
|
|
|
stats.GetStat("attackdamage").BaseValue += attackDamangeFlatIncrease;
|
|
stats.GetStat("attackdamage").RemoveAllModifiersFromSource(GameConstants.ObjectSources.LevelSource);
|
|
stats.GetStat("attackdamage").AddModifier(new StatModifier(attackDamangePercentIncrease, StatModType.PercentAdd, GameConstants.ObjectSources.LevelSource));
|
|
|
|
stats.GetStat("spelldamage").BaseValue += spellDamangeFlatIncrease;
|
|
stats.GetStat("spelldamage").RemoveAllModifiersFromSource(GameConstants.ObjectSources.LevelSource);
|
|
stats.GetStat("spelldamage").AddModifier(new StatModifier(spellDamangePercentIncrease, StatModType.PercentAdd, GameConstants.ObjectSources.LevelSource));
|
|
|
|
stats.onUpdateStatValues.Invoke();
|
|
|
|
mana.SetMaxValue((mana.GetMaxValue() * (1f + maxManaPercentIncrease)));
|
|
}
|
|
}
|