Elin Decompiled Documentation EA 23.188 Stable
Loading...
Searching...
No Matches
SurvivalManager Class Reference
Inheritance diagram for SurvivalManager:
EClass

Classes

class  Flags
 

Public Member Functions

ZoneEventRaid GetRaidEvent ()
 
void Meteor (Point pos, Action action)
 
void MeteorThing (Point pos, string id, bool install=false)
 
void OnExpandFloor (Point pos)
 
bool OnMineWreck (Point point)
 
Point GetRandomPoint ()
 
List< SourceChara.RowListUnrecruitedUniques ()
 
void OnUpdateRecruit (FactionBranch branch)
 
void StartRaid ()
 

Public Attributes

Flags flags = new Flags()
 

Properties

bool IsInRaid [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 8 of file SurvivalManager.cs.

Member Function Documentation

◆ GetRaidEvent()

ZoneEventRaid SurvivalManager.GetRaidEvent ( )
inline

Definition at line 131 of file SurvivalManager.cs.

132 {
133 return EClass._zone.events.GetEvent<ZoneEventRaid>();
134 }
Definition: EClass.cs:5
static Zone _zone
Definition: EClass.cs:20
ZoneEventManager events
Definition: Zone.cs:40

References EClass._zone, and Zone.events.

◆ GetRandomPoint()

Point SurvivalManager.GetRandomPoint ( )
inline

Definition at line 313 of file SurvivalManager.cs.

314 {
316 Point point = ((traitCoreZone != null) ? traitCoreZone.owner.pos : EClass._map.GetCenterPos());
317 List<Cell> list = new List<Cell>();
318 EClass._map.ForeachSphere(point.x, point.z, 50f, delegate(Point p)
319 {
320 if (!p.IsSky && !p.IsBlocked && !p.HasObj && !p.HasThing)
321 {
322 list.Add(p.cell);
323 }
324 });
325 if (list.Count == 0)
326 {
327 return null;
328 }
329 return list.RandomItem().GetPoint();
330 }
Point pos
Definition: Card.cs:57
static Map _map
Definition: EClass.cs:18
Point GetCenterPos()
Definition: MapBounds.cs:52
Thing FindThing(Func< Thing, bool > func)
Definition: Map.cs:2592
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Definition: Map.cs:2380
Definition: Point.cs:9
bool IsSky
Definition: Point.cs:212
bool IsBlocked
Definition: Point.cs:351
bool HasThing
Definition: Point.cs:239
bool HasObj
Definition: Point.cs:137
Card owner
Definition: Trait.cs:27

References EClass._map, Map.FindThing(), Map.ForeachSphere(), MapBounds.GetCenterPos(), Point.HasObj, Point.HasThing, Point.IsBlocked, Point.IsSky, Trait.owner, and Card.pos.

Referenced by ZoneEventRaid.OnKill().

◆ ListUnrecruitedUniques()

List< SourceChara.Row > SurvivalManager.ListUnrecruitedUniques ( )
inline

Definition at line 332 of file SurvivalManager.cs.

333 {
334 return EClass.sources.charas.rows.Where(delegate(SourceChara.Row r)
335 {
336 if (r.quality != 4 || r.race == "god" || r.size.Length != 0)
337 {
338 return false;
339 }
340 switch (r.id)
341 {
342 case "fiama":
343 case "loytel":
344 case "nino":
345 case "big_daddy":
346 case "littleOne":
347 return false;
348 default:
349 return EClass.game.cards.globalCharas.Find(r.id) == null;
350 }
351 }).ToList();
352 }
static SourceManager sources
Definition: EClass.cs:42
SourceChara charas

References SourceManager.charas, and EClass.sources.

◆ Meteor()

void SurvivalManager.Meteor ( Point  pos,
Action  action 
)
inline

Definition at line 136 of file SurvivalManager.cs.

137 {
138 EffectMeteor.Create(pos, 0, 1, delegate
139 {
140 action();
141 });
142 }
static void Create(Point center, int radius, int count, Action< int, Point > onComplete)
Definition: EffectMeteor.cs:33

References EffectMeteor.Create().

◆ MeteorThing()

void SurvivalManager.MeteorThing ( Point  pos,
string  id,
bool  install = false 
)
inline

Definition at line 144 of file SurvivalManager.cs.

145 {
146 Meteor(pos, delegate
147 {
149 if (install)
150 {
151 card.Install();
152 }
153 });
154 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
Definition: Card.cs:11
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Card AddCard(Card t, Point point)
Definition: Zone.cs:1937

References EClass._zone, Zone.AddCard(), card, ThingGen.Create(), if(), and Meteor.

Referenced by ZoneEventRaid.OnKill(), and OnMineWreck().

◆ OnExpandFloor()

void SurvivalManager.OnExpandFloor ( Point  pos)
inline

Definition at line 156 of file SurvivalManager.cs.

157 {
158 int i = 0;
159 bool done = false;
160 EClass._map.ForeachCell(delegate(Cell c)
161 {
162 if (!c.sourceFloor.tileType.IsSkipFloor)
163 {
164 i++;
165 }
166 });
167 Check(6, delegate
168 {
169 EClass._zone.ClaimZone(debug: false, pos);
170 });
171 Check(9, delegate
172 {
174 });
175 Check(20, delegate
176 {
178 });
179 Check(40, delegate
180 {
182 });
183 Check(60, delegate
184 {
186 });
187 Check(80, delegate
188 {
189 EClass._zone.AddCard(ThingGen.Create("core_defense"), pos).Install();
190 });
191 void Check(int a, Action action)
192 {
193 if (!done && flags.floors < a && i >= a)
194 {
195 Meteor(pos, action);
196 EClass.game.survival.flags.floors = a;
197 done = true;
198 }
199 }
200 }
virtual Chara Chara
Definition: Card.cs:2032
Card Install()
Definition: Card.cs:3633
Definition: Cell.cs:7
SourceFloor.Row sourceFloor
Definition: Cell.cs:1054
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
FactionBranch homeBranch
Definition: Chara.cs:1052
Definition: Check.cs:5
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
void AddMemeber(Chara c)
new void ForeachCell(Action< Cell > action)
Definition: Map.cs:2346
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
void ClaimZone(bool debug=false, Point pos=null)
Definition: Zone.cs:1700

References EClass._map, EClass._zone, Zone.AddCard(), FactionBranch.AddMemeber(), Card.Chara, Zone.ClaimZone(), ThingGen.Create(), CharaGen.Create(), EClass.debug, flags, SurvivalManager.Flags.floors, Map.ForeachCell(), Chara.homeBranch, Card.Install(), Meteor, EClass.pc, Cell.sourceFloor, Point.x, and Point.z.

Referenced by TaskBuild.OnProgressComplete().

◆ OnMineWreck()

bool SurvivalManager.OnMineWreck ( Point  point)
inline

Definition at line 202 of file SurvivalManager.cs.

203 {
204 if (EClass._zone.events.GetEvent<ZoneEventSurvival>() == null)
205 {
207 }
208 SourceObj.Row sourceObj = point.cell.sourceObj;
209 int searchWreck = EClass.game.survival.flags.searchWreck;
210 string[] array = new string[6] { "log", "rock", "branch", "bone", "grass", "vine" };
211 int chanceChange = 25;
212 int num = searchWreck / 50 + 3;
213 if (searchWreck == 0)
214 {
215 Thing t2 = ThingGen.CreateParcel(null, ThingGen.Create("log").SetNum(6), ThingGen.Create("rock").SetNum(4), ThingGen.Create("resin").SetNum(2), ThingGen.Create("money2").SetNum(10), ThingGen.Create("1267"), ThingGen.CreateRod(50311, 8));
216 Pop(t2);
217 }
218 switch (sourceObj.alias)
219 {
220 case "nest_bird":
221 chanceChange = 65;
222 return Pop(ThingGen.Create((EClass.rnd(10) == 0) ? "egg_fertilized" : "_egg").TryMakeRandomItem(num));
223 case "wreck_wood":
224 array = new string[8] { "log", "log", "branch", "grass", "vine", "resin", "leaf", "chunk" };
225 break;
226 case "wreck_junk":
227 chanceChange = 100;
228 return Pop(ThingGen.CreateFromFilter("shop_junk", num));
229 case "wreck_stone":
230 chanceChange = 30;
231 array = new string[4] { "rock", "rock", "stone", "bone" };
232 break;
233 case "wreck_scrap":
234 chanceChange = 75;
235 array = new string[1] { "scrap" };
236 break;
237 case "wreck_cloth":
238 chanceChange = 75;
239 array = new string[1] { "fiber" };
240 break;
241 case "wreck_precious":
242 chanceChange = 100;
243 return Pop(ThingGen.CreateFromFilter("shop_magic", num));
244 default:
245 return false;
246 }
247 if (EClass.rnd(3) == 0 && EClass.game.survival.flags.spawnedFloor < 4)
248 {
250 return Pop(ThingGen.CreateFloor(40, 45).SetNum(3));
251 }
252 if (EClass.rnd(20) == 0)
253 {
254 return Pop(TraitSeed.MakeRandomSeed());
255 }
256 if (EClass.rnd(12) == 0)
257 {
258 return Pop(ThingGen.Create("money2"));
259 }
260 if (EClass.rnd(12) == 0)
261 {
262 Point pos = point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? point;
263 if (searchWreck < 50 || EClass.rnd(3) != 0)
264 {
266 }
267 else
268 {
269 EClass._zone.SpawnMob(pos, SpawnSetting.HomeEnemy(Mathf.Max(num - 5, 1)));
270 }
271 }
272 return Pop(ThingGen.Create(array.RandomItem()).SetNum(1 + EClass.rnd(3)));
273 bool Next()
274 {
276 int searchWreck2 = EClass.game.survival.flags.searchWreck;
277 Point pos2 = point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? point;
278 if (searchWreck2 == 20)
279 {
280 Meteor(pos2, delegate
281 {
282 EClass._zone.AddCard(ThingGen.CreateRecipe("container_shipping"), pos2);
283 });
284 }
285 if (searchWreck2 > (EClass.debug.enable ? 5 : 100) && !flags.gotTaxChest)
286 {
287 MeteorThing(pos2, "chest_tax");
288 flags.gotTaxChest = true;
289 }
290 NextObj();
291 return true;
292 }
293 void NextObj()
294 {
295 if (EClass.rnd(100) < chanceChange)
296 {
297 string[] source = new string[12]
298 {
299 "nest_bird", "wreck_wood", "wreck_wood", "wreck_wood", "wreck_wood", "wreck_wood", "wreck_stone", "wreck_stone", "wreck_scrap", "wreck_junk",
300 "wreck_cloth", "wreck_precious"
301 };
302 EClass._map.SetObj(point.x, point.z, EClass.sources.objs.alias[source.RandomItem()].id);
303 }
304 }
305 bool Pop(Thing t)
306 {
307 EClass._map.TrySmoothPick(point, t, EClass.pc);
308 Next();
309 return true;
310 }
311 }
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
Definition: Card.cs:5204
Thing SetNum(int a)
Definition: Card.cs:3393
SourceObj.Row sourceObj
Definition: Cell.cs:1072
bool enable
Definition: CoreDebug.cs:286
static Game game
Definition: EClass.cs:8
static int rnd(long a)
Definition: EClass.cs:58
SurvivalManager survival
Definition: Game.cs:224
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1804
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1535
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:607
Cell cell
Definition: Point.cs:51
SourceObj objs
static SpawnSetting HomeWild(int lv)
Definition: SpawnSetting.cs:91
static SpawnSetting HomeEnemy(int lv)
void MeteorThing(Point pos, string id, bool install=false)
static Thing CreateFromFilter(string id, int lv=-1)
Definition: ThingGen.cs:63
static Thing CreateParcel(string idLang=null, params Thing[] things)
Definition: ThingGen.cs:42
static Thing CreateFloor(int id, int idMat, bool platform=false)
Definition: ThingGen.cs:108
static Thing CreateRecipe(string id)
Definition: ThingGen.cs:144
static Thing CreateRod(int ele, int charge=-1)
Definition: ThingGen.cs:193
Definition: Thing.cs:8
string alias
Definition: TileRow.cs:12
static Thing MakeRandomSeed(bool enc=false)
Definition: TraitSeed.cs:187
void Add(ZoneEvent e, bool allowDuplicate=false)
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
Definition: Zone.cs:2691

References EClass._map, EClass._zone, ZoneEventManager.Add(), Zone.AddCard(), TileRow.alias, Point.cell, ThingGen.Create(), ThingGen.CreateFloor(), ThingGen.CreateFromFilter(), ThingGen.CreateParcel(), ThingGen.CreateRecipe(), ThingGen.CreateRod(), EClass.debug, CoreDebug.enable, Zone.events, flags, EClass.game, Point.GetNearestPoint(), SurvivalManager.Flags.gotTaxChest, SpawnSetting.HomeEnemy(), SpawnSetting.HomeWild(), TraitSeed.MakeRandomSeed(), Meteor, MeteorThing(), Next, SourceManager.objs, EClass.pc, EClass.rnd(), SurvivalManager.Flags.searchWreck, Card.SetNum(), Map.SetObj(), Cell.sourceObj, EClass.sources, SurvivalManager.Flags.spawnedFloor, Zone.SpawnMob(), Game.survival, Card.TryMakeRandomItem(), Map.TrySmoothPick(), Point.x, and Point.z.

Referenced by Map.MineObj().

◆ OnUpdateRecruit()

void SurvivalManager.OnUpdateRecruit ( FactionBranch  branch)
inline

Definition at line 354 of file SurvivalManager.cs.

355 {
357 for (int i = 0; i < (EClass.debug.enable ? 10 : 2); i++)
358 {
359 SourceChara.Row row = list.RandomItem();
360 if (row != null)
361 {
362 Chara chara = CharaGen.Create(row.id);
363 chara.RemoveEditorTag(EditorTag.AINoMove);
364 branch.AddRecruit(chara);
365 list.Remove(row);
366 }
367 }
368 }
EditorTag
Definition: EditorTag.cs:2
string id
Definition: CardRow.cs:7
void RemoveEditorTag(EditorTag tag)
Definition: Card.cs:2572
Definition: Chara.cs:10
void AddRecruit(Chara c)
List< SourceChara.Row > ListUnrecruitedUniques()

References FactionBranch.AddRecruit(), CharaGen.Create(), CardRow.id, and Card.RemoveEditorTag().

◆ StartRaid()

void SurvivalManager.StartRaid ( )
inline

Definition at line 370 of file SurvivalManager.cs.

371 {
372 SE.Play("warhorn");
373 Msg.Say("warhorn");
374 flags.raid = true;
375 Point pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? EClass.pc.pos;
376 Meteor(pos, delegate
377 {
378 EClass._zone.AddCard(ThingGen.Create("teleporter_demon"), pos).Install();
379 });
380 flags.dateNextRaid = EClass.world.date.GetRaw(72);
381 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
static World world
Definition: EClass.cs:40
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
GameDate date
Definition: World.cs:6

References EClass._zone, Zone.AddCard(), ThingGen.Create(), World.date, Point.GetNearestPoint(), Date.GetRaw(), Card.Install(), Meteor, EClass.pc, Card.pos, Msg.Say(), and EClass.world.

Referenced by ZoneEventSurvival.OnTickRound(), and TraitCoreDefense.TrySetAct().

Member Data Documentation

◆ flags

Property Documentation

◆ IsInRaid

bool SurvivalManager.IsInRaid
get

The documentation for this class was generated from the following file: