Elin Decompiled Documentation EA 23.239 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 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 (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

◆ CheckLoytelDebt()

void SurvivalManager.CheckLoytelDebt ( )
inline

Definition at line 268 of file SurvivalManager.cs.

269 {
270 if (EClass.game.cards.globalCharas.Find("loytel") != null && !EClass.game.quests.IsAdded<QuestDebt>())
271 {
272 Quest quest = EClass.game.quests.Add("debt", "loytel");
273 EClass.game.quests.globalList.Remove(quest);
274 EClass.game.quests.Start(quest);
275 }
276 }
Chara Find(string id)
Definition: CardManager.cs:20
GlobalCharaList globalCharas
Definition: CardManager.cs:46
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
CardManager cards
Definition: Game.cs:155
QuestManager quests
Definition: Game.cs:182
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:20
ZoneEventManager events
Definition: Zone.cs:40

References EClass._zone, and Zone.events.

◆ GetRandomPoint()

Point SurvivalManager.GetRandomPoint ( )
inline

Definition at line 418 of file SurvivalManager.cs.

419 {
421 Point point = ((traitCoreZone != null) ? traitCoreZone.owner.pos : EClass._map.GetCenterPos());
422 List<Cell> list = new List<Cell>();
423 EClass._map.ForeachSphere(point.x, point.z, 50f, delegate(Point p)
424 {
425 if (!p.IsSky && !p.IsBlocked && !p.HasObj && !p.HasThing)
426 {
427 list.Add(p.cell);
428 }
429 });
430 if (list.Count == 0)
431 {
432 return null;
433 }
434 return list.RandomItem().GetPoint();
435 }
Point pos
Definition: Card.cs:59
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:224
bool IsBlocked
Definition: Point.cs:363
bool HasThing
Definition: Point.cs:251
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(), and OnMineWreck().

◆ ListUnrecruitedUniques()

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

Definition at line 437 of file SurvivalManager.cs.

438 {
439 return EClass.sources.charas.rows.Where(delegate(SourceChara.Row r)
440 {
441 if (r.quality != 4 || r.race == "god" || r.size.Length != 0)
442 {
443 return false;
444 }
445 switch (r.id)
446 {
447 case "fiama":
448 case "loytel":
449 case "nino":
450 case "big_daddy":
451 case "littleOne":
452 case "sorin":
453 case "vesda":
454 case "azzrasizzle":
455 return false;
456 default:
457 if (EClass.game.cards.globalCharas.Find(r.id) == null)
458 {
459 return r.LV < flags.raidLv + 10;
460 }
461 return false;
462 }
463 }).ToList();
464 }
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 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:1959

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.

◆ OnExpandFloor()

void SurvivalManager.OnExpandFloor ( Point  pos)
inline

Definition at line 210 of file SurvivalManager.cs.

211 {
212 int i = 0;
213 bool done = false;
214 EClass._map.ForeachCell(delegate(Cell c)
215 {
216 if (!c.sourceFloor.tileType.IsSkipFloor)
217 {
218 i++;
219 }
220 });
221 Check(6, delegate
222 {
223 EClass._zone.ClaimZone(debug: false, pos);
224 });
225 Check(9, delegate
226 {
228 });
229 Check(20, delegate
230 {
231 AddMemeber("fiama");
232 });
233 Check(40, delegate
234 {
235 AddMemeber("nino");
236 });
237 Check(60, delegate
238 {
239 AddMemeber("loytel");
241 });
242 Check(80, delegate
243 {
244 AddMemeber("farris");
245 });
246 Check(100, delegate
247 {
248 EClass._zone.AddCard(ThingGen.Create("core_defense"), pos).Install();
249 });
250 void AddMemeber(string id)
251 {
252 if (EClass.game.cards.globalCharas.Find(id) == null)
253 {
255 }
256 }
257 void Check(int a, Action action)
258 {
259 if (!done && flags.floors < a && i >= a)
260 {
261 Meteor(pos, action);
262 EClass.game.survival.flags.floors = a;
263 done = true;
264 }
265 }
266 }
virtual Chara Chara
Definition: Card.cs:2070
Card Install()
Definition: Card.cs:3738
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:1066
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:1705

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 278 of file SurvivalManager.cs.

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

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 466 of file SurvivalManager.cs.

467 {
469 for (int i = 0; i < (EClass.debug.enable ? 10 : 2); i++)
470 {
471 SourceChara.Row row = list.RandomItem();
472 if (row != null)
473 {
474 Chara chara = CharaGen.Create(row.id);
475 chara.RemoveEditorTag(EditorTag.AINoMove);
476 branch.AddRecruit(chara);
477 list.Remove(row);
478 }
479 }
480 }
EditorTag
Definition: EditorTag.cs:2
string id
Definition: CardRow.cs:7
void RemoveEditorTag(EditorTag tag)
Definition: Card.cs:2610
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 187 of file SurvivalManager.cs.

188 {
189 if (listReward.Count <= 0)
190 {
191 Add(new string[7] { "659", "758", "759", "806", "828", "1190", "1191" });
192 if (flags.raidLv < 50)
193 {
194 Add(new string[7] { "pillow_jure", "pillow_ehekatl", "pillow_opatos", "pillow_kumiromi", "pillow_lulwy", "pillow_mani", "pillow_itzpalt" });
195 }
196 else
197 {
198 Add(new string[1] { "rod_wish" });
199 }
200 }
201 void Add(string[] ids)
202 {
203 foreach (string item in ids)
204 {
205 listReward.Add(item);
206 }
207 }
208 }
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 482 of file SurvivalManager.cs.

483 {
484 flags.raid = true;
485 Point pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? EClass.pc.pos;
486 Meteor(pos, delegate
487 {
488 EClass._zone.AddCard(ThingGen.Create("teleporter_demon"), pos).Install();
489 });
490 flags.dateNextRaid = EClass.world.date.GetRaw(72);
491 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:326
static World world
Definition: EClass.cs:40
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: