Elin Decompiled Documentation EA 23.271 Nightly Patch 1
Loading...
Searching...
No Matches
AI_Idle.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5
6public class AI_Idle : AIAct
7{
8 public enum Behaviour
9 {
10 Default,
11 NoMove
12 }
13
14 public int maxRepeat = 10;
15
16 public int moveFailCount;
17
18 private static List<BaseArea> _listRoom = new List<BaseArea>();
19
20 public override bool IsIdle => !base.IsChildRunning;
21
22 public override bool InformCancel => false;
23
24 public override int MaxRestart => maxRepeat;
25
26 public override bool ShouldEndMimicry => false;
27
28 public override void OnStart()
29 {
30 owner.SetTempHand(-1, -1);
31 owner.ShowEmo();
32 }
33
34 public override IEnumerable<Status> Run()
35 {
36 while (true)
37 {
38 if (owner.held != null)
39 {
41 }
42 if (owner.nextUse != null)
43 {
44 Thing nextUse = owner.nextUse;
45 owner.nextUse = null;
46 if (nextUse.parent == owner && !nextUse.isDestroyed)
47 {
48 owner.TryUse(nextUse);
49 }
50 yield return KeepRunning();
51 }
53 {
54 if (EClass.rnd(5) == 0)
55 {
56 owner.Talk("onFire");
57 }
59 {
60 yield return Restart();
61 }
62 }
63 if (EClass.rnd(owner.IsPCParty ? 10 : 100) == 0 && owner.hunger.GetPhase() >= 3)
64 {
65 Thing thing = (owner.IsPCFaction ? owner.FindBestFoodToEat() : owner.things.Find((Thing a) => owner.CanEat(a, owner.IsPCFaction) && !a.c_isImportant, recursive: false));
66 if (thing == null && owner.IsPCFaction && EClass._zone.IsPCFaction)
67 {
69 if (thing != null)
70 {
71 owner.Pick(thing);
72 }
73 }
74 if (thing == null && !owner.IsPCFaction)
75 {
76 if (EClass.rnd(8) != 0)
77 {
78 owner.hunger.Mod(-30);
79 }
80 else if (!owner.things.IsFull())
81 {
82 thing = ThingGen.CreateFromCategory("food", EClass.rnd(EClass.rnd(60) + 1) + 10);
83 if (thing.trait.CanEat(owner))
84 {
85 thing.isNPCProperty = true;
86 thing = owner.AddThing(thing);
87 }
88 else
89 {
90 thing = null;
91 }
92 }
93 }
94 if (thing != null)
95 {
97 {
98 owner.InstantEat(thing, sound: false);
99 yield return Restart();
100 }
101 else if (thing.Num == 1 || !owner.things.IsFull())
102 {
103 yield return Do(new AI_Eat
104 {
105 target = thing
106 });
107 }
108 }
109 else if (!EClass._zone.IsRegion && owner.HasElement(1250))
110 {
111 Chara target = null;
112 for (int k = 0; k < 10; k++)
113 {
114 Chara chara = EClass._map.charas.RandomItem();
115 if (chara != owner && chara.Evalue(964) <= 0 && (target == null || (chara.c_bloodData != null && (target.c_bloodData == null || CraftUtil.GetFoodScore(chara.c_bloodData) > CraftUtil.GetFoodScore(target.c_bloodData)))))
116 {
117 target = chara;
118 }
119 }
120 if (target != null)
121 {
122 yield return DoGoto(target);
123 owner.UseAbility("ActBloodsuck", target);
124 yield return Success();
125 }
126 }
127 }
128 if (!EClass._zone.IsRegion)
129 {
130 if (EClass.rnd(10) == 0 && owner.ability.Has(6627) && ((float)owner.hp < (float)owner.MaxHP * 0.8f || EClass.rnd(10) == 0) && owner.GetNearbyCatToSniff() != null && !owner.HasCondition<ConHOT>())
131 {
133 yield return KeepRunning();
134 }
135 if (EClass.rnd(3) == 0 && owner.mana.value > 0)
136 {
137 Act act = null;
138 Act actRevive = null;
139 foreach (ActList.Item item in owner.ability.list.items)
140 {
141 Act act2 = item.act;
142 if (act2.id == 8430)
143 {
144 actRevive = act2;
145 }
146 string[] abilityType = act2.source.abilityType;
147 if (!abilityType.IsEmpty() && (abilityType[0] == "heal" || abilityType[0] == "hot"))
148 {
149 act = item.act;
150 }
151 }
152 if (act != null)
153 {
154 List<Chara> list = (owner.IsPCParty ? EClass.pc.party.members : new List<Chara> { owner });
155 foreach (Chara item2 in list)
156 {
157 if (!((float)item2.hp > (float)item2.MaxHP * 0.75f) && owner.CanSeeLos(item2) && (!(act.source.abilityType[0] == "hot") || !item2.HasCondition<ConHOT>()))
158 {
159 owner.UseAbility(act, item2);
160 yield return KeepRunning();
161 break;
162 }
163 }
164 }
165 if (actRevive != null && owner.IsPCFaction && EClass.game.cards.globalCharas.Where((KeyValuePair<int, Chara> a) => a.Value.isDead && a.Value.faction == EClass.pc.faction && !a.Value.isSummon && a.Value.c_wasInPcParty).ToList().Count > 0 && owner.UseAbility(actRevive.source.alias, owner))
166 {
167 yield return KeepRunning();
168 }
169 }
170 }
172 {
174 if (owner.sharedCheckTurn < 0 && EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
175 {
178 owner.sharedCheckTurn += (EClass.debug.enable ? 20 : 200);
179 }
180 }
181 if ((EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (owner.IsPCParty ? 10 : (owner.IsPCFaction ? 2 : 0)) > EClass.rnd(100))
182 {
183 Thing thing2 = owner.things.Find("polish_powder");
184 if (thing2 != null && EClass._map.props.installed.Find<TraitGrindstone>() != null)
185 {
186 foreach (Thing thing9 in owner.things)
187 {
188 if (!thing9.IsEquipment || thing9.encLV >= 0)
189 {
190 continue;
191 }
192 for (int l = 0; l < 5; l++)
193 {
194 if (thing9.encLV >= 0)
195 {
196 break;
197 }
198 owner.Say("polish", owner, thing9);
199 thing9.ModEncLv(1);
200 thing2.ModNum(-1);
201 if (thing2.isDestroyed)
202 {
203 break;
204 }
205 }
206 if (thing2.isDestroyed)
207 {
208 break;
209 }
210 }
211 }
212 }
213 if (owner.IsPCParty)
214 {
216 {
217 TraitShackle traitShackle = owner.pos.FindThing<TraitShackle>();
218 if (traitShackle != null && traitShackle.AllowTraining)
219 {
221 {
222 shackle = traitShackle
223 });
224 }
225 yield return Restart();
226 }
227 if (EClass.rnd(20) == 0)
228 {
229 Thing thing3 = owner.things.Find((Thing a) => a.parent == owner && a.isGifted && (a.category.id == "skillbook" || a.category.id == "ancientbook"));
230 if (thing3 != null && thing3.trait.CanRead(owner) && (thing3.Num == 1 || !owner.things.IsFull()))
231 {
232 yield return Do(new AI_Read
233 {
234 target = thing3
235 });
236 }
237 }
238 if (EClass.rnd(100) == 0 && !EClass._zone.IsRegion && owner.HasElement(1227))
239 {
240 List<Chara> list2 = new List<Chara>();
241 foreach (Chara member in EClass.pc.party.members)
242 {
243 if (member.Evalue(1227) > 0)
244 {
245 list2.Add(member);
246 }
247 }
248 if (list2.Count > 2 + EClass.pc.party.EvalueTotal(1272, (Chara c) => c.IsPC || c.faith == EClass.game.religions.Harmony))
249 {
250 list2.Remove(owner);
251 owner.SetEnemy(list2.RandomItem());
252 yield return Success();
253 }
254 }
255 if (EClass.rnd(150) == 0 && owner.host != null && owner.host.parasite == owner && owner.GetInt(108) == 1)
256 {
257 owner.host.PlaySound("whip");
258 owner.host.Say("use_whip3", owner, owner.host);
259 owner.Talk("insult");
260 owner.host.PlayAnime(AnimeID.Shiver);
261 owner.host.DamageHP(5 + EClass.rndHalf(owner.host.MaxHP / 5), 919, 100, AttackSource.Condition);
263 yield return KeepRunning();
264 }
265 if (EClass.rnd(EClass.debug.enable ? 2 : 20) == 0 && owner.CanSee(EClass.pc) && !(EClass.pc.ai is AI_Eat))
266 {
268 }
269 if (owner.isSynced && EClass.rnd((owner.host == null) ? 200 : 150) == 0 && owner.GetInt(106) == 0)
270 {
271 if (EClass.rnd(2) == 0 && owner.GetInt(108) == 1)
272 {
273 owner.Talk("insult");
274 }
275 else
276 {
278 }
279 }
280 if (EClass.rnd(100) == 0 && EClass._zone.IsTown)
281 {
283 }
284 if ((EClass.rnd(20) == 0 || EClass.debug.enable) && owner.GetCurrency() >= 500)
285 {
286 bool flag = EClass._zone.IsTown;
288 {
289 foreach (Chara member2 in EClass._zone.branch.members)
290 {
291 if (member2.ExistsOnMap && member2.trait is TraitTrainer)
292 {
293 flag = true;
294 }
295 }
296 }
297 if (flag)
298 {
299 bool flag2 = false;
300 foreach (Element value in owner.elements.dict.Values)
301 {
302 if (!(value.source.category != "skill") && value.vTempPotential < 900)
303 {
304 flag2 = true;
305 break;
306 }
307 }
308 if (flag2)
309 {
310 int num = owner.GetCurrency();
311 if (num >= 20000)
312 {
313 num = 20000;
314 }
315 owner.PlaySound("pay");
316 int num2 = num / 200;
317 foreach (Element value2 in owner.elements.dict.Values)
318 {
319 if (!(value2.source.category != "skill"))
320 {
321 int num3 = num2 * 100 / (100 + (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) * (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) / 100);
322 num3 += 1 + EClass.rnd(3);
323 owner.elements.ModTempPotential(value2.id, Mathf.Max(1, num3), 9999);
324 }
325 }
326 Msg.Say("party_train", owner, Lang._currency(num));
327 owner.PlaySound("ding_potential");
328 owner.ModCurrency(-num);
329 }
330 }
331 }
332 if (EClass.rnd(100) == 0 && EClass.pc.ai is AI_Fish && owner.stamina.value > 0 && owner.things.Find<TraitToolFishing>() != null)
333 {
334 Point randomPointInRadius = EClass.pc.pos.GetRandomPointInRadius(0, 3);
335 if (randomPointInRadius != null)
336 {
337 randomPointInRadius = AI_Fish.GetFishingPoint(randomPointInRadius);
338 if (randomPointInRadius.IsValid)
339 {
340 yield return Do(new AI_Fish
341 {
342 pos = randomPointInRadius
343 });
344 }
345 }
346 }
347 }
348 if (owner.c_uidMaster != 0)
349 {
350 Chara chara2 = owner.master;
351 if (chara2 == null || !chara2.IsAliveInCurrentZone)
352 {
353 chara2 = owner.FindMaster();
354 }
355 if (chara2 != null && chara2.IsAliveInCurrentZone)
356 {
357 if (owner.enemy == null)
358 {
359 owner.SetEnemy(chara2.enemy);
360 }
361 int num4 = owner.Dist(chara2.pos);
362 if (owner.source.aiIdle != "root" && num4 > EClass.game.config.tactics.AllyDistance(owner) && EClass._zone.PetFollow && owner.c_minionType == MinionType.Default)
363 {
364 if (owner.HasAccess(chara2.pos))
365 {
366 owner.TryMoveTowards(chara2.pos);
367 }
368 yield return KeepRunning();
369 continue;
370 }
371 }
372 }
373 if (!EClass._zone.IsRegion && owner.HasElement(1425) && EClass.rnd(5) == 0 && owner.mimicry == null)
374 {
375 owner.UseAbility(8794, owner);
376 }
377 Party party = owner.party;
378 if (party == null || party.leader == owner || !party.leader.IsAliveInCurrentZone || owner.host != null || !EClass._zone.PetFollow)
379 {
380 break;
381 }
382 if (owner.source.aiIdle == "root")
383 {
384 yield return KeepRunning();
385 continue;
386 }
388 {
389 yield return KeepRunning();
390 continue;
391 }
392 if (owner.HasAccess(party.leader.pos) && owner.TryMoveTowards(party.leader.pos) == Card.MoveResult.Fail && owner.Dist(party.leader) > 4)
393 {
395 bool flag3 = (EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (EClass.pc.enemy == null || !EClass.pc.enemy.IsAliveInCurrentZone);
396 if (moveFailCount >= (flag3 ? 100 : 10))
397 {
398 owner.Teleport(party.leader.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true), silent: false, force: true);
399 moveFailCount = 0;
400 }
401 }
402 else
403 {
404 moveFailCount = 0;
405 }
406 yield return KeepRunning();
407 }
408 if (EClass._zone.IsNefia && EClass._zone.Boss == owner && EClass.rnd(20) == 0)
409 {
411 }
412 if (EClass._zone.IsRegion && EClass.rnd(10) != 0)
413 {
414 yield return Restart();
415 }
416 if (((owner.homeBranch != null && owner.homeBranch == EClass.Branch && EClass.rnd(100) == 0) || (owner.IsGuest() && EClass.rnd(50) == 0)) && owner.FindBed() == null)
417 {
419 }
420 if (!EClass._zone.IsRegion)
421 {
422 switch (owner.id)
423 {
424 case "azzrasizzle":
425 case "geist":
426 {
427 if (EClass.rnd(20) != 0)
428 {
429 break;
430 }
431 Point nearestPoint = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false);
432 if (nearestPoint == null)
433 {
434 break;
435 }
436 foreach (Chara item3 in nearestPoint.ListCharasInRadius(owner, 6, (Chara _c) => _c != owner && !_c.IsPCFactionOrMinion && _c.id != "cocoon"))
437 {
438 item3.Teleport(nearestPoint.GetNearestPoint(allowBlock: false, allowChara: false) ?? nearestPoint);
439 }
440 if (owner != null)
441 {
443 {
444 EClass.pc.ai.Cancel();
445 }
446 owner.Teleport(nearestPoint);
447 }
448 yield return Success();
449 break;
450 }
451 case "spider_queen":
452 {
453 if (EClass.rnd(20) != 0 || !owner.CanDuplicate() || EClass._zone.IsUserZone)
454 {
455 break;
456 }
457 int i = 0;
458 owner.pos.ForeachNeighbor(delegate(Point p)
459 {
460 if (p.HasChara && p.FirstChara.id == "cocoon")
461 {
462 i++;
463 }
464 });
465 if (i < 2)
466 {
467 Point randomPoint2 = owner.pos.GetRandomPoint(1, requireLos: false, allowChara: false, allowBlocked: false, 20);
468 if (randomPoint2 != null)
469 {
470 Chara chara3 = EClass._zone.SpawnMob("cocoon", randomPoint2);
471 owner.Say("layegg", owner);
473 }
474 }
475 break;
476 }
477 case "mech_scarab":
478 {
479 if (EClass.rnd(20) != 0 || !owner.CanDuplicate() || EClass._zone.IsUserZone)
480 {
481 break;
482 }
483 int j = 0;
484 owner.pos.ForeachNeighbor(delegate(Point p)
485 {
486 if (p.HasChara && p.FirstChara.id == "mech_scarab")
487 {
488 j++;
489 }
490 });
491 if (j >= 2)
492 {
493 break;
494 }
495 Point randomPoint = owner.pos.GetRandomPoint(1, requireLos: false, allowChara: false, allowBlocked: false, 20);
496 if (randomPoint != null)
497 {
498 Card c2 = EClass._zone.AddCard(owner.Duplicate(), randomPoint);
499 if (randomPoint.Distance(EClass.pc.pos) < EClass.pc.GetHearingRadius())
500 {
501 Msg.Say("self_dupe", owner, c2);
502 }
503 }
504 break;
505 }
506 }
507 }
508 if (owner.IsMinion && owner.master != null && owner.master.id == "keeper_garden" && !(owner.master.ai is GoalCombat))
509 {
511 yield return Success();
512 }
514 {
515 Room room = owner.pos.cell.room;
516 if (room != null)
517 {
518 Point point = null;
519 if (owner.memberType == FactionMemberType.Guest && room.data.accessType != 0)
520 {
521 point = FindMovePoint(BaseArea.AccessType.Public);
522 }
523 else if (owner.memberType == FactionMemberType.Default && room.data.accessType == BaseArea.AccessType.Private)
524 {
525 point = FindMovePoint(BaseArea.AccessType.Resident) ?? FindMovePoint(BaseArea.AccessType.Public);
526 }
527 if (point != null)
528 {
529 yield return DoGoto(point);
530 }
531 }
532 }
534 {
535 if (owner.IsPCFaction && owner.GetInt(32) + 4320 < EClass.world.date.GetRaw())
536 {
537 if (owner.GetInt(32) != 0 && Zone.okaerinko < 10)
538 {
539 owner.Talk("welcomeBack");
540 Zone.okaerinko++;
541 }
543 }
545 {
546 if (EClass.rnd(5) == 0 && owner.hostility >= Hostility.Neutral && EClass.pc.IsPCC && EClass.pc.pccData.state == PCCState.Undie && !EClass.pc.pos.cell.IsTopWaterAndNoSnow)
547 {
548 owner.Talk("pervert3");
549 }
550 else if (EClass.rnd(15) == 0 && EClass._zone.IsTown && owner.hostility >= Hostility.Neutral && !owner.IsPCFaction && !EClass.pc.HasCondition<ConIncognito>())
551 {
552 bool flag4 = EClass._zone is Zone_Derphy;
553 string text = ((EClass.player.karma > 10) ? ((EClass.player.karma < 90) ? "" : (flag4 ? "rumor_bad" : "rumor_good")) : (flag4 ? "rumor_good" : "rumor_bad"));
554 if (!text.IsEmpty())
555 {
556 owner.Talk(text);
557 }
558 if ((flag4 ? (EClass.player.karma >= 90) : (EClass.player.karma <= 10)) && EClass.rnd(10) == 0)
559 {
560 Thing t2 = ThingGen.Create("stone");
561 AI_PlayMusic.ignoreDamage = true;
563 AI_PlayMusic.ignoreDamage = false;
564 }
565 }
566 else
567 {
568 owner.TalkTopic("fov");
569 }
570 owner.turnLastSeen = EClass.player.stats.turns;
571 }
572 }
573 if (EClass.rnd(25) == 0 && owner.IsInMutterDistance())
574 {
576 {
577 owner.PlayAnime(AnimeID.Shiver);
578 }
580 if (tC == null || tC.pop.items.Count == 0)
581 {
582 if (owner.noMove)
583 {
584 foreach (Thing thing10 in owner.pos.Things)
585 {
586 if (thing10.IsInstalled && thing10.trait is TraitGeneratorWheel)
587 {
588 owner.Talk("labor");
589 owner.PlayAnime(AnimeID.Shiver);
590 yield return Restart();
591 }
592 }
593 }
594 if (owner.isDrunk && (owner.race.id == "cat" || owner.id == "sailor"))
595 {
596 owner.Talk("drunk_cat");
597 }
598 else if (owner.isRestrained)
599 {
600 owner.Talk("restrained");
601 }
602 else if (owner.GetInt(106) == 0 && !owner.IsPCParty)
603 {
604 if (owner.HasElement(1232) && EClass.rnd(4) == 0)
605 {
606 owner.Talk("baby");
607 }
608 else if (EClass.rnd((owner.host == null) ? 2 : 10) == 0 && owner.isSynced && owner.TalkTopic().IsEmpty())
609 {
610 owner.Talk(owner.pos.IsHotSpring ? "hotspring" : "idle");
611 }
612 }
613 }
614 }
615 if (EClass.rnd(8) == 0 && owner.race.id == "chicken")
616 {
617 owner.PlaySound("Animal/Chicken/chicken");
618 }
619 if (EClass.rnd(80) == 0 && owner.race.id == "cat")
620 {
621 owner.PlaySound("Animal/Cat/cat");
622 }
623 if (owner.trait.IdAmbience != null && owner.IsInMutterDistance(15))
624 {
625 float mtp = 1f;
626 Room room2 = owner.Cell.room;
627 Room room3 = EClass.pc.Cell.room;
628 if (room2 != room3 && room3 != null)
629 {
630 mtp = ((room2?.lot != room3?.lot) ? 0.4f : 0.7f);
631 }
632 EClass.Sound.PlayAmbience(owner.trait.IdAmbience, owner.pos.Position(), mtp);
633 }
634 if (EClass.rnd(2000) == 0 && owner.IsHuman && (owner.host == null || owner.host.ride != owner))
635 {
636 Thing thing4 = owner.things.Find((Thing a) => !a.IsNegativeGift && a.trait.CanDrink(owner), recursive: false);
637 if (thing4 != null && thing4.trait is TraitPotion && owner.IsPCParty)
638 {
639 thing4 = null;
640 }
641 bool flag5 = EClass.Branch != null && EClass.Branch.policies.IsActive(2503);
642 if (owner.homeBranch != null && owner.homeBranch.policies.IsActive(2503))
643 {
644 flag5 = true;
645 }
646 if (thing4 == null && !flag5)
647 {
648 thing4 = ThingGen.Create("crimAle");
649 owner.Drink(thing4);
650 }
651 if (thing4 != null && !thing4.isDestroyed)
652 {
653 owner.TryUse(thing4);
654 yield return Restart();
655 }
656 }
657 if (EClass.rnd(owner.IsPCParty ? 1000 : 200) == 0 && owner.isDrunk && (owner.isSynced || EClass.rnd(5) == 0))
658 {
659 DoSomethingToCharaInRadius(3, null, delegate(Chara c)
660 {
661 owner.Say("drunk_mess", owner, c);
662 owner.Talk("drunk_mess");
663 bool flag6 = EClass.rnd(5) == 0 && !c.IsPC;
664 if (c.IsPCParty && owner.hostility >= Hostility.Friend)
665 {
666 flag6 = false;
667 }
668 if (flag6)
669 {
670 owner.Say("drunk_counter", c, owner);
671 c.Talk("drunk_counter");
673 }
674 });
675 }
676 if (EClass.rnd(100) == 0 && owner.trait.CanFish && owner.stamina.value > 0)
677 {
678 Point fishingPoint = AI_Fish.GetFishingPoint(owner.pos);
679 if (fishingPoint.IsValid)
680 {
681 yield return Do(new AI_Fish
682 {
683 pos = fishingPoint
684 });
685 }
686 }
687 string idAct = owner.source.actIdle.RandomItem();
688 if (EClass.rnd(EClass.world.date.IsNight ? 1500 : 15000) == 0 && !owner.IsPCFaction && !owner.noMove)
689 {
690 owner.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
691 }
692 if (!owner.noMove)
693 {
694 if (EClass.rnd(3) == 0 && owner.IsCat)
695 {
696 Chara chara4 = ((EClass.rnd(5) == 0) ? EClass.pc.party.members.RandomItem() : EClass._map.charas.RandomItem());
697 Thing thing5 = chara4.things.Find<TraitFoodChuryu>();
698 if (chara4 != owner && thing5 != null)
699 {
700 yield return Do(new AI_Churyu
701 {
702 churyu = thing5,
703 slave = chara4
704 });
705 }
706 }
707 if (EClass.rnd(100) == 0 && (owner.HasHobbyOrWork("Pet") || owner.HasHobbyOrWork("Fluffy")))
708 {
709 yield return Do(new AI_Mofu());
710 }
711 }
712 if (EClass.rnd((owner.host != null && owner.GetInt(106) != 0) ? 1000 : 40) == 0 && owner.IsHuman)
713 {
714 DoSomethingToNearChara((Chara c) => (!c.IsPCParty || EClass.rnd(5) == 0) && c.IsMofuable && !owner.IsHostile(c) && !c.IsInCombat && owner.CanSee(c), delegate(Chara c)
715 {
716 owner.Cuddle(c);
717 });
718 yield return KeepRunning();
719 }
720 if (EClass.rnd(100) == 0 && owner.trait is TraitBitch)
721 {
722 Chara chara5 = DoSomethingToNearChara((Chara c) => c.IsIdle && !c.IsPCParty && !(c.trait is TraitBitch) && c.Evalue(418) <= 0);
723 if (chara5 != null)
724 {
725 yield return Do(new AI_Fuck
726 {
727 target = chara5,
728 variation = AI_Fuck.Variation.Bitch
729 });
730 }
731 }
732 if (EClass.rnd(50) == 0 && owner.trait is TraitBard)
733 {
734 yield return Do(new AI_PlayMusic());
735 }
736 if (EClass.rnd(4) == 0 && TryPerformIdleUse())
737 {
738 yield return Restart();
739 }
740 if (EClass.rnd(20) == 0 && owner.trait.IdleAct())
741 {
742 yield return Restart();
743 }
744 if (idAct == "janitor" && EClass.rnd(5) == 0)
745 {
746 DoSomethingToCharaInRadius(4, null, delegate(Chara c)
747 {
748 if (c.HasElement(1211) && !(EClass._zone is Zone_Casino))
749 {
750 owner.Talk("snail");
751 Thing t4 = ThingGen.Create("1142");
752 ActThrow.Throw(owner, c.pos, t4);
753 }
754 });
755 yield return Restart();
756 }
758 {
759 TraitShackle traitShackle2 = owner.pos.FindThing<TraitShackle>();
760 if (traitShackle2 != null && traitShackle2.AllowTraining)
761 {
763 {
764 shackle = traitShackle2
765 });
766 yield return Restart();
767 }
768 }
769 if (!owner.IsPCFactionOrMinion && EClass.rnd(owner.isSynced ? 50 : 2000) == 0 && owner.hostility == Hostility.Neutral && EClass.pc.party.HasElement(1563) && !owner.race.tag.Contains("animal") && EClass._zone.IsTown && !EClass._zone.IsPCFaction && !owner.HasCondition<ConIncognito>())
770 {
772 }
773 if (EClass.rnd(200) == 0 && !owner.noMove)
774 {
775 Point cleanPoint = AI_Clean.GetCleanPoint(owner, 4);
776 if (cleanPoint != null)
777 {
778 yield return Do(new AI_Clean
779 {
780 pos = cleanPoint
781 });
782 }
783 }
784 if (EClass.rnd(35) == 0 && owner.id == "child" && owner.pos.cell.IsSnowTile)
785 {
786 foreach (Chara chara6 in EClass._map.charas)
787 {
788 if (EClass.rnd(3) != 0 && chara6 != owner && chara6.pos.cell.IsSnowTile && chara6.Dist(owner) <= 6 && Los.IsVisible(chara6, owner))
789 {
790 Thing t3 = ThingGen.Create("snow");
791 ActThrow.Throw(owner, chara6.pos, t3);
792 break;
793 }
794 }
795 }
796 if (EClass.rnd(EClass.debug.enable ? 3 : 30) == 0)
797 {
798 Thing thing6 = owner.things.Find<TraitBall>();
799 if (thing6 == null)
800 {
802 {
803 owner.pos.ForeachNeighbor(delegate(Point p)
804 {
805 Card card2 = p.FindThing<TraitBall>()?.owner;
806 if (card2 != null)
807 {
808 owner.Pick(card2.Thing);
809 }
810 });
811 }
812 }
813 else
814 {
815 foreach (Chara chara7 in EClass._map.charas)
816 {
817 if (EClass.rnd(3) != 0 && chara7 != owner && chara7.Dist(owner) <= 6 && chara7.Dist(owner) >= 3 && Los.IsVisible(chara7, owner))
818 {
819 ActThrow.Throw(owner, chara7.pos, thing6);
820 break;
821 }
822 }
823 }
824 }
825 if (EClass.rnd(20) == 0 && AI_Shopping.TryShop(owner, realtime: true))
826 {
827 yield return Restart();
828 }
829 if (EClass.rnd(20) == 0 && owner.IsPCFaction && AI_Shopping.TryRestock(owner, realtime: true))
830 {
831 yield return Restart();
832 }
834 if (owner.idleActTimer <= 0 && !owner.source.actIdle.IsEmpty())
835 {
836 owner.idleActTimer = 10 + EClass.rnd(50);
837 switch (idAct)
838 {
839 case "torture_snail":
840 DoSomethingToNearChara((Chara c) => c.race.id == "snail", delegate(Chara c)
841 {
842 owner.Say("use_whip3", owner, c);
843 owner.PlaySound("whip");
844 owner.Talk("insult");
845 c.PlayAnime(AnimeID.Shiver);
846 c.OnInsulted();
847 });
848 break;
849 case "buffMage":
850 if (EClass.rnd(2) == 0)
851 {
852 TryCast<ConHolyVeil>(EffectId.HolyVeil, 300 + EClass.rnd(300));
853 }
854 else
855 {
856 TryCast<ConLevitate>(EffectId.Levitate, 300 + EClass.rnd(300));
857 }
858 break;
859 case "buffThief":
860 TryCast<ConNightVision>(EffectId.CatsEye, 100 + EClass.rnd(100));
861 break;
862 case "buffGuildWatch":
863 TryCast<ConGravity>(EffectId.Gravity, 300 + EClass.rnd(300));
864 break;
865 case "buffHealer":
866 TryCast(EffectId.Heal);
867 break;
868 case "readBook":
869 {
870 if (EClass.rnd(2) == 0 || (owner.IsPCParty && EClass.rnd(20) != 0))
871 {
872 break;
873 }
874 List<Thing> list3 = owner.things.List((Thing a) => a.parent == owner && (a.category.id == "spellbook" || a.category.id == "ancientbook" || a.category.id == "skillbook"), onlyAccessible: true);
875 Thing thing7 = null;
876 if (list3.Count > 0)
877 {
878 thing7 = list3.RandomItem();
879 if (!thing7.trait.CanRead(owner))
880 {
881 thing7 = null;
882 }
883 }
884 if (thing7 == null)
885 {
886 if (owner.things.IsFull())
887 {
888 break;
889 }
890 thing7 = ThingGen.CreateFromCategory((EClass.rnd(5) != 0) ? "spellbook" : "ancientbook");
891 thing7.isNPCProperty = true;
892 }
893 if (!(thing7.id == "1084") || !owner.IsPCFaction)
894 {
895 if (!owner.HasElement(285))
896 {
897 owner.elements.ModBase(285, 1);
898 }
899 yield return Do(new AI_Read
900 {
901 target = thing7
902 });
903 }
904 break;
905 }
906 default:
907 if (LangGame.Has("idle_" + idAct))
908 {
909 IdleActText(idAct);
910 }
911 break;
912 }
913 yield return Restart();
914 }
915 if (owner.host != null)
916 {
917 yield return Restart();
918 }
920 {
922 {
923 yield return DoGoto(owner.orgPos);
924 }
925 yield return Restart();
926 }
928 {
929 yield return DoGoto(EClass.pc);
930 }
931 if (EClass.rnd(100) == 0 && !owner.IsPCFaction)
932 {
933 if (owner.id == "ashland" || owner.id == "fiama")
934 {
936 if (card != null)
937 {
938 yield return DoGotoSpot(card);
939 }
940 else
941 {
942 Room room4 = owner.FindRoom();
943 if (room4 != null)
944 {
945 yield return DoGoto(room4.GetRandomPoint().GetNearestPoint());
946 }
947 }
948 }
950 {
951 yield return DoGoto(owner.orgPos, 0, ignoreConnection: false, delegate
952 {
953 if (!EClass._zone.IsPCFaction)
954 {
955 owner.Teleport(owner.orgPos, silent: false, force: true);
956 }
957 return Status.Success;
958 });
959 }
960 }
961 if (EClass.rnd(100) == 0 && owner.id == "bee")
962 {
963 Thing thing8 = EClass._map.ListThing<TraitBeekeep>()?.RandomItem();
964 if (thing8 != null)
965 {
966 yield return DoGoto(thing8.pos);
967 }
968 }
969 if (EClass.rnd(10) == 0 && !EClass._zone.IsUnderwater && (owner.race.tag.Contains("water") || owner.source.tag.Contains("water")) && !owner.pos.IsDeepWater)
970 {
971 for (int m = 0; m < 100; m++)
972 {
973 Point randomPoint3 = EClass._map.GetRandomPoint();
974 if (randomPoint3.IsDeepWater && !randomPoint3.IsBlocked)
975 {
976 yield return DoGoto(randomPoint3);
977 break;
978 }
979 }
980 }
981 string aiIdle = owner.source.aiIdle;
982 if (!(aiIdle == "stand") && !(aiIdle == "root"))
983 {
984 if (EClass.rnd(15) == 0 && owner.mimicry == null)
985 {
987 }
988 if (owner == null)
989 {
990 yield return Cancel();
991 }
992 }
993 if (EClass._zone.IsPCFaction && owner.IsPCFaction && !owner.IsPCParty && (owner.GetWork("Clean") != null || owner.GetWork("Chore") != null) && !(EClass.pc.ai is AI_UseCrafter))
994 {
995 AI_Haul aI_Haul = AI_Haul.TryGetAI(owner);
996 if (aI_Haul != null)
997 {
998 yield return Do(aI_Haul);
999 }
1000 }
1001 yield return Restart();
1002 Point FindMovePoint(BaseArea.AccessType type)
1003 {
1004 for (int n = 0; n < 20; n++)
1005 {
1006 Point randomPoint4 = owner.pos.GetRandomPoint(5 + n, requireLos: false);
1007 if (randomPoint4 != null && randomPoint4.IsInBounds && (randomPoint4.cell.room == null || randomPoint4.cell.room.data.accessType == type))
1008 {
1009 return randomPoint4;
1010 }
1011 }
1012 return null;
1013 }
1014 }
1015
1016 public void IdleActText(string id)
1017 {
1018 string text = "idle_" + id;
1019 owner.PlaySound(text);
1020 if (Lang.Game.map.ContainsKey(text))
1021 {
1022 owner.Say(text, owner);
1023 }
1024 }
1025
1026 public void TryCast<T>(EffectId id, int power = 100) where T : Condition
1027 {
1028 if (!owner.HasCondition<T>())
1029 {
1030 TryCast(id, power);
1031 }
1032 }
1033
1034 public void TryCast(EffectId id, int power = 100)
1035 {
1036 owner.Say("idle_cast", owner);
1037 ActEffect.Proc(id, power, BlessedState.Normal, owner);
1038 }
1039
1041 {
1042 _listRoom.Clear();
1043 foreach (BaseArea item in ((IEnumerable<BaseArea>)EClass._map.rooms.listRoom).Concat((IEnumerable<BaseArea>)EClass._map.rooms.listArea))
1044 {
1045 if (item.type != null && item.type.uidCharas.Contains(owner.uid))
1046 {
1047 _listRoom.Add(item);
1048 }
1049 }
1050 return _listRoom.RandomItem();
1051 }
1052
1053 public Chara DoSomethingToNearChara(Func<Chara, bool> funcPickChara, Action<Chara> action = null)
1054 {
1055 List<Chara> list = owner.pos.ListCharasInNeighbor(delegate(Chara c)
1056 {
1057 if (c == owner || !owner.CanSee(c))
1058 {
1059 return false;
1060 }
1061 return funcPickChara == null || funcPickChara(c);
1062 });
1063 if (list.Count > 0)
1064 {
1065 Chara chara = list.RandomItem();
1066 action?.Invoke(chara);
1067 return chara;
1068 }
1069 return null;
1070 }
1071
1072 public Chara DoSomethingToCharaInRadius(int radius, Func<Chara, bool> funcPickChara, Action<Chara> action = null)
1073 {
1074 List<Chara> list = owner.pos.ListCharasInRadius(owner, radius, delegate(Chara c)
1075 {
1076 if (c == owner || !owner.CanSee(c))
1077 {
1078 return false;
1079 }
1080 return funcPickChara == null || funcPickChara(c);
1081 });
1082 if (list.Count > 0)
1083 {
1084 Chara chara = list.RandomItem();
1085 action?.Invoke(chara);
1086 return chara;
1087 }
1088 return null;
1089 }
1090
1091 public bool TryPerformIdleUse()
1092 {
1093 for (int i = 0; i < 10; i++)
1094 {
1095 Point randomPoint = owner.pos.GetRandomPoint(7, requireLos: true, allowChara: true, allowBlocked: true);
1096 if (randomPoint == null || randomPoint.detail == null)
1097 {
1098 continue;
1099 }
1100 foreach (Thing thing in randomPoint.detail.things)
1101 {
1102 if (thing.IsInstalled)
1103 {
1104 int num = owner.Dist(thing);
1105 if (EClass.rnd((owner.memberType == FactionMemberType.Guest) ? 5 : 50) == 0 && thing.HasTag(CTAG.tourism) && num <= 2)
1106 {
1107 owner.LookAt(thing);
1108 owner.Talk("nice_statue");
1109 return true;
1110 }
1111 if (EClass.rnd(thing.trait.IdleUseChance) == 0 && thing.trait.IdleUse(owner, num))
1112 {
1113 owner.LookAt(thing);
1114 return true;
1115 }
1116 }
1117 }
1118 }
1119 return false;
1120 }
1121}
AnimeID
Definition: AnimeID.cs:2
AttackSource
Definition: AttackSource.cs:2
BlessedState
Definition: BlessedState.cs:2
CTAG
Definition: CTAG.cs:2
ClearInventoryType
EditorTag
Definition: EditorTag.cs:2
EffectId
Definition: EffectId.cs:2
FactionMemberType
Hostility
Definition: Hostility.cs:2
MinionType
Definition: MinionType.cs:2
ThrowMethod
Definition: ThrowMethod.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
Definition: AIAct.cs:6
Status Do(AIAct _seq, Func< Status > _onChildFail=null)
Definition: AIAct.cs:420
virtual Status Cancel()
Definition: AIAct.cs:295
new Chara owner
Definition: AIAct.cs:14
Status
Definition: AIAct.cs:8
Status DoGotoSpot(Card card, Func< Status > _onChildFail=null)
Definition: AIAct.cs:465
Status DoGoto(Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
Definition: AIAct.cs:436
Status KeepRunning()
Definition: AIAct.cs:325
Status Restart()
Definition: AIAct.cs:241
static Point GetCleanPoint(Chara c, int r=-1, int tries=10)
Definition: AI_Clean.cs:9
Definition: AI_Eat.cs:5
static Point GetFishingPoint(Point p)
Definition: AI_Fish.cs:276
static AI_Haul TryGetAI(Chara c)
Definition: AI_Haul.cs:76
Chara DoSomethingToNearChara(Func< Chara, bool > funcPickChara, Action< Chara > action=null)
Definition: AI_Idle.cs:1053
BaseArea GetRandomAssignedRoom()
Definition: AI_Idle.cs:1040
int moveFailCount
Definition: AI_Idle.cs:16
static List< BaseArea > _listRoom
Definition: AI_Idle.cs:18
override IEnumerable< Status > Run()
Definition: AI_Idle.cs:34
override bool IsIdle
Definition: AI_Idle.cs:20
override bool ShouldEndMimicry
Definition: AI_Idle.cs:26
override bool InformCancel
Definition: AI_Idle.cs:22
Chara DoSomethingToCharaInRadius(int radius, Func< Chara, bool > funcPickChara, Action< Chara > action=null)
Definition: AI_Idle.cs:1072
int maxRepeat
Definition: AI_Idle.cs:14
override int MaxRestart
Definition: AI_Idle.cs:24
void IdleActText(string id)
Definition: AI_Idle.cs:1016
bool TryPerformIdleUse()
Definition: AI_Idle.cs:1091
override void OnStart()
Definition: AI_Idle.cs:28
void TryCast(EffectId id, int power=100)
Definition: AI_Idle.cs:1034
Behaviour
Definition: AI_Idle.cs:9
static bool TryRestock(Chara c, bool realtime)
Definition: AI_Shopping.cs:94
static bool TryShop(Chara c, bool realtime)
Definition: AI_Shopping.cs:10
static void Proc(EffectId id, Card cc, Card tc=null, int power=100, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:1035
List< Item > items
Definition: ActList.cs:14
static EffectIRenderer Throw(Card c, Point p, Thing t, ThrowMethod method=ThrowMethod.Default, float failChance=0f)
Definition: ActThrow.cs:97
Definition: ACT.cs:62
BaseArea.AccessType accessType
Definition: AreaData.cs:42
AccessType
Definition: BaseArea.cs:9
AreaData data
Definition: BaseArea.cs:29
virtual Point GetRandomPoint(bool walkable=true, bool allowChara=true)
Definition: BaseArea.cs:88
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39
GlobalCharaList globalCharas
Definition: CardManager.cs:46
TC GetTC(string id)
Definition: Card.cs:11
bool isDestroyed
Definition: Card.cs:76
MinionType c_minionType
Definition: Card.cs:989
bool IsPCFactionOrMinion
Definition: Card.cs:2275
void Teleport(Point point, bool silent=false, bool force=false)
Definition: Card.cs:5904
ElementContainerCard elements
Definition: Card.cs:42
string id
Definition: Card.cs:36
bool IsRestrainedResident
Definition: Card.cs:2261
bool isRestrained
Definition: Card.cs:567
CardRenderer HostRenderer
Definition: Card.cs:2445
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6318
int GetHearingRadius()
Definition: Card.cs:6567
int c_uidMaster
Definition: Card.cs:1450
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3127
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6878
int hp
Definition: Card.cs:243
ICardParent parent
Definition: Card.cs:56
bool ExistsOnMap
Definition: Card.cs:2086
int GetCurrency(string id="money")
Definition: Card.cs:4004
Thing c_bloodData
Definition: Card.cs:1918
bool HasTag(CTAG tag)
Definition: Card.cs:2598
Point pos
Definition: Card.cs:60
bool IsInMutterDistance(int d=10)
Definition: Card.cs:7886
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6286
Trait trait
Definition: Card.cs:54
void ModCurrency(int a, string id="money")
Definition: Card.cs:3990
int encLV
Definition: Card.cs:327
bool IsEquipment
Definition: Card.cs:2176
void DamageHP(long dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:4092
void ModEncLv(int a)
Definition: Card.cs:3875
bool c_isImportant
Definition: Card.cs:1025
MoveResult
Definition: Card.cs:13
bool noMove
Definition: Card.cs:771
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2603
ThingContainer things
Definition: Card.cs:39
bool IsInstalled
Definition: Card.cs:2384
virtual Thing Thing
Definition: Card.cs:2059
int Evalue(int ele)
Definition: Card.cs:2574
int Dist(Card c)
Definition: Card.cs:7842
bool isGifted
Definition: Card.cs:783
Cell Cell
Definition: Card.cs:2056
int Num
Definition: Card.cs:159
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:6337
SourceCategory.Row category
Definition: Card.cs:2050
void ModNum(int a, bool notify=true)
Definition: Card.cs:3544
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6065
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6995
Room room
Definition: Cell.cs:102
bool IsSnowTile
Definition: Cell.cs:782
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712
bool HasFire
Definition: Cell.cs:676
ActList list
Definition: CharaAbility.cs:12
bool Has(int id)
Definition: Chara.cs:10
void OnInsulted()
Definition: Chara.cs:8188
bool HasHobbyOrWork(string alias)
Definition: Chara.cs:8864
override bool IsAliveInCurrentZone
Definition: Chara.cs:563
Thing FindBestFoodToEat()
Definition: Chara.cs:7571
new TraitChara trait
Definition: Chara.cs:505
Hostility OriginalHostility
Definition: Chara.cs:473
Card held
Definition: Chara.cs:70
AIAct ai
Definition: Chara.cs:204
bool TryUse(Thing t)
Definition: Chara.cs:7899
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:6264
int sharedCheckTurn
Definition: Chara.cs:120
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:7592
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9273
Faction faction
Definition: Chara.cs:429
override bool IsPC
Definition: Chara.cs:614
bool isDrunk
Definition: Chara.cs:126
Chara host
Definition: Chara.cs:33
Chara GetNearbyCatToSniff()
Definition: Chara.cs:8099
bool CanSeeLos(Card c, int dist=-1)
Definition: Chara.cs:1264
bool IsMofuable
Definition: Chara.cs:1113
override bool IsPCParty
Definition: Chara.cs:617
Party party
Definition: Chara.cs:43
bool IsInCombat
Definition: Chara.cs:866
TraitBed TryAssignBed()
Definition: Chara.cs:7351
void PickHeld(bool msg=false)
Definition: Chara.cs:4544
bool HasCondition(string alias)
Definition: Chara.cs:9434
void Banish(Chara owner)
Definition: Chara.cs:2364
AIAct SetAI(AIAct g)
Definition: Chara.cs:8903
bool IsIdle
Definition: Chara.cs:855
TraitBed FindBed()
Definition: Chara.cs:7339
Stats hunger
Definition: Chara.cs:1156
override bool IsMinion
Definition: Chara.cs:629
override bool isSynced
Definition: Chara.cs:693
Point orgPos
Definition: Chara.cs:21
bool IsHuman
Definition: Chara.cs:881
ConTransmuteMimic mimicry
Definition: Chara.cs:106
bool MoveRandom()
Definition: Chara.cs:2610
void TryPutSharedItems(IEnumerable< Thing > containers, bool msg=true)
Definition: Chara.cs:7369
override bool IsPCFaction
Definition: Chara.cs:673
bool CanSee(Card c)
Definition: Chara.cs:1232
bool HasAccess(Card c)
Definition: Chara.cs:1294
bool CanEat(Thing t, bool shouldEat=false)
Definition: Chara.cs:7617
Chara Duplicate()
Definition: Chara.cs:1805
override int MaxHP
Definition: Chara.cs:710
bool CanDuplicate()
Definition: Chara.cs:1780
void ClearInventory(ClearInventoryType type)
Definition: Chara.cs:8546
SourceChara.Row source
Definition: Chara.cs:160
Stats mana
Definition: Chara.cs:1168
FactionMemberType memberType
Definition: Chara.cs:46
string TalkTopic(string topic="calm")
Definition: Chara.cs:6986
Stats stamina
Definition: Chara.cs:1160
bool MoveNeighborDefinitely()
Definition: Chara.cs:2624
bool UseAbility(int idAct, Card tc=null, Point pos=null, bool pt=false)
Definition: Chara.cs:5828
void SetTempHand(int right=0, int left=0)
Definition: Chara.cs:6714
Chara parasite
Definition: Chara.cs:30
Chara master
Definition: Chara.cs:88
bool IsGuest()
Definition: Chara.cs:6624
Hobby GetWork(string id)
Definition: Chara.cs:9014
Thing nextUse
Definition: Chara.cs:100
MoveResult TryMoveTowards(Point p)
Definition: Chara.cs:2650
Religion faith
Definition: Chara.cs:441
Chara enemy
Definition: Chara.cs:86
CharaAbility ability
Definition: Chara.cs:426
Chara FindMaster()
Definition: Chara.cs:2419
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6303
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:6352
Room FindRoom()
Definition: Chara.cs:7955
Point GetDestination()
Definition: Chara.cs:7258
int turnLastSeen
Definition: Chara.cs:112
FactionBranch homeBranch
Definition: Chara.cs:1068
void Drink(Card t)
Definition: Chara.cs:5142
Hostility hostility
Definition: Chara.cs:293
bool IsHostile()
Definition: Chara.cs:6533
void TryTakeSharedItems(bool msg=true)
Definition: Chara.cs:7407
PCCData pccData
Definition: Chara.cs:67
Chara SetHostility(Hostility h)
Definition: Chara.cs:1456
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4328
void Sniff(Chara c)
Definition: Chara.cs:8111
override bool IsPCC
Definition: Chara.cs:684
int idleActTimer
Definition: Chara.cs:114
bool IsCat
Definition: Chara.cs:989
SourceRace.Row race
Definition: Chara.cs:466
Definition: ConHOT.cs:4
int AllyDistance(Chara c)
bool enable
Definition: CoreDebug.cs:286
static int GetFoodScore(Thing food)
Definition: CraftUtil.cs:141
int GetRaw(int offsetHours=0)
Definition: Date.cs:326
bool IsNight
Definition: Date.cs:112
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
static FactionBranch Branch
Definition: EClass.cs:23
static int rndHalf(int a)
Definition: EClass.cs:97
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static SoundManager Sound
Definition: EClass.cs:47
Dictionary< int, Element > dict
Element ModTempPotential(int ele, int v, int threshMsg=0)
Element ModBase(int ele, int v)
int ValueWithoutLink
Definition: ELEMENT.cs:299
int id
Definition: ELEMENT.cs:255
SourceElement.Row source
Definition: ELEMENT.cs:278
int vTempPotential
Definition: ELEMENT.cs:263
Act act
Definition: ELEMENT.cs:399
Thing GetMeal(Chara c)
List< Chara > members
PolicyManager policies
ConfigTactics tactics
Definition: Game.cs:91
ReligionManager religions
Definition: Game.cs:159
CardManager cards
Definition: Game.cs:156
Config config
Definition: Game.cs:219
static bool Has(string id)
Definition: LangGame.cs:46
Definition: Lang.cs:6
static LangGame Game
Definition: Lang.cs:48
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162
static LayerCraft Instance
Definition: LayerCraft.cs:8
static LayerDragGrid Instance
Definition: Los.cs:5
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
Definition: Los.cs:167
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
Definition: Map.cs:2215
PropsInstalled Installed
Definition: Map.cs:123
PropsManager props
Definition: Map.cs:91
RoomManager rooms
Definition: Map.cs:31
List< Chara > charas
Definition: Map.cs:81
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: Party.cs:7
bool HasElement(int ele, bool excludePC=false)
Definition: Party.cs:194
int EvalueTotal(int ele, Func< Chara, bool > funcIf=null)
Definition: Party.cs:181
Chara leader
Definition: Party.cs:31
List< Chara > members
Definition: Party.cs:19
int turns
Definition: Player.cs:84
int karma
Definition: Player.cs:878
Stats stats
Definition: Player.cs:1016
Definition: Point.cs:9
ref Vector3 Position(int height)
Definition: Point.cs:548
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1397
CellDetail detail
Definition: Point.cs:71
bool IsBlocked
Definition: Point.cs:363
List< Thing > Things
Definition: Point.cs:338
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:619
List< Chara > ListCharasInNeighbor(Func< Chara, bool > func)
Definition: Point.cs:1200
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
Definition: Point.cs:1220
bool Equals(int _x, int _z)
Definition: Point.cs:960
bool IsValid
Definition: Point.cs:88
Point GetRandomPointInRadius(int minRadius, int maxRadius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=2000)
Definition: Point.cs:783
int Distance(Point p)
Definition: Point.cs:989
Chara FirstChara
Definition: Point.cs:288
bool IsInBounds
Definition: Point.cs:104
Cell cell
Definition: Point.cs:51
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1140
bool HasChara
Definition: Point.cs:238
bool IsHotSpring
Definition: Point.cs:375
bool IsDeepWater
Definition: Point.cs:276
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:769
bool IsActive(int id, int days=-1)
List< PopItem > items
Definition: PopManager.cs:34
PropsInstalled installed
Definition: PropsManager.cs:8
TraitManager traits
Definition: Props.cs:18
Thing Find(int uid)
Definition: Props.cs:389
ReligionHarmony Harmony
List< Room > listRoom
Definition: RoomManager.cs:13
List< Area > listArea
Definition: RoomManager.cs:10
Definition: Room.cs:4
Lot lot
Definition: Room.cs:21
virtual bool IsRegion
Definition: Spatial.cs:515
virtual void Mod(int a)
Definition: Stats.cs:135
override int GetPhase()
Definition: Stats.cs:117
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
Definition: TCText.cs:6
PopManager pop
Definition: TCText.cs:9
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
Thing Find(int uid)
bool IsFull(int y=0)
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
bool IsSharedContainer
Definition: Thing.cs:113
virtual AI_Idle.Behaviour IdleBehaviour
Definition: TraitChara.cs:17
virtual string IdAmbience
Definition: TraitChara.cs:135
virtual bool CanFish
Definition: TraitChara.cs:137
virtual bool IdleAct()
Definition: TraitChara.cs:139
TraitMap restSpots
Definition: TraitManager.cs:10
virtual bool AllowTraining
Definition: TraitShackle.cs:15
virtual bool CanRead(Chara c)
Definition: Trait.cs:991
virtual bool CanEat(Chara c)
Definition: Trait.cs:1000
virtual int IdleUseChance
Definition: Trait.cs:375
virtual bool IdleUse(Chara c, int dist)
Definition: Trait.cs:669
virtual bool CanDrink(Chara c)
Definition: Trait.cs:1009
GameDate date
Definition: World.cs:6
Definition: Zone.cs:12
static int okaerinko
Definition: Zone.cs:31
virtual bool IsNefia
Definition: Zone.cs:285
FactionBranch branch
Definition: Zone.cs:34
virtual bool IsUserZone
Definition: Zone.cs:271
Chara Boss
Definition: Zone.cs:86
virtual bool IsTown
Definition: Zone.cs:223
Chara SpawnMob(string id, Point pos=null)
Definition: Zone.cs:2764
virtual bool PetFollow
Definition: Zone.cs:287
bool IsPCFaction
Definition: Zone.cs:473
virtual bool IsUnderwater
Definition: Zone.cs:269
Card AddCard(Card t, Point point)
Definition: Zone.cs:1992