-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFireDamage.cs
61 lines (54 loc) · 1.82 KB
/
FireDamage.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace PFW.Damage
{
class FireDamage : Damage
{
public struct FireData
{
/// <summary>
/// Power of the burning effect
/// </summary>
public float Power;
/// <summary>
/// Multiplier for health damage
/// </summary>
public float HealthDamageFactor;
/// <summary>
/// Multiplier for armor degradation
/// </summary>
public float Degradation;
/// <summary>
/// A minimum damage dealt to vehicles in the fire
/// Represents the damge to the crew by suffocation and heat
/// </summary>
public float SuffocationDamage;
}
private FireData _fireData;
public FireDamage(FireData data, Target target) : base(DamageTypes.FIRE, target)
{
_fireData = data;
}
public override Target CalculateDamage()
{
Target finalState = this.CurrentTarget;
// Armor degradation
float finalArmor = Math.Max(
0.0f,
finalState.Armor - (_fireData.Power / finalState.Armor) * _fireData.Degradation
);
// Calculate damage
// If the power is less than the armor, deal a minimum amount of damage
// This represents the damage dealt to the crew due to high temperature and suffocation
float finalDamage = Math.Max(
_fireData.SuffocationDamage,
(_fireData.Power - finalState.Armor) * _fireData.HealthDamageFactor
);
finalState.Health -= finalDamage;
return finalState;
}
}
}