-
Notifications
You must be signed in to change notification settings - Fork 4
/
CookingUnitBludgeonResist.cs
54 lines (47 loc) · 1.37 KB
/
CookingUnitBludgeonResist.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
using System;
using XRL.Rules;
namespace XRL.World.Effects
{
[Serializable]
public class CookingDomainStrongBones_BludgeonDamageReduction : ProceduralCookingEffectUnit
{
public int Tier;
public override string GetDescription()
{
return "-" + Tier + "0% damage from cudgel, falling, and concussive damage.";
}
public override string GetTemplatedDescription()
{
return "Reduced damage from cudgel, falling, and concussive damage.";
}
public override void Init(GameObject target)
{
Tier = Stat.Random(1, 4);
}
public override void Apply(GameObject Object, Effect parent)
{
Object.RegisterEffectEvent(parent, "BeforeApplyDamage");
}
public override void Remove(GameObject Object, Effect parent)
{
Object.UnregisterEffectEvent(parent, "BeforeApplyDamage");
}
public override void FireEvent(Event E)
{
if (E.ID == "BeforeApplyDamage")
{
Damage damage = E.GetParameter("Damage") as Damage;
if (damage.HasAttribute("Crushing") || damage.HasAttribute("Cudgel") || damage.HasAttribute("Concussion"))
{
// if (damage.Amount > 0 && ParentObject.IsPlayer())
// {
// MessageQueue.AddPlayerMessage("&rYou feel your bones fracture.");
// }
float multiplier = 1f-(Tier*0.1f);
damage.Amount = (int)((float)damage.Amount * multiplier);
E.AddParameter("Damage", damage);
}
}
}
}
}