Elin Decompiled Documentation EA 23.188 Stable Patch 2
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 if (EClass.rnd(5) == 0)
58 {
60 {
61 EClass._zone.SpawnMob(randomPoint, SpawnSetting.HomeWild(1));
62 }
63 else
64 {
65 EClass._zone.SpawnMob(randomPoint);
66 }
67 }
68 else
69 {
70 randomPoint.cell.biome.Populate(randomPoint, interior: false, 100f);
71 }
72 }
73
74 public int CountNotableThing(bool tryRemove = true)
75 {
76 int num = 0;
77 List<Thing> listRemove = new List<Thing>();
78 foreach (Point item in ListPoints(null, onlyPassable: false))
79 {
80 if (!item.HasThing)
81 {
82 continue;
83 }
84 foreach (Thing thing in item.Things)
85 {
86 if (!thing.IsInstalled)
87 {
88 continue;
89 }
90 if (thing.trait is TraitAltar)
91 {
92 num++;
93 if (tryRemove && thing.c_priceFix == -100)
94 {
95 TryRemove(thing, 4);
96 }
97 }
98 else if (thing.trait is TraitPowerStatue)
99 {
100 num++;
101 if (tryRemove && !thing.isOn && thing.c_priceFix == -100)
102 {
103 TryRemove(thing, 2);
104 }
105 }
106 }
107 }
108 if (tryRemove)
109 {
110 foreach (Thing item2 in listRemove)
111 {
112 item2.Destroy();
113 }
114 }
115 return num;
116 void TryRemove(Thing t, int h)
117 {
118 if (t.c_dateStockExpire == 0)
119 {
120 t.c_dateStockExpire = EClass.world.date.GetRaw(h);
121 }
123 {
124 listRemove.Add(t);
125 }
126 }
127 }
128}
void Populate(Point point, bool interior=false, float mtpDensity=1f)
static void Set(CardBlueprint _bp)
int c_priceFix
Definition: Card.cs:1111
Trait trait
Definition: Card.cs:51
int c_dateStockExpire
Definition: Card.cs:1207
void Destroy()
Definition: Card.cs:4850
bool IsInstalled
Definition: Card.cs:2343
bool isOn
Definition: Card.cs:528
Thing SetPriceFix(int a)
Definition: Card.cs:6846
Card Install()
Definition: Card.cs:3633
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:322
bool IsExpired(int time)
Definition: Date.cs:332
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Zone _zone
Definition: EClass.cs:20
static World world
Definition: EClass.cs:40
static Map _map
Definition: EClass.cs:18
static int rnd(long a)
Definition: EClass.cs:58
SurvivalManager survival
Definition: Game.cs:224
bool IsSurvival
Definition: Game.cs:272
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:212
bool HasThing
Definition: Point.cs:239
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:91
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:748
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:730
Card owner
Definition: Trait.cs:27
GameDate date
Definition: World.cs:6
bool IsPCFactionOrTent
Definition: Zone.cs:473
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
Definition: Zone.cs:2691
Card AddCard(Card t, Point point)
Definition: Zone.cs:1937