Elin Decompiled Documentation EA 23.219 Nightly
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 257 of file SurvivalManager.cs.

258 {
259 if (EClass.game.cards.globalCharas.Find("loytel") != null && !EClass.game.quests.IsAdded<QuestDebt>())
260 {
261 Quest quest = EClass.game.quests.Add("debt", "loytel");
262 EClass.game.quests.globalList.Remove(quest);
263 EClass.game.quests.Start(quest);
264 }
265 }
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:179
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 407 of file SurvivalManager.cs.

408 {
410 Point point = ((traitCoreZone != null) ? traitCoreZone.owner.pos : EClass._map.GetCenterPos());
411 List<Cell> list = new List<Cell>();
412 EClass._map.ForeachSphere(point.x, point.z, 50f, delegate(Point p)
413 {
414 if (!p.IsSky && !p.IsBlocked && !p.HasObj && !p.HasThing)
415 {
416 list.Add(p.cell);
417 }
418 });
419 if (list.Count == 0)
420 {
421 return null;
422 }
423 return list.RandomItem().GetPoint();
424 }
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: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(), and OnMineWreck().

◆ ListUnrecruitedUniques()

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

Definition at line 426 of file SurvivalManager.cs.

427 {
428 return EClass.sources.charas.rows.Where(delegate(SourceChara.Row r)
429 {
430 if (r.quality != 4 || r.race == "god" || r.size.Length != 0)
431 {
432 return false;
433 }
434 switch (r.id)
435 {
436 case "fiama":
437 case "loytel":
438 case "nino":
439 case "big_daddy":
440 case "littleOne":
441 case "sorin":
442 case "vesda":
443 case "azzrasizzle":
444 return false;
445 default:
446 if (EClass.game.cards.globalCharas.Find(r.id) == null)
447 {
448 return r.LV < flags.raidLv + 10;
449 }
450 return false;
451 }
452 }).ToList();
453 }
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:1948

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 {
232 });
233 Check(40, delegate
234 {
236 });
237 Check(60, delegate
238 {
241 });
242 Check(80, delegate
243 {
244 EClass._zone.AddCard(ThingGen.Create("core_defense"), pos).Install();
245 });
246 void Check(int a, Action action)
247 {
248 if (!done && flags.floors < a && i >= a)
249 {
250 Meteor(pos, action);
251 EClass.game.survival.flags.floors = a;
252 done = true;
253 }
254 }
255 }
virtual Chara Chara
Definition: Card.cs:2058
Card Install()
Definition: Card.cs:3671
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:1064
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:1694

References EClass._map, EClass._zone, Zone.AddCard(), FactionBranch.AddMemeber(), Card.Chara, CheckLoytelDebt(), 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 267 of file SurvivalManager.cs.

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

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

456 {
458 for (int i = 0; i < (EClass.debug.enable ? 10 : 2); i++)
459 {
460 SourceChara.Row row = list.RandomItem();
461 if (row != null)
462 {
463 Chara chara = CharaGen.Create(row.id);
464 chara.RemoveEditorTag(EditorTag.AINoMove);
465 branch.AddRecruit(chara);
466 list.Remove(row);
467 }
468 }
469 }
EditorTag
Definition: EditorTag.cs:2
string id
Definition: CardRow.cs:7
void RemoveEditorTag(EditorTag tag)
Definition: Card.cs:2598
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 471 of file SurvivalManager.cs.

472 {
473 flags.raid = true;
474 Point pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? EClass.pc.pos;
475 Meteor(pos, delegate
476 {
477 EClass._zone.AddCard(ThingGen.Create("teleporter_demon"), pos).Install();
478 });
479 flags.dateNextRaid = EClass.world.date.GetRaw(72);
480 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
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: