forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.cs
More file actions
41 lines (34 loc) · 1.04 KB
/
Copy pathCalculator.cs
File metadata and controls
41 lines (34 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using L2dotNET.DataContracts.Shared.Enums;
namespace L2dotNET.Models.Stats
{
public class Calculator
{
public static Calculator[] GetCalculatorsForStats() => new Calculator[Enum.GetNames(typeof(CharacterStatId)).Length];
public int Size { get; private set; }
private readonly List<StatFunction> _functions;
public Calculator()
{
_functions = new List<StatFunction>();
Size = 0;
}
[MethodImpl(MethodImplOptions.Synchronized)]
public void AddFunc(StatFunction func)
{
Size++;
_functions.Add(func);
}
public void Calculate(StatFunctionEnvironment statFuncEnv)
{
foreach (StatFunction function in _functions.OrderBy(x => x.Order))
{
function.Calculate(statFuncEnv);
}
}
}
}