forked from GarwelGarwel/KerbalHealth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConditionsFactor.cs
27 lines (23 loc) · 934 Bytes
/
ConditionsFactor.cs
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
namespace KerbalHealth
{
public class ConditionsFactor : HealthFactor
{
public override string Name => "Conditions";
// Not applicable to this factor
public override double BaseChangePerDay => 0;
public override bool Cachable => false;
public override void ResetEnabledInEditor() => SetEnabledInEditor(false);
public override double ChangePerDay(ProtoCrewMember pcm)
{
if (!Core.ConditionsEnabled) return 0;
KerbalHealthStatus khs = Core.KerbalHealthList.Find(pcm);
if (khs == null) return 0;
float k = Core.ConditionsEffect;
double res = 0;
foreach (HealthCondition hc in khs.Conditions)
res += hc.HPChangePerDay * k;
Core.Log("Conditions HP chande per day: " + res);
return Core.IsInEditor ? (IsEnabledInEditor() ? res : 0) : res;
}
}
}