-
Notifications
You must be signed in to change notification settings - Fork 6
/
effecthestation.cs
74 lines (59 loc) · 1.7 KB
/
effecthestation.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
62
63
64
65
66
67
68
69
70
71
72
73
74
using XRL.UI;
using XRL.Rules;
using System.Collections.Generic;
using XRL.World.Parts;
using XRL.Core;
namespace XRL.World.Effects
{
public class acegiak_EffectHesitation : BasicCookingEffect
{
public int storedXp;
public int storedRep;
public bool target = false;
public acegiak_EffectHesitation()
{
base.DisplayName = "&Mhesitation";
base.Duration = 5;
}
public override string GetDetails()
{
return "Momentarily non-hostile.";
}
public override void ApplyEffect(GameObject ParentObject)
{
storedRep = ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body);
storedXp = ParentObject.Statistics["XPValue"].BaseValue;
// if (ParentObject.pBrain.Target == XRLCore.Core.Game.Player.Body)
// {
// ParentObject.pBrain.Goals.Clear();
// target = true;
// }
ParentObject.pBrain.StopFighting(XRLCore.Core.Game.Player.Body,true);
ParentObject.Statistics["XPValue"].BaseValue = 0;
ParentObject.pBrain.SetFeeling(XRLCore.Core.Game.Player.Body, 0);
}
public override void RemoveEffect(GameObject ParentObject)
{
ParentObject.Statistics["XPValue"].BaseValue = storedXp;
int current = ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body);
ParentObject.pBrain.SetFeeling(XRLCore.Core.Game.Player.Body, current+storedRep);
if(target){
ParentObject.pBrain.Goals.Clear();
ParentObject.pBrain.Target = XRLCore.Core.Game.Player.Body;
}
}
public override bool WantEvent(int ID, int cascade)
{
if (!base.WantEvent(ID, cascade))
{
return ID == BeginTakeActionEvent.ID;
}
return true;
}
public override bool HandleEvent(BeginTakeActionEvent E)
{
base.Duration--;
return base.HandleEvent(E);
}
}
}