-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLegendaryDogsWaterFinder.cs
40 lines (32 loc) · 1023 Bytes
/
LegendaryDogsWaterFinder.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
using System;
using XRL.Rules;
namespace XRL.World.Parts
{
[Serializable]
public class LegendaryDogsWaterFinder : IPart
{
public override bool SameAs(IPart p)
{
if (!base.SameAs(p)) return false;
return true;
}
public override void Register(GameObject Object)
{
Object.RegisterPartEvent(this, "EndTurn");
base.Register(Object);
}
public override bool FireEvent(Event E)
{
if (E.ID == "EndTurn"
&& !ParentObject.AreHostilesNearby()
&& ParentObject.CurrentCell.ParentZone.Z <= 10
&& string.IsNullOrEmpty(ParentObject.CurrentCell.GroundLiquid)
&& Stat.Random(1, 20) == 20)
{
GameObject Water = GameObjectFactory.Factory.CreateObject("Water", Stat.Random(1, 4));
ParentObject.CurrentCell.AddObject(Water);
}
return base.FireEvent(E);
}
}
}