RiftMayhem/Assets/Scripts/Difficulty/UnitDifficultySettings.cs
Pedro Gomes d12942bff4 World Jobs Listing Board interactable
Whole interactable world-board with different zones and jobs ready to be completed.

- party voting for job selection & scene swapping
- fully working scene change between inn and skellyard
- updated many systems with lots of new information
- bunch of new UIs to acomodate new job and scene swapping voting systems
2024-05-13 01:15:58 +01:00

45 lines
1.7 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("Main Stat Modifiers:")]
public float mainBaseStatFlatIncrease;
public float mainStatPercentIncrease;
[Header("Secondary Stats Modifiers:")]
public float secondaryBaseStatsFlatIncrease;
public float secondaryStatsPercentIncrease;
[Header("Resources Modifiers:")]
public float maxHealthPercentIncrease;
public float maxManaPercentIncrease;
private bool randomizedMainStat;
public void SetDifficulty(ref Health health, ref Mana mana, ref CharacterStats stats)
{
randomizedMainStat = false;
foreach (string stat in stats.statsDictionary.Keys)
{
if (Random.Range(0, 101) < 40 && !randomizedMainStat)
{
randomizedMainStat = true;
stats.statsDictionary[stat].BaseValue += mainBaseStatFlatIncrease;
stats.statsDictionary[stat].AddModifier(new StatModifier(mainStatPercentIncrease, StatModType.PercentMult, this));
}
else
{
stats.statsDictionary[stat].BaseValue += secondaryBaseStatsFlatIncrease;
stats.statsDictionary[stat].AddModifier(new StatModifier(secondaryStatsPercentIncrease, StatModType.PercentMult, this));
}
}
health.SetMaxValue((health.GetMaxValue() * (1f + maxHealthPercentIncrease)));
mana.SetMaxValue((mana.GetMaxValue() * (1f + maxManaPercentIncrease)));
}
}