[#14] rozbudowa stats + dodanie modyfikatorów

This commit is contained in:
2026-06-30 20:28:51 +02:00
parent 86b4a8a93f
commit 8326c4b279
33 changed files with 444 additions and 129 deletions
@@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Linq;
using RPGCore.Core.Objects;
namespace RPGCore.Stats.ObjectModules.StatsObjectModule
{
public class StatModifierContext
{
private readonly List<StatModifier> _modifiers = new();
public int add => _modifiers.Where(m => m.type is StatModifierType.Add).Sum(m => m.value);
public int multiply => _modifiers.Where(m => m.type is StatModifierType.Multiply).Sum(m => m.value);
public int @override => _modifiers.Where(m => m.type is StatModifierType.Override).Max(m => m.value);
public void Add(StatModifier modifier)
{
_modifiers.Add(modifier);
}
public void Remove(StatModifier modifier)
{
_modifiers.Remove(modifier);
}
public void RemoveBySource(BaseObject source)
{
_modifiers.RemoveAll(m => m.source == source);
}
}
}