Elin Decompiled Documentation EA 23.277 Nightly Patch 1
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 MeteorThing (Point pos, Thing t, bool install=false)
 
void OnAdvanceHour ()
 
void RefreshRewards ()
 
void OnExpandFloor (Point pos)
 
void CheckLoytelDebt ()
 
bool OnMineWreck (Point point)
 
Point GetRandomPoint ()
 
List< SourceChara.RowListUnrecruitedUniques ()
 
void OnUpdateRecruit (FactionBranch branch)
 
void StartRaid ()
 

Public Attributes

Flags flags = new Flags()
 
List< string > listReward = new List<string>()
 

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 (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
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

◆ CheckLoytelDebt()

void SurvivalManager.CheckLoytelDebt ( )
inline

Definition at line 280 of file SurvivalManager.cs.

281 {
282 if (EClass.game.cards.globalCharas.Find("loytel") != null && !EClass.game.quests.IsAdded<QuestDebt>())
283 {
284 Quest quest = EClass.game.quests.Add("debt", "loytel");
285 EClass.game.quests.globalList.Remove(quest);
286 EClass.game.quests.Start(quest);
287 }
288 }
Chara Find(string id)
Definition: CardManager.cs:20
GlobalCharaList globalCharas
Definition: CardManager.cs:46
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
CardManager cards
Definition: Game.cs:156
QuestManager quests
Definition: Game.cs:183
Quest Add(string id, string idGlobalChara=null)
Definition: QuestManager.cs:29
Quest Start(string id, string idGlobalChara)
Definition: QuestManager.cs:41
List< Quest > globalList
Definition: QuestManager.cs:14
Definition: Quest.cs:7

References QuestManager.Add(), Game.cards, CardManager.GlobalCharaList.Find(), EClass.game, CardManager.globalCharas, QuestManager.globalList, Game.quests, and QuestManager.Start().

Referenced by OnExpandFloor(), and OnMineWreck().

◆ GetRaidEvent()

ZoneEventRaid SurvivalManager.GetRaidEvent ( )
inline

Definition at line 146 of file SurvivalManager.cs.

147 {
148 return EClass._zone.events.GetEvent<ZoneEventRaid>();
149 }
static Zone _zone
Definition: EClass.cs:21
ZoneEventManager events
Definition: Zone.cs:40

References EClass._zone, and Zone.events.

◆ GetRandomPoint()

Point SurvivalManager.GetRandomPoint ( )
inline

Definition at line 430 of file SurvivalManager.cs.

431 {
433 Point point = ((traitCoreZone != null) ? traitCoreZone.owner.pos : EClass._map.GetCenterPos());
434 List<Cell> list = new List<Cell>();
435 EClass._map.ForeachSphere(point.x, point.z, 50f, delegate(Point p)
436 {
437 if (!p.IsSky && !p.IsBlocked && !p.HasObj && !p.HasThing)
438 {
439 list.Add(p.cell);
440 }
441 });
442 if (list.Count == 0)
443 {
444 return null;
445 }
446 return list.RandomItem().GetPoint();
447 }
Point pos
Definition: Card.cs:60
static Map _map
Definition: EClass.cs:19
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:224
bool IsBlocked
Definition: Point.cs:363
bool HasThing
Definition: Point.cs:251
bool HasObj
Definition: Point.cs:137
Card owner
Definition: Trait.cs:28

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(), and OnMineWreck().

◆ ListUnrecruitedUniques()

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

Definition at line 449 of file SurvivalManager.cs.

450 {
451 return EClass.sources.charas.rows.Where(delegate(SourceChara.Row r)
452 {
453 if (r.quality != 4 || r.race == "god" || r.size.Length != 0)
454 {
455 return false;
456 }
457 switch (r.id)
458 {
459 case "fiama":
460 case "loytel":
461 case "nino":
462 case "big_daddy":
463 case "littleOne":
464 case "sorin":
465 case "vesda":
466 case "azzrasizzle":
467 return false;
468 default:
469 if (EClass.game.cards.globalCharas.Find(r.id) == null)
470 {
471 return r.LV < flags.raidLv + 10;
472 }
473 return false;
474 }
475 }).ToList();
476 }
static SourceManager sources
Definition: EClass.cs:43
SourceChara charas

References SourceManager.charas, and EClass.sources.

◆ Meteor()

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

Definition at line 151 of file SurvivalManager.cs.

152 {
153 EffectMeteor.Create(pos, 0, 1, delegate
154 {
155 action();
156 });
157 }
static void Create(Point center, int radius, int count, Action< int, Point > onComplete)
Definition: EffectMeteor.cs:33

References EffectMeteor.Create().

◆ MeteorThing() [1/2]

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

Definition at line 159 of file SurvivalManager.cs.

160 {
161 Meteor(pos, delegate
162 {
164 if (card.id == "rod_wish")
165 {
166 card.SetCharge(1);
167 }
168 if (install)
169 {
170 card.Install();
171 }
172 });
173 }
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:1994

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

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

◆ MeteorThing() [2/2]

void SurvivalManager.MeteorThing ( Point  pos,
Thing  t,
bool  install = false 
)
inline

Definition at line 175 of file SurvivalManager.cs.

176 {
177 Meteor(pos, delegate
178 {
179 Card card = EClass._zone.AddCard(t, pos);
180 if (install)
181 {
182 card.Install();
183 }
184 });
185 }

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

◆ OnAdvanceHour()

void SurvivalManager.OnAdvanceHour ( )
inline

Definition at line 187 of file SurvivalManager.cs.

188 {
190 {
191 Point point = new Point(EClass._map.CenterX + 1, EClass._map.CenterZ + 1);
192 if (!point.HasObj)
193 {
194 point.SetObj(46);
195 }
196 }
197 }
int CenterZ
Definition: MapBounds.cs:24
int CenterX
Definition: MapBounds.cs:22
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:928

References EClass._map, EClass._zone, MapBounds.CenterX, MapBounds.CenterZ, Point.HasObj, and Point.SetObj().

Referenced by GameDate.AdvanceHour().

◆ OnExpandFloor()

void SurvivalManager.OnExpandFloor ( Point  pos)
inline

Definition at line 222 of file SurvivalManager.cs.

223 {
224 int i = 0;
225 bool done = false;
226 EClass._map.ForeachCell(delegate(Cell c)
227 {
228 if (!c.sourceFloor.tileType.IsSkipFloor)
229 {
230 i++;
231 }
232 });
233 Check(6, delegate
234 {
235 EClass._zone.ClaimZone(debug: false, pos);
236 });
237 Check(9, delegate
238 {
240 });
241 Check(20, delegate
242 {
243 AddMemeber("fiama");
244 });
245 Check(40, delegate
246 {
247 AddMemeber("nino");
248 });
249 Check(60, delegate
250 {
251 AddMemeber("loytel");
253 });
254 Check(80, delegate
255 {
256 AddMemeber("farris");
257 });
258 Check(100, delegate
259 {
260 EClass._zone.AddCard(ThingGen.Create("core_defense"), pos).Install();
261 });
262 void AddMemeber(string id)
263 {
264 if (EClass.game.cards.globalCharas.Find(id) == null)
265 {
267 }
268 }
269 void Check(int a, Action action)
270 {
271 if (!done && flags.floors < a && i >= a)
272 {
273 Meteor(pos, action);
274 EClass.game.survival.flags.floors = a;
275 done = true;
276 }
277 }
278 }
virtual Chara Chara
Definition: Card.cs:2096
Card Install()
Definition: Card.cs:3795
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:1080
Definition: Check.cs:5
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
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:1729

References EClass._map, EClass._zone, Zone.AddCard(), FactionBranch.AddMemeber(), Game.cards, Card.Chara, CheckLoytelDebt(), Zone.ClaimZone(), ThingGen.Create(), CharaGen.Create(), EClass.debug, CardManager.GlobalCharaList.Find(), flags, SurvivalManager.Flags.floors, Map.ForeachCell(), EClass.game, CardManager.globalCharas, 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 290 of file SurvivalManager.cs.

291 {
292 if (EClass._zone.events.GetEvent<ZoneEventSurvival>() == null)
293 {
295 }
297 SourceObj.Row sourceObj = point.cell.sourceObj;
298 int searchWreck = EClass.game.survival.flags.searchWreck;
299 string[] array = new string[6] { "log", "rock", "branch", "bone", "grass", "vine" };
300 int chanceChange = 25;
301 int num = searchWreck / 50 + 1;
302 if (searchWreck == 0)
303 {
304 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));
305 Pop(t2);
306 }
307 switch (sourceObj.alias)
308 {
309 case "nest_bird":
310 chanceChange = 65;
311 return Pop(ThingGen.Create((EClass.rnd(10) == 0) ? "egg_fertilized" : "_egg").TryMakeRandomItem(num));
312 case "wreck_wood":
313 array = new string[8] { "log", "log", "branch", "grass", "vine", "resin", "leaf", "chunk" };
314 break;
315 case "wreck_junk":
316 chanceChange = 100;
317 return Pop(ThingGen.CreateFromFilter("wreck_junk", num));
318 case "wreck_stone":
319 chanceChange = 30;
320 array = new string[4] { "rock", "rock", "stone", "bone" };
321 break;
322 case "wreck_scrap":
323 chanceChange = 75;
324 array = new string[1] { "scrap" };
325 break;
326 case "wreck_cloth":
327 chanceChange = 75;
328 array = new string[1] { "fiber" };
329 break;
330 case "wreck_precious":
331 chanceChange = 100;
332 return Pop(ThingGen.CreateFromFilter("shop_magic", num));
333 default:
334 return false;
335 }
337 {
340 {
341 case 5:
342 case 6:
343 return Pop(ThingGen.CreateFloor(33, 97).SetNum(3));
344 case 7:
345 case 8:
346 return Pop(ThingGen.CreateFloor(43, 66).SetNum(3));
347 default:
348 return Pop(ThingGen.CreateFloor(40, 45).SetNum(3));
349 }
350 }
351 if (EClass.rnd(20) == 0)
352 {
353 return Pop(TraitSeed.MakeRandomSeed());
354 }
355 if (EClass.rnd(12 + num / 5) == 0)
356 {
357 return Pop(ThingGen.Create("money2"));
358 }
359 if (searchWreck > 10 && EClass.rnd(40 + num) == 0)
360 {
361 TreasureType treasureType = ((EClass.rnd(10) == 0) ? TreasureType.BossNefia : ((EClass.rnd(10) == 0) ? TreasureType.Map : TreasureType.RandomChest));
362 Thing t3 = ThingGen.Create(treasureType switch
363 {
364 TreasureType.Map => "chest_treasure",
365 TreasureType.BossNefia => "chest_boss",
366 _ => "chest3",
367 });
368 ThingGen.CreateTreasureContent(t3, num, treasureType, clearContent: true);
369 MeteorThing(GetRandomPoint(), t3, install: true);
370 }
371 if (EClass.rnd(12) == 0)
372 {
373 Point pos = point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? point;
374 if (searchWreck < 100 || EClass.rnd(3) != 0)
375 {
377 }
378 else
379 {
380 EClass._zone.SpawnMob(pos, SpawnSetting.HomeEnemy(Mathf.Max(num - 5, 1)));
381 }
382 }
383 return Pop(ThingGen.Create(array.RandomItem()).SetNum(1 + EClass.rnd(3)));
384 bool Next()
385 {
387 int searchWreck2 = EClass.game.survival.flags.searchWreck;
388 Point pos2 = point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? point;
389 if (searchWreck2 == 20)
390 {
391 Thing container = ThingGen.CreateParcel(null, ThingGen.CreateRecipe("container_shipping"), ThingGen.CreateRecipe("stonecutter"), ThingGen.CreateRecipe("workbench2"));
392 Meteor(pos2, delegate
393 {
394 EClass._zone.AddCard(container, pos2);
395 });
396 }
397 if (searchWreck2 > (EClass.debug.enable ? 5 : 100) && !flags.gotTaxChest)
398 {
399 MeteorThing(pos2, "chest_tax");
400 flags.gotTaxChest = true;
401 }
402 if (searchWreck2 > (EClass.debug.enable ? 10 : 200) && !flags.gotGaragara)
403 {
404 MeteorThing(pos2, "rolling_fortune");
405 flags.gotGaragara = true;
406 }
407 NextObj();
408 return true;
409 }
410 void NextObj()
411 {
412 if (EClass.rnd(100) < chanceChange)
413 {
414 string[] source = new string[12]
415 {
416 "nest_bird", "wreck_wood", "wreck_wood", "wreck_wood", "wreck_wood", "wreck_wood", "wreck_stone", "wreck_stone", "wreck_scrap", "wreck_junk",
417 "wreck_cloth", "wreck_precious"
418 };
419 EClass._map.SetObj(point.x, point.z, EClass.sources.objs.alias[source.RandomItem()].id);
420 }
421 }
422 bool Pop(Thing t)
423 {
424 EClass._map.TrySmoothPick(point, t, EClass.pc);
425 Next();
426 return true;
427 }
428 }
TreasureType
Definition: TreasureType.cs:2
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
Definition: Card.cs:5507
Thing SetNum(int a)
Definition: Card.cs:3549
SourceObj.Row sourceObj
Definition: Cell.cs:1072
bool enable
Definition: CoreDebug.cs:286
static int rnd(long a)
Definition: EClass.cs:59
SurvivalManager survival
Definition: Game.cs:228
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:619
Cell cell
Definition: Point.cs:51
SourceObj objs
static SpawnSetting HomeWild(int lv)
Definition: SpawnSetting.cs:93
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 void CreateTreasureContent(Thing t, int lv, TreasureType type, bool clearContent)
Definition: ThingGen.cs:263
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:209
Definition: Thing.cs:8
string alias
Definition: TileRow.cs:12
static Thing MakeRandomSeed(bool enc=false)
Definition: TraitSeed.cs:192
void Add(ZoneEvent e, bool allowDuplicate=false)
Chara SpawnMob(string id, Point pos=null)
Definition: Zone.cs:2775

References EClass._map, EClass._zone, ZoneEventManager.Add(), Zone.AddCard(), TileRow.alias, Point.cell, CheckLoytelDebt(), ThingGen.Create(), ThingGen.CreateFloor(), ThingGen.CreateFromFilter(), ThingGen.CreateParcel(), ThingGen.CreateRecipe(), ThingGen.CreateRod(), ThingGen.CreateTreasureContent(), EClass.debug, CoreDebug.enable, Zone.events, flags, EClass.game, Point.GetNearestPoint(), GetRandomPoint(), SurvivalManager.Flags.gotGaragara, 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 478 of file SurvivalManager.cs.

479 {
481 for (int i = 0; i < (EClass.debug.enable ? 10 : 2); i++)
482 {
483 SourceChara.Row row = list.RandomItem();
484 if (row != null)
485 {
486 Chara chara = CharaGen.Create(row.id);
487 chara.RemoveEditorTag(EditorTag.AINoMove);
488 branch.AddRecruit(chara);
489 list.Remove(row);
490 }
491 }
492 }
EditorTag
Definition: EditorTag.cs:2
string id
Definition: CardRow.cs:7
void RemoveEditorTag(EditorTag tag)
Definition: Card.cs:2638
Definition: Chara.cs:10
void AddRecruit(Chara c)
List< SourceChara.Row > ListUnrecruitedUniques()

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

◆ RefreshRewards()

void SurvivalManager.RefreshRewards ( )
inline

Definition at line 199 of file SurvivalManager.cs.

200 {
201 if (listReward.Count <= 0)
202 {
203 Add(new string[7] { "659", "758", "759", "806", "828", "1190", "1191" });
204 if (flags.raidLv < 50)
205 {
206 Add(new string[7] { "pillow_jure", "pillow_ehekatl", "pillow_opatos", "pillow_kumiromi", "pillow_lulwy", "pillow_mani", "pillow_itzpalt" });
207 }
208 else
209 {
210 Add(new string[1] { "rod_wish" });
211 }
212 }
213 void Add(string[] ids)
214 {
215 foreach (string item in ids)
216 {
217 listReward.Add(item);
218 }
219 }
220 }
list. Add(item3)
List< string > listReward

References Add(), flags, item, listReward, and SurvivalManager.Flags.raidLv.

Referenced by ZoneEventRaid.OnKill().

◆ StartRaid()

void SurvivalManager.StartRaid ( )
inline

Definition at line 494 of file SurvivalManager.cs.

495 {
496 flags.raid = true;
497 Point pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? EClass.pc.pos;
498 Meteor(pos, delegate
499 {
500 EClass._zone.AddCard(ThingGen.Create("teleporter_demon"), pos).Install();
501 });
502 flags.dateNextRaid = EClass.world.date.GetRaw(72);
503 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
static World world
Definition: EClass.cs:41
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, and EClass.world.

Referenced by TraitCoreDefense.TrySetAct().

Member Data Documentation

◆ flags

◆ listReward

List<string> SurvivalManager.listReward = new List<string>()

Definition at line 142 of file SurvivalManager.cs.

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

Property Documentation

◆ IsInRaid

bool SurvivalManager.IsInRaid
get

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