Elin Decompiled Documentation EA 23.279 Nightly Patch 1
Loading...
Searching...
No Matches
TraitSpotBiome.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2
4{
5 public override int radius => 6;
6
7 public override bool HaveUpdate => true;
8
9 public override void Update()
10 {
12 {
13 return;
14 }
15 Point randomPoint = GetRandomPoint();
16 if (randomPoint.IsSky || randomPoint.HasObj || randomPoint.HasBlock || randomPoint.HasThing || randomPoint.cell.room != null)
17 {
18 return;
19 }
21 {
22 int num = 0;
23 foreach (Thing thing2 in EClass._map.props.installed.things)
24 {
25 if (thing2.trait is TraitSpotBiome)
26 {
27 num++;
28 }
29 }
30 int num2 = CountNotableThing();
31 if (EClass.rnd(num * 10) == 0)
32 {
33 if (num2 < 2)
34 {
35 string text = ((EClass.rnd(10) == 0) ? "statue_god" : ((EClass.rnd(2) == 0) ? "statue_power" : "altar"));
36 if (text == "altar" && EClass.rnd(20) == 0)
37 {
38 text = ((EClass.rnd(5) == 0) ? "altar_machine" : ((EClass.rnd(3) == 0) ? "altar_fox" : ((EClass.rnd(2) == 0) ? "altar_fox2" : "altar_strife")));
39 }
40 Thing thing = ThingGen.Create(text);
41 thing.SetPriceFix(-100);
42 EClass._zone.AddCard(thing, randomPoint).Install();
43 }
44 if (EClass.rnd(40) == 0 && EClass._map.FindChara("big_daddy") == null)
45 {
47 {
48 lv = EClass.game.survival.flags.raidLv + 10
49 });
50 Chara t = CharaGen.Create("big_daddy");
51 EClass._zone.AddCard(t, randomPoint);
52 Msg.Say("sign_bigdaddy");
53 }
54 return;
55 }
56 }
57 bool valid = true;
58 owner.pos.ForeachNeighbor(delegate(Point p)
59 {
60 if (valid)
61 {
62 foreach (Thing thing3 in p.Things)
63 {
64 if (thing3 != owner && thing3.trait is TraitSpotBiome && EClass.rnd(2) == 0)
65 {
66 valid = false;
67 }
68 }
69 }
70 });
71 if (!valid)
72 {
73 return;
74 }
75 if (EClass.rnd(5) == 0)
76 {
78 {
79 EClass._zone.SpawnMob(randomPoint, SpawnSetting.HomeWild(1));
80 }
81 else
82 {
83 EClass._zone.SpawnMob(randomPoint);
84 }
85 }
86 else
87 {
88 randomPoint.cell.biome.Populate(randomPoint, interior: false, 100f);
89 }
90 }
91
92 public int CountNotableThing(bool tryRemove = true)
93 {
94 int num = 0;
95 List<Thing> listRemove = new List<Thing>();
96 foreach (Point item in ListPoints(null, onlyPassable: false))
97 {
98 if (!item.HasThing)
99 {
100 continue;
101 }
102 foreach (Thing thing in item.Things)
103 {
104 if (!thing.IsInstalled)
105 {
106 continue;
107 }
108 if (thing.trait is TraitAltar)
109 {
110 num++;
111 if (tryRemove && thing.c_priceFix == -100)
112 {
113 TryRemove(thing, 4);
114 }
115 }
116 else if (thing.trait is TraitPowerStatue)
117 {
118 num++;
119 if (tryRemove && !thing.isOn && thing.c_priceFix == -100)
120 {
121 TryRemove(thing, 2);
122 }
123 }
124 }
125 }
126 if (tryRemove)
127 {
128 foreach (Thing item2 in listRemove)
129 {
130 item2.Destroy();
131 }
132 }
133 return num;
134 void TryRemove(Thing t, int h)
135 {
136 if (t.c_dateStockExpire == 0)
137 {
138 t.c_dateStockExpire = EClass.world.date.GetRaw(h);
139 }
141 {
142 listRemove.Add(t);
143 }
144 }
145 }
146}
void Populate(Point point, bool interior=false, float mtpDensity=1f)
static void Set(CardBlueprint _bp=null)
int c_priceFix
Definition: Card.cs:1138
Point pos
Definition: Card.cs:60
Trait trait
Definition: Card.cs:54
int c_dateStockExpire
Definition: Card.cs:1247
void Destroy()
Definition: Card.cs:5132
bool IsInstalled
Definition: Card.cs:2409
bool isOn
Definition: Card.cs:543
Thing SetPriceFix(int a)
Definition: Card.cs:7367
Card Install()
Definition: Card.cs:3795
Room room
Definition: Cell.cs:102
BiomeProfile biome
Definition: Cell.cs:1075
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Definition: Chara.cs:10
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
bool IsExpired(int time)
Definition: Date.cs:338
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
SurvivalManager survival
Definition: Game.cs:228
bool IsSurvival
Definition: Game.cs:276
Chara FindChara(string id)
Definition: Map.cs:2568
PropsManager props
Definition: Map.cs:91
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: Point.cs:9
bool IsSky
Definition: Point.cs:224
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1397
List< Thing > Things
Definition: Point.cs:338
bool HasThing
Definition: Point.cs:251
bool HasObj
Definition: Point.cs:137
bool HasBlock
Definition: Point.cs:141
Cell cell
Definition: Point.cs:51
PropsInstalled installed
Definition: PropsManager.cs:8
List< Thing > things
Definition: Props.cs:20
static SpawnSetting HomeWild(int lv)
Definition: SpawnSetting.cs:93
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override void Update()
override bool HaveUpdate
int CountNotableThing(bool tryRemove=true)
override int radius
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
Definition: Trait.cs:779
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:761
Card owner
Definition: Trait.cs:28
GameDate date
Definition: World.cs:6
bool IsPCFactionOrTent
Definition: Zone.cs:478
Chara SpawnMob(string id, Point pos=null)
Definition: Zone.cs:2775
Card AddCard(Card t, Point point)
Definition: Zone.cs:1994