Elin Decompiled Documentation EA 23.291 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 actHeal = null;
138 Act actRevive = null;
139 foreach (ActList.Item item in owner.ability.list.items)
140 {
141 Act act = item.act;
142 if (act.id == 8430)
143 {
144 actRevive = act;
145 }
146 string[] abilityType = act.source.abilityType;
147 if (!abilityType.IsEmpty() && (abilityType[0] == "heal" || abilityType[0] == "hot"))
148 {
149 actHeal = item.act;
150 }
151 }
152 if (actHeal != 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) && (!(actHeal.source.abilityType[0] == "hot") || !item2.HasCondition<ConHOT>()))
158 {
159 owner.UseAbility(actHeal, item2);
160 yield return KeepRunning();
161 break;
162 }
163 }
164 if (owner.id == "priest" && !owner.IsPCParty && owner.Dist(EClass.pc) <= 4)
165 {
166 if (EClass.pc.hp < EClass.pc.MaxHP)
167 {
168 if (owner.UseAbility(actHeal, EClass.pc, null, pt: true))
169 {
170 owner.AddCooldown(actHeal.id, 5);
171 owner.Talk("no_problem");
172 }
173 }
174 else if (!EClass.pc.HasCondition<ConHolyVeil>() && owner.UseAbility(8500, EClass.pc, null, pt: true))
175 {
176 owner.AddCooldown(8500, 30);
177 owner.Talk("no_problem");
178 }
179 }
180 }
181 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))
182 {
183 yield return KeepRunning();
184 }
185 }
186 }
188 {
190 if (owner.sharedCheckTurn < 0 && EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
191 {
194 owner.sharedCheckTurn += (EClass.debug.enable ? 20 : 200);
195 }
196 }
197 if ((EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (owner.IsPCParty ? 10 : (owner.IsPCFaction ? 2 : 0)) > EClass.rnd(100))
198 {
199 Thing thing2 = owner.things.Find("polish_powder");
200 if (thing2 != null && EClass._map.props.installed.Find<TraitGrindstone>() != null)
201 {
202 foreach (Thing thing10 in owner.things)
203 {
204 if (!thing10.IsEquipment || thing10.encLV >= 0)
205 {
206 continue;
207 }
208 for (int l = 0; l < 5; l++)
209 {
210 if (thing10.encLV >= 0)
211 {
212 break;
213 }
214 owner.Say("polish", owner, thing10);
215 thing10.ModEncLv(1);
216 thing2.ModNum(-1);
217 if (thing2.isDestroyed)
218 {
219 break;
220 }
221 }
222 if (thing2.isDestroyed)
223 {
224 break;
225 }
226 }
227 }
228 }
229 if (owner.IsPCParty)
230 {
232 {
233 TraitShackle traitShackle = owner.pos.FindThing<TraitShackle>();
234 if (traitShackle != null && traitShackle.AllowTraining)
235 {
237 {
238 shackle = traitShackle
239 });
240 }
241 yield return Restart();
242 }
243 if (EClass.rnd(20) == 0)
244 {
245 Thing thing3 = owner.things.Find((Thing a) => a.parent == owner && a.isGifted && (a.category.id == "skillbook" || a.category.id == "ancientbook"));
246 if (thing3 != null && thing3.trait.CanRead(owner) && (thing3.Num == 1 || !owner.things.IsFull()))
247 {
248 yield return Do(new AI_Read
249 {
250 target = thing3
251 });
252 }
253 }
254 if (!EClass._zone.IsRegion)
255 {
256 if (EClass.rnd(100) == 0 && owner.HasElement(1227))
257 {
258 List<Chara> list2 = new List<Chara>();
259 foreach (Chara member in EClass.pc.party.members)
260 {
261 if (member.Evalue(1227) > 0)
262 {
263 list2.Add(member);
264 }
265 }
266 if (list2.Count > 2 + EClass.pc.party.EvalueTotal(1272, (Chara c) => c.IsPC || c.faith == EClass.game.religions.Harmony))
267 {
268 list2.Remove(owner);
269 owner.SetEnemy(list2.RandomItem());
270 yield return Success();
271 }
272 }
273 if (EClass.rnd(20) == 0 && owner.IsMarried)
274 {
275 List<Chara> list3 = new List<Chara>();
276 foreach (Chara member2 in EClass.pc.party.members)
277 {
278 if (member2 != owner && member2.IsMarried)
279 {
280 list3.Add(member2);
281 }
282 }
283 if (list3.Count > EClass.pc.Evalue(1276))
284 {
285 owner.SetEnemy(list3.RandomItem());
286 yield return Success();
287 }
288 }
289 }
290 if (EClass.rnd(150) == 0 && owner.host != null && owner.host.parasite == owner && owner.GetInt(108) == 1)
291 {
292 owner.host.PlaySound("whip");
293 owner.host.Say("use_whip3", owner, owner.host);
294 owner.Talk("insult");
295 owner.host.PlayAnime(AnimeID.Shiver);
296 owner.host.DamageHP(5 + EClass.rndHalf(owner.host.MaxHP / 5), 919, 100, AttackSource.Condition);
298 yield return KeepRunning();
299 }
300 if (EClass.rnd(EClass.debug.enable ? 2 : 20) == 0 && owner.CanSee(EClass.pc) && !(EClass.pc.ai is AI_Eat))
301 {
303 }
304 if (owner.isSynced && EClass.rnd((owner.host == null) ? 200 : 150) == 0 && owner.GetInt(106) == 0)
305 {
306 if (EClass.rnd(2) == 0 && owner.GetInt(108) == 1)
307 {
308 owner.Talk("insult");
309 }
310 else
311 {
313 }
314 }
315 if (EClass.rnd(100) == 0 && EClass._zone.IsTown)
316 {
318 }
319 if ((EClass.rnd(20) == 0 || EClass.debug.enable) && owner.GetCurrency() >= 500)
320 {
321 bool flag = EClass._zone.IsTown;
323 {
324 foreach (Chara member3 in EClass._zone.branch.members)
325 {
326 if (member3.ExistsOnMap && member3.trait is TraitTrainer)
327 {
328 flag = true;
329 }
330 }
331 }
332 if (flag)
333 {
334 bool flag2 = false;
335 foreach (Element value in owner.elements.dict.Values)
336 {
337 if (!(value.source.category != "skill") && value.vTempPotential < 900)
338 {
339 flag2 = true;
340 break;
341 }
342 }
343 if (flag2)
344 {
345 int num2 = owner.GetCurrency();
346 if (num2 >= 20000)
347 {
348 num2 = 20000;
349 }
350 owner.PlaySound("pay");
351 int num3 = num2 / 200;
352 foreach (Element value2 in owner.elements.dict.Values)
353 {
354 if (!(value2.source.category != "skill"))
355 {
356 int num4 = num3 * 100 / (100 + (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) * (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) / 100);
357 num4 += 1 + EClass.rnd(3);
358 owner.elements.ModTempPotential(value2.id, Mathf.Max(1, num4), 9999);
359 }
360 }
361 Msg.Say("party_train", owner, Lang._currency(num2));
362 owner.PlaySound("ding_potential");
363 owner.ModCurrency(-num2);
364 }
365 }
366 }
367 if (EClass.rnd(100) == 0 && EClass.pc.ai is AI_Fish && owner.stamina.value > 0 && owner.things.Find<TraitToolFishing>() != null)
368 {
369 Point randomPointInRadius = EClass.pc.pos.GetRandomPointInRadius(0, 3);
370 if (randomPointInRadius != null)
371 {
372 randomPointInRadius = AI_Fish.GetFishingPoint(randomPointInRadius);
373 if (randomPointInRadius.IsValid)
374 {
375 yield return Do(new AI_Fish
376 {
377 pos = randomPointInRadius
378 });
379 }
380 }
381 }
382 }
383 if (owner.c_uidMaster != 0)
384 {
385 Chara chara2 = owner.master;
386 if (chara2 == null || !chara2.IsAliveInCurrentZone)
387 {
388 chara2 = owner.FindMaster();
389 }
390 if (chara2 != null && chara2.IsAliveInCurrentZone)
391 {
392 if (owner.enemy == null)
393 {
394 owner.SetEnemy(chara2.enemy);
395 }
396 int num5 = owner.Dist(chara2.pos);
397 if (owner.source.aiIdle != "root" && num5 > EClass.game.config.tactics.AllyDistance(owner) && EClass._zone.PetFollow && owner.c_minionType == MinionType.Default)
398 {
399 if (owner.HasAccess(chara2.pos))
400 {
401 owner.TryMoveTowards(chara2.pos);
402 }
403 yield return KeepRunning();
404 continue;
405 }
406 }
407 }
408 if (!EClass._zone.IsRegion)
409 {
410 if (EClass.rnd(5) == 0 && owner.HasElement(1425) && owner.mimicry == null)
411 {
412 owner.UseAbility(8794, owner);
413 }
414 if (EClass.rnd(25) == 0 && owner.HasElement(1427) && owner.mimicry == null)
415 {
416 owner.UseAbility(8796, owner);
417 }
418 }
419 Party party = owner.party;
420 if (party == null || party.leader == owner || !party.leader.IsAliveInCurrentZone || owner.host != null || !EClass._zone.PetFollow)
421 {
422 break;
423 }
424 if (owner.source.aiIdle == "root")
425 {
426 yield return KeepRunning();
427 continue;
428 }
430 {
431 yield return KeepRunning();
432 continue;
433 }
434 if (owner.HasAccess(party.leader.pos) && owner.TryMoveTowards(party.leader.pos) == Card.MoveResult.Fail && owner.Dist(party.leader) > 4)
435 {
437 bool flag3 = (EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (EClass.pc.enemy == null || !EClass.pc.enemy.IsAliveInCurrentZone);
438 if (moveFailCount >= (flag3 ? 100 : 10))
439 {
440 owner.Teleport(party.leader.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true), silent: false, force: true);
441 moveFailCount = 0;
442 }
443 }
444 else
445 {
446 moveFailCount = 0;
447 }
448 yield return KeepRunning();
449 }
450 if (EClass._zone.IsNefia && EClass._zone.Boss == owner && EClass.rnd(20) == 0)
451 {
453 }
454 if (EClass._zone.IsRegion && EClass.rnd(10) != 0)
455 {
456 yield return Restart();
457 }
458 if (((owner.homeBranch != null && owner.homeBranch == EClass.Branch && EClass.rnd(100) == 0) || (owner.IsGuest() && EClass.rnd(50) == 0)) && owner.FindBed() == null)
459 {
461 }
462 if (!EClass._zone.IsRegion)
463 {
464 switch (owner.id)
465 {
466 case "azzrasizzle":
467 case "geist":
468 {
469 if (EClass.rnd(20) != 0)
470 {
471 break;
472 }
473 Point nearestPoint = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false);
474 if (nearestPoint == null)
475 {
476 break;
477 }
478 foreach (Chara item3 in nearestPoint.ListCharasInRadius(owner, 6, (Chara _c) => _c != owner && !_c.IsPCFactionOrMinion && _c.id != "cocoon"))
479 {
480 item3.Teleport(nearestPoint.GetNearestPoint(allowBlock: false, allowChara: false) ?? nearestPoint);
481 }
482 if (owner != null)
483 {
485 {
486 EClass.pc.ai.Cancel();
487 }
488 owner.Teleport(nearestPoint);
489 }
490 yield return Success();
491 break;
492 }
493 case "spider_queen":
494 {
495 if (EClass.rnd(20) != 0 || !owner.CanDuplicate() || EClass._zone.IsUserZone)
496 {
497 break;
498 }
499 int i = 0;
500 owner.pos.ForeachNeighbor(delegate(Point p)
501 {
502 if (p.HasChara && p.FirstChara.id == "cocoon")
503 {
504 i++;
505 }
506 });
507 if (i < 2)
508 {
509 Point randomPoint2 = owner.pos.GetRandomPoint(1, requireLos: false, allowChara: false, allowBlocked: false, 20);
510 if (randomPoint2 != null)
511 {
512 Chara chara3 = EClass._zone.SpawnMob("cocoon", randomPoint2);
513 owner.Say("egglay", owner);
515 }
516 }
517 break;
518 }
519 case "mech_scarab":
520 {
521 if (EClass.rnd(20) != 0 || !owner.CanDuplicate() || EClass._zone.IsUserZone)
522 {
523 break;
524 }
525 int j = 0;
526 owner.pos.ForeachNeighbor(delegate(Point p)
527 {
528 if (p.HasChara && p.FirstChara.id == "mech_scarab")
529 {
530 j++;
531 }
532 });
533 if (j >= 2)
534 {
535 break;
536 }
537 Point randomPoint = owner.pos.GetRandomPoint(1, requireLos: false, allowChara: false, allowBlocked: false, 20);
538 if (randomPoint != null)
539 {
540 Card c2 = EClass._zone.AddCard(owner.Duplicate(), randomPoint);
541 if (randomPoint.Distance(EClass.pc.pos) < EClass.pc.GetHearingRadius())
542 {
543 Msg.Say("self_dupe", owner, c2);
544 }
545 }
546 break;
547 }
548 }
549 }
550 if (owner.IsMinion && owner.master != null && owner.master.id == "keeper_garden" && !(owner.master.ai is GoalCombat))
551 {
553 yield return Success();
554 }
556 {
557 Room room = owner.pos.cell.room;
558 if (room != null)
559 {
560 Point point = null;
561 if (owner.memberType == FactionMemberType.Guest && room.data.accessType != 0)
562 {
563 point = FindMovePoint(BaseArea.AccessType.Public);
564 }
565 else if (owner.memberType == FactionMemberType.Default && room.data.accessType == BaseArea.AccessType.Private)
566 {
567 point = FindMovePoint(BaseArea.AccessType.Resident) ?? FindMovePoint(BaseArea.AccessType.Public);
568 }
569 if (point != null)
570 {
571 yield return DoGoto(point);
572 }
573 }
574 }
575 string id;
576 int num;
578 {
579 if (owner.IsPCFaction && owner.GetInt(32) + 4320 < EClass.world.date.GetRaw())
580 {
581 if (owner.GetInt(32) != 0 && Zone.okaerinko < 10)
582 {
583 owner.Talk("welcomeBack");
584 Zone.okaerinko++;
585 }
587 }
589 {
591 {
592 id = "money";
593 num = EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(500)))) + 1;
594 string[] strs = new string[4] { "1294", "1294", "1130", "1131" };
595 ThrowMethod throwMethod = ThrowMethod.Reward;
597 {
598 owner.Talk("curse_wed");
599 throwMethod = ThrowMethod.Punish;
600 SetId("stone", 1);
601 if (EClass.rnd(3) == 0)
602 {
603 SetId("shuriken", 1);
604 }
605 if (EClass.rnd(3) == 0)
606 {
607 SetId("explosive", 1);
608 }
609 if (EClass.rnd(3) == 0)
610 {
611 SetId("explosive_mega", 1);
612 }
613 if (EClass.rnd(3) == 0)
614 {
615 SetId("rock", 1);
616 }
617 }
618 else
619 {
620 if (EClass.rnd(2) == 0)
621 {
622 owner.PlaySound((EClass.rnd(3) == 0) ? "clap1" : ((EClass.rnd(2) == 0) ? "clap2" : "clap3"));
623 }
624 owner.Talk("grats_wed");
625 if (EClass.rnd(5) == 0)
626 {
627 SetId("money2", 1);
628 }
629 if (EClass.rnd(4) == 0)
630 {
631 SetId("plat", 1);
632 }
633 if (EClass.rnd(3) == 0)
634 {
635 SetId(strs.RandomItem(), 1);
636 }
637 }
638 Thing thing4 = ThingGen.Create(id, -1, owner.LV).SetNum(num);
639 thing4.SetRandomDir();
640 ActThrow.Throw(owner, EClass.pc.pos, thing4, throwMethod);
641 if (EClass.pc.IsAliveInCurrentZone && throwMethod == ThrowMethod.Reward && thing4.ExistsOnMap && thing4.pos.Equals(EClass.pc.pos) && !strs.Contains(thing4.id))
642 {
643 EClass.pc.Pick(thing4);
644 }
645 }
646 else if (EClass.rnd(5) == 0 && owner.hostility >= Hostility.Neutral && EClass.pc.IsPCC && EClass.pc.pccData.state == PCCState.Undie && !EClass.pc.pos.cell.IsTopWaterAndNoSnow)
647 {
648 owner.Talk("pervert3");
649 }
650 else if (EClass.rnd(15) == 0 && EClass._zone.IsTown && owner.hostility >= Hostility.Neutral && !owner.IsPCFaction && !EClass.pc.HasCondition<ConIncognito>())
651 {
652 bool flag4 = EClass._zone is Zone_Derphy;
653 string text = ((EClass.player.karma > 10) ? ((EClass.player.karma < 90) ? "" : (flag4 ? "rumor_bad" : "rumor_good")) : (flag4 ? "rumor_good" : "rumor_bad"));
654 if (!text.IsEmpty())
655 {
656 owner.Talk(text);
657 }
658 if ((flag4 ? (EClass.player.karma >= 90) : (EClass.player.karma <= 10)) && EClass.rnd(10) == 0)
659 {
660 Thing t2 = ThingGen.Create("stone", -1, owner.LV);
661 AI_PlayMusic.ignoreDamage = true;
663 AI_PlayMusic.ignoreDamage = false;
664 }
665 }
666 else
667 {
668 owner.TalkTopic("fov");
669 }
670 owner.turnLastSeen = EClass.player.stats.turns;
671 }
672 }
673 if (EClass.rnd(25) == 0 && owner.IsInMutterDistance())
674 {
676 {
677 owner.PlayAnime(AnimeID.Shiver);
678 }
680 if (tC == null || tC.pop.items.Count == 0)
681 {
682 if (owner.noMove)
683 {
684 foreach (Thing thing11 in owner.pos.Things)
685 {
686 if (thing11.IsInstalled && thing11.trait is TraitGeneratorWheel)
687 {
688 owner.Talk("labor");
689 owner.PlayAnime(AnimeID.Shiver);
690 yield return Restart();
691 }
692 }
693 }
694 if (owner.isDrunk && (owner.race.id == "cat" || owner.id == "sailor"))
695 {
696 owner.Talk("drunk_cat");
697 }
698 else if (owner.isRestrained)
699 {
700 owner.Talk("restrained");
701 }
702 else if (owner.GetInt(106) == 0 && !owner.IsPCParty)
703 {
704 if (owner.HasElement(1232) && EClass.rnd(4) == 0)
705 {
706 owner.Talk("baby");
707 }
708 else if (EClass.rnd((owner.host == null) ? 2 : 10) == 0 && owner.isSynced && owner.TalkTopic().IsEmpty())
709 {
710 owner.Talk(owner.pos.IsHotSpring ? "hotspring" : "idle");
711 }
712 }
713 }
714 }
715 if (EClass.rnd(8) == 0 && owner.race.id == "chicken")
716 {
717 owner.PlaySound("Animal/Chicken/chicken");
718 }
719 if (EClass.rnd(80) == 0 && owner.race.id == "cat")
720 {
721 owner.PlaySound("Animal/Cat/cat");
722 }
723 if (owner.trait.IdAmbience != null && owner.IsInMutterDistance(15))
724 {
725 float mtp = 1f;
726 Room room2 = owner.Cell.room;
727 Room room3 = EClass.pc.Cell.room;
728 if (room2 != room3 && room3 != null)
729 {
730 mtp = ((room2?.lot != room3?.lot) ? 0.4f : 0.7f);
731 }
732 EClass.Sound.PlayAmbience(owner.trait.IdAmbience, owner.pos.Position(), mtp);
733 }
734 if (EClass.rnd((EClass._zone is Zone_Wedding && !owner.HasCondition<ConDrunk>()) ? 30 : 2000) == 0 && owner.IsHuman && (owner.host == null || owner.host.ride != owner))
735 {
736 Thing thing5 = owner.things.Find((Thing a) => !a.IsNegativeGift && a.trait.CanDrink(owner), recursive: false);
737 if (thing5 != null && thing5.trait is TraitPotion && owner.IsPCParty)
738 {
739 thing5 = null;
740 }
741 bool flag5 = EClass.Branch != null && EClass.Branch.policies.IsActive(2503);
742 if (owner.homeBranch != null && owner.homeBranch.policies.IsActive(2503))
743 {
744 flag5 = true;
745 }
746 if (thing5 == null && !flag5)
747 {
748 thing5 = ThingGen.Create("crimAle");
749 owner.Drink(thing5);
750 }
751 if (thing5 != null && !thing5.isDestroyed)
752 {
753 owner.TryUse(thing5);
754 yield return Restart();
755 }
756 }
757 if (EClass.rnd(owner.IsPCParty ? 1000 : 200) == 0 && owner.isDrunk && (owner.isSynced || EClass.rnd(5) == 0))
758 {
759 DoSomethingToCharaInRadius(3, null, delegate(Chara c)
760 {
761 owner.Say("drunk_mess", owner, c);
762 owner.Talk("drunk_mess");
763 bool flag6 = EClass.rnd(5) == 0 && !c.IsPC;
764 if (c.IsPCParty && owner.hostility >= Hostility.Friend)
765 {
766 flag6 = false;
767 }
768 if (flag6)
769 {
770 owner.Say("drunk_counter", c, owner);
771 c.Talk("drunk_counter");
773 }
774 });
775 }
776 if (EClass.rnd(100) == 0 && owner.trait.CanFish && owner.stamina.value > 0)
777 {
778 Point fishingPoint = AI_Fish.GetFishingPoint(owner.pos);
779 if (fishingPoint.IsValid)
780 {
781 yield return Do(new AI_Fish
782 {
783 pos = fishingPoint
784 });
785 }
786 }
787 string idAct = owner.source.actIdle.RandomItem();
788 if (EClass.rnd(EClass.world.date.IsNight ? 1500 : 15000) == 0 && !owner.IsPCFaction && !owner.noMove)
789 {
790 owner.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
791 }
792 if (!owner.noMove)
793 {
794 if (EClass.rnd(3) == 0 && owner.IsCat)
795 {
796 Chara chara4 = ((EClass.rnd(5) == 0) ? EClass.pc.party.members.RandomItem() : EClass._map.charas.RandomItem());
797 Thing thing6 = chara4.things.Find<TraitFoodChuryu>();
798 if (chara4 != owner && thing6 != null)
799 {
800 yield return Do(new AI_Churyu
801 {
802 churyu = thing6,
803 slave = chara4
804 });
805 }
806 }
807 if (EClass.rnd(100) == 0 && (owner.HasHobbyOrWork("Pet") || owner.HasHobbyOrWork("Fluffy")))
808 {
809 yield return Do(new AI_Mofu());
810 }
811 }
812 if (EClass.rnd((owner.host != null && owner.GetInt(106) != 0) ? 1000 : 40) == 0 && owner.IsHuman)
813 {
814 DoSomethingToNearChara((Chara c) => (!c.IsPCParty || EClass.rnd(5) == 0) && c.IsMofuable && !owner.IsHostile(c) && !c.IsInCombat && owner.CanSee(c), delegate(Chara c)
815 {
816 owner.Cuddle(c);
817 });
818 yield return KeepRunning();
819 }
820 if (EClass.rnd(100) == 0 && owner.trait is TraitBitch)
821 {
822 Chara chara5 = DoSomethingToNearChara((Chara c) => c.IsIdle && !c.IsPCParty && !(c.trait is TraitBitch) && c.Evalue(418) <= 0);
823 if (chara5 != null)
824 {
825 yield return Do(new AI_Fuck
826 {
827 target = chara5,
828 variation = AI_Fuck.Variation.Bitch
829 });
830 }
831 }
832 if (EClass.rnd(50) == 0 && owner.trait is TraitBard)
833 {
834 yield return Do(new AI_PlayMusic());
835 }
836 if (EClass.rnd(4) == 0 && TryPerformIdleUse())
837 {
838 yield return Restart();
839 }
840 if (EClass.rnd(20) == 0 && owner.trait.IdleAct())
841 {
842 yield return Restart();
843 }
844 if (idAct == "janitor" && EClass.rnd(5) == 0)
845 {
846 DoSomethingToCharaInRadius(4, null, delegate(Chara c)
847 {
848 if (c.HasElement(1211) && !(EClass._zone is Zone_Casino))
849 {
850 owner.Talk("snail");
851 Thing t4 = ThingGen.Create("1142");
852 ActThrow.Throw(owner, c.pos, t4);
853 }
854 });
855 yield return Restart();
856 }
858 {
859 TraitShackle traitShackle2 = owner.pos.FindThing<TraitShackle>();
860 if (traitShackle2 != null && traitShackle2.AllowTraining)
861 {
863 {
864 shackle = traitShackle2
865 });
866 yield return Restart();
867 }
868 }
869 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>())
870 {
872 }
873 if (EClass.rnd(200) == 0 && !owner.noMove)
874 {
875 Point cleanPoint = AI_Clean.GetCleanPoint(owner, 4);
876 if (cleanPoint != null)
877 {
878 yield return Do(new AI_Clean
879 {
880 pos = cleanPoint
881 });
882 }
883 }
884 if (EClass.rnd(owner.isSynced ? 10 : 2000) == 0 && owner.ability.Has(5058))
885 {
886 if (!owner.UseAbility(5058) && !owner.IsPCFaction)
887 {
890 if (owner.isSynced)
891 {
893 }
894 }
895 yield return Restart();
896 }
897 if (EClass.rnd(35) == 0 && owner.id == "child" && owner.pos.cell.IsSnowTile)
898 {
899 foreach (Chara chara6 in EClass._map.charas)
900 {
901 if (EClass.rnd(3) != 0 && chara6 != owner && chara6.pos.cell.IsSnowTile && chara6.Dist(owner) <= 6 && Los.IsVisible(chara6, owner))
902 {
903 Thing t3 = ThingGen.Create("snow");
904 ActThrow.Throw(owner, chara6.pos, t3);
905 break;
906 }
907 }
908 }
909 if (EClass.rnd(EClass.debug.enable ? 3 : 30) == 0)
910 {
911 Thing thing7 = owner.things.Find<TraitBall>();
912 if (thing7 == null)
913 {
915 {
916 owner.pos.ForeachNeighbor(delegate(Point p)
917 {
918 Card card2 = p.FindThing<TraitBall>()?.owner;
919 if (card2 != null)
920 {
921 owner.Pick(card2.Thing);
922 }
923 });
924 }
925 }
926 else
927 {
928 foreach (Chara chara7 in EClass._map.charas)
929 {
930 if (EClass.rnd(3) != 0 && chara7 != owner && chara7.Dist(owner) <= 6 && chara7.Dist(owner) >= 3 && Los.IsVisible(chara7, owner))
931 {
932 ActThrow.Throw(owner, chara7.pos, thing7);
933 break;
934 }
935 }
936 }
937 }
938 if (EClass.rnd(20) == 0 && AI_Shopping.TryShop(owner, realtime: true))
939 {
940 yield return Restart();
941 }
942 if (EClass.rnd(20) == 0 && owner.IsPCFaction && AI_Shopping.TryRestock(owner, realtime: true))
943 {
944 yield return Restart();
945 }
947 if (owner.idleActTimer <= 0 && !owner.source.actIdle.IsEmpty())
948 {
949 owner.idleActTimer = 10 + EClass.rnd(50);
950 switch (idAct)
951 {
952 case "torture_snail":
953 DoSomethingToNearChara((Chara c) => c.race.id == "snail", delegate(Chara c)
954 {
955 owner.Say("use_whip3", owner, c);
956 owner.PlaySound("whip");
957 owner.Talk("insult");
958 c.PlayAnime(AnimeID.Shiver);
959 c.OnInsulted();
960 });
961 break;
962 case "buffMage":
963 if (EClass.rnd(2) == 0)
964 {
965 TryCast<ConHolyVeil>(EffectId.HolyVeil, 300 + EClass.rnd(300));
966 }
967 else
968 {
969 TryCast<ConLevitate>(EffectId.Levitate, 300 + EClass.rnd(300));
970 }
971 break;
972 case "buffThief":
973 TryCast<ConNightVision>(EffectId.CatsEye, 100 + EClass.rnd(100));
974 break;
975 case "buffGuildWatch":
976 TryCast<ConGravity>(EffectId.Gravity, 300 + EClass.rnd(300));
977 break;
978 case "buffHealer":
979 TryCast(EffectId.Heal);
980 break;
981 case "readBook":
982 {
983 if (EClass.rnd(2) == 0 || (owner.IsPCParty && EClass.rnd(20) != 0))
984 {
985 break;
986 }
987 List<Thing> list4 = owner.things.List((Thing a) => a.parent == owner && (a.category.id == "spellbook" || a.category.id == "ancientbook" || a.category.id == "skillbook"), onlyAccessible: true);
988 Thing thing8 = null;
989 if (list4.Count > 0)
990 {
991 thing8 = list4.RandomItem();
992 if (!thing8.trait.CanRead(owner))
993 {
994 thing8 = null;
995 }
996 }
997 if (thing8 == null)
998 {
999 if (owner.things.IsFull())
1000 {
1001 break;
1002 }
1003 thing8 = ThingGen.CreateFromCategory((EClass.rnd(5) != 0) ? "spellbook" : "ancientbook");
1004 thing8.isNPCProperty = true;
1005 }
1006 if (!(thing8.id == "1084") || !owner.IsPCFaction)
1007 {
1008 if (!owner.HasElement(285))
1009 {
1010 owner.elements.ModBase(285, 1);
1011 }
1012 yield return Do(new AI_Read
1013 {
1014 target = thing8
1015 });
1016 }
1017 break;
1018 }
1019 default:
1020 if (LangGame.Has("idle_" + idAct))
1021 {
1022 IdleActText(idAct);
1023 }
1024 break;
1025 }
1026 yield return Restart();
1027 }
1028 if (owner.host != null)
1029 {
1030 yield return Restart();
1031 }
1033 {
1035 {
1036 yield return DoGoto(owner.orgPos);
1037 }
1038 yield return Restart();
1039 }
1041 {
1042 yield return DoGoto(EClass.pc);
1043 }
1044 if (EClass.rnd(100) == 0 && !owner.IsPCFaction)
1045 {
1046 if (owner.id == "ashland" || owner.id == "fiama")
1047 {
1048 Card card = EClass._map.Installed.traits.restSpots.RandomItem();
1049 if (card != null)
1050 {
1051 yield return DoGotoSpot(card);
1052 }
1053 else
1054 {
1055 Room room4 = owner.FindRoom();
1056 if (room4 != null)
1057 {
1058 yield return DoGoto(room4.GetRandomPoint().GetNearestPoint());
1059 }
1060 }
1061 }
1063 {
1064 yield return DoGoto(owner.orgPos, 0, ignoreConnection: false, delegate
1065 {
1066 if (!EClass._zone.IsPCFaction)
1067 {
1068 owner.Teleport(owner.orgPos, silent: false, force: true);
1069 }
1070 return Status.Success;
1071 });
1072 }
1073 }
1074 if (EClass.rnd(100) == 0 && owner.id == "bee")
1075 {
1076 Thing thing9 = EClass._map.ListThing<TraitBeekeep>()?.RandomItem();
1077 if (thing9 != null)
1078 {
1079 yield return DoGoto(thing9.pos);
1080 }
1081 }
1082 if (EClass.rnd(10) == 0 && !EClass._zone.IsUnderwater && (owner.race.tag.Contains("water") || owner.source.tag.Contains("water")) && !owner.pos.IsDeepWater)
1083 {
1084 for (int m = 0; m < 100; m++)
1085 {
1086 Point randomPoint3 = EClass._map.GetRandomPoint();
1087 if (randomPoint3.IsDeepWater && !randomPoint3.IsBlocked)
1088 {
1089 yield return DoGoto(randomPoint3);
1090 break;
1091 }
1092 }
1093 }
1094 string aiIdle = owner.source.aiIdle;
1095 if (!(aiIdle == "stand") && !(aiIdle == "root"))
1096 {
1097 if (EClass.rnd(15) == 0 && (owner.mimicry == null || owner.mimicry.IsChara))
1098 {
1099 owner.MoveRandom();
1100 }
1101 if (owner == null)
1102 {
1103 yield return Cancel();
1104 }
1105 }
1106 if (EClass._zone.IsPCFaction && owner.IsPCFaction && !owner.IsPCParty && (owner.GetWork("Clean") != null || owner.GetWork("Chore") != null) && !(EClass.pc.ai is AI_UseCrafter))
1107 {
1108 AI_Haul aI_Haul = AI_Haul.TryGetAI(owner);
1109 if (aI_Haul != null)
1110 {
1111 yield return Do(aI_Haul);
1112 }
1113 }
1114 yield return Restart();
1115 Point FindMovePoint(BaseArea.AccessType type)
1116 {
1117 for (int n = 0; n < 20; n++)
1118 {
1119 Point randomPoint4 = owner.pos.GetRandomPoint(5 + n, requireLos: false);
1120 if (randomPoint4 != null && randomPoint4.IsInBounds && (randomPoint4.cell.room == null || randomPoint4.cell.room.data.accessType == type))
1121 {
1122 return randomPoint4;
1123 }
1124 }
1125 return null;
1126 }
1127 void SetId(string _id, int _num)
1128 {
1129 id = _id;
1130 num = _num;
1131 }
1132 }
1133
1134 public void IdleActText(string id)
1135 {
1136 string text = "idle_" + id;
1137 owner.PlaySound(text);
1138 if (Lang.Game.map.ContainsKey(text))
1139 {
1140 owner.Say(text, owner);
1141 }
1142 }
1143
1144 public void TryCast<T>(EffectId id, int power = 100) where T : Condition
1145 {
1146 if (!owner.HasCondition<T>())
1147 {
1148 TryCast(id, power);
1149 }
1150 }
1151
1152 public void TryCast(EffectId id, int power = 100)
1153 {
1154 owner.Say("idle_cast", owner);
1155 ActEffect.Proc(id, power, BlessedState.Normal, owner);
1156 }
1157
1159 {
1160 _listRoom.Clear();
1161 foreach (BaseArea item in ((IEnumerable<BaseArea>)EClass._map.rooms.listRoom).Concat((IEnumerable<BaseArea>)EClass._map.rooms.listArea))
1162 {
1163 if (item.type != null && item.type.uidCharas.Contains(owner.uid))
1164 {
1165 _listRoom.Add(item);
1166 }
1167 }
1168 return _listRoom.RandomItem();
1169 }
1170
1171 public Chara DoSomethingToNearChara(Func<Chara, bool> funcPickChara, Action<Chara> action = null)
1172 {
1173 List<Chara> list = owner.pos.ListCharasInNeighbor(delegate(Chara c)
1174 {
1175 if (c == owner || !owner.CanSee(c))
1176 {
1177 return false;
1178 }
1179 return funcPickChara == null || funcPickChara(c);
1180 });
1181 if (list.Count > 0)
1182 {
1183 Chara chara = list.RandomItem();
1184 action?.Invoke(chara);
1185 return chara;
1186 }
1187 return null;
1188 }
1189
1190 public Chara DoSomethingToCharaInRadius(int radius, Func<Chara, bool> funcPickChara, Action<Chara> action = null)
1191 {
1192 List<Chara> list = owner.pos.ListCharasInRadius(owner, radius, delegate(Chara c)
1193 {
1194 if (c == owner || !owner.CanSee(c))
1195 {
1196 return false;
1197 }
1198 return funcPickChara == null || funcPickChara(c);
1199 });
1200 if (list.Count > 0)
1201 {
1202 Chara chara = list.RandomItem();
1203 action?.Invoke(chara);
1204 return chara;
1205 }
1206 return null;
1207 }
1208
1209 public bool TryPerformIdleUse()
1210 {
1211 for (int i = 0; i < 10; i++)
1212 {
1213 Point randomPoint = owner.pos.GetRandomPoint(7, requireLos: true, allowChara: true, allowBlocked: true);
1214 if (randomPoint == null || randomPoint.detail == null)
1215 {
1216 continue;
1217 }
1218 foreach (Thing thing in randomPoint.detail.things)
1219 {
1220 if (thing.IsInstalled)
1221 {
1222 int num = owner.Dist(thing);
1223 if (EClass.rnd((owner.memberType == FactionMemberType.Guest) ? 5 : 50) == 0 && thing.HasTag(CTAG.tourism) && num <= 2)
1224 {
1225 owner.LookAt(thing);
1226 owner.Talk("nice_statue");
1227 return true;
1228 }
1229 if (EClass.rnd(thing.trait.IdleUseChance) == 0 && thing.trait.IdleUse(owner, num))
1230 {
1231 owner.LookAt(thing);
1232 return true;
1233 }
1234 }
1235 }
1236 }
1237 return false;
1238 }
1239}
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:430
virtual Status Cancel()
Definition: AIAct.cs:305
new Chara owner
Definition: AIAct.cs:14
Status
Definition: AIAct.cs:8
Status DoGotoSpot(Card card, Func< Status > _onChildFail=null)
Definition: AIAct.cs:475
Status DoGoto(Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
Definition: AIAct.cs:446
Status KeepRunning()
Definition: AIAct.cs:335
Status Restart()
Definition: AIAct.cs:251
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:295
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:1171
BaseArea GetRandomAssignedRoom()
Definition: AI_Idle.cs:1158
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:1190
int maxRepeat
Definition: AI_Idle.cs:14
override int MaxRestart
Definition: AI_Idle.cs:24
void IdleActText(string id)
Definition: AI_Idle.cs:1134
bool TryPerformIdleUse()
Definition: AI_Idle.cs:1209
override void OnStart()
Definition: AI_Idle.cs:28
void TryCast(EffectId id, int power=100)
Definition: AI_Idle.cs:1152
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
bool IsWeddingHater
Definition: Affinity.cs:36
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:1001
bool IsPCFactionOrMinion
Definition: Card.cs:2312
void Teleport(Point point, bool silent=false, bool force=false)
Definition: Card.cs:5997
ElementContainerCard elements
Definition: Card.cs:42
string id
Definition: Card.cs:36
bool IsRestrainedResident
Definition: Card.cs:2298
bool isRestrained
Definition: Card.cs:567
CardRenderer HostRenderer
Definition: Card.cs:2482
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6414
int GetHearingRadius()
Definition: Card.cs:6663
int c_uidMaster
Definition: Card.cs:1475
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3180
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6974
int hp
Definition: Card.cs:243
ICardParent parent
Definition: Card.cs:56
bool ExistsOnMap
Definition: Card.cs:2123
Thing SetNum(int a)
Definition: Card.cs:3577
int GetCurrency(string id="money")
Definition: Card.cs:4057
Thing c_bloodData
Definition: Card.cs:1955
bool HasTag(CTAG tag)
Definition: Card.cs:2635
Point pos
Definition: Card.cs:60
bool IsInMutterDistance(int d=10)
Definition: Card.cs:8009
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6382
Trait trait
Definition: Card.cs:54
void ModCurrency(int a, string id="money")
Definition: Card.cs:4043
int encLV
Definition: Card.cs:327
bool IsEquipment
Definition: Card.cs:2213
void DamageHP(long dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:4149
void ModEncLv(int a)
Definition: Card.cs:3928
bool c_isImportant
Definition: Card.cs:1037
MoveResult
Definition: Card.cs:13
bool noMove
Definition: Card.cs:771
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2640
ThingContainer things
Definition: Card.cs:39
bool IsInstalled
Definition: Card.cs:2421
virtual Thing Thing
Definition: Card.cs:2096
int Evalue(int ele)
Definition: Card.cs:2611
int Dist(Card c)
Definition: Card.cs:7965
bool isGifted
Definition: Card.cs:783
Cell Cell
Definition: Card.cs:2093
void SetRandomDir()
Definition: Card.cs:6476
int Num
Definition: Card.cs:159
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:6433
SourceCategory.Row category
Definition: Card.cs:2087
void ModNum(int a, bool notify=true)
Definition: Card.cs:3597
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6161
int LV
Definition: Card.cs:387
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7091
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:8382
bool HasHobbyOrWork(string alias)
Definition: Chara.cs:9058
override bool IsAliveInCurrentZone
Definition: Chara.cs:563
Thing FindBestFoodToEat()
Definition: Chara.cs:7741
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:8069
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:6368
int sharedCheckTurn
Definition: Chara.cs:120
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:7762
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9467
Faction faction
Definition: Chara.cs:429
override bool IsPC
Definition: Chara.cs:626
bool isDrunk
Definition: Chara.cs:126
Chara host
Definition: Chara.cs:33
Chara GetNearbyCatToSniff()
Definition: Chara.cs:8293
bool CanSeeLos(Card c, int dist=-1)
Definition: Chara.cs:1276
bool IsMofuable
Definition: Chara.cs:1125
override bool IsPCParty
Definition: Chara.cs:629
Party party
Definition: Chara.cs:43
bool IsInCombat
Definition: Chara.cs:878
TraitBed TryAssignBed()
Definition: Chara.cs:7521
void PickHeld(bool msg=false)
Definition: Chara.cs:4606
bool HasCondition(string alias)
Definition: Chara.cs:9628
void Banish(Chara owner)
Definition: Chara.cs:2393
AIAct SetAI(AIAct g)
Definition: Chara.cs:9097
bool IsIdle
Definition: Chara.cs:867
TraitBed FindBed()
Definition: Chara.cs:7509
Stats hunger
Definition: Chara.cs:1168
override bool IsMinion
Definition: Chara.cs:641
override bool isSynced
Definition: Chara.cs:705
Point orgPos
Definition: Chara.cs:21
bool IsHuman
Definition: Chara.cs:893
bool MoveRandom()
Definition: Chara.cs:2655
void TryPutSharedItems(IEnumerable< Thing > containers, bool msg=true)
Definition: Chara.cs:7539
override bool IsPCFaction
Definition: Chara.cs:685
bool CanSee(Card c)
Definition: Chara.cs:1244
bool HasAccess(Card c)
Definition: Chara.cs:1306
bool CanEat(Thing t, bool shouldEat=false)
Definition: Chara.cs:7787
Chara Duplicate()
Definition: Chara.cs:1817
override int MaxHP
Definition: Chara.cs:722
bool CanDuplicate()
Definition: Chara.cs:1792
void ClearInventory(ClearInventoryType type)
Definition: Chara.cs:8740
SourceChara.Row source
Definition: Chara.cs:160
Stats mana
Definition: Chara.cs:1180
FactionMemberType memberType
Definition: Chara.cs:46
string TalkTopic(string topic="calm")
Definition: Chara.cs:7138
Stats stamina
Definition: Chara.cs:1172
bool MoveNeighborDefinitely()
Definition: Chara.cs:2669
bool UseAbility(int idAct, Card tc=null, Point pos=null, bool pt=false)
Definition: Chara.cs:5909
void SetTempHand(int right=0, int left=0)
Definition: Chara.cs:6862
Chara parasite
Definition: Chara.cs:30
Chara master
Definition: Chara.cs:88
Chara ride
Definition: Chara.cs:27
void AddCooldown(int idEle, int turns=0)
Definition: Chara.cs:8878
bool IsGuest()
Definition: Chara.cs:6772
Hobby GetWork(string id)
Definition: Chara.cs:9208
Thing nextUse
Definition: Chara.cs:100
Affinity affinity
Definition: Chara.cs:316
MoveResult TryMoveTowards(Point p)
Definition: Chara.cs:2695
Religion faith
Definition: Chara.cs:441
bool IsMarried
Definition: Chara.cs:611
Chara enemy
Definition: Chara.cs:86
CharaAbility ability
Definition: Chara.cs:426
Chara FindMaster()
Definition: Chara.cs:2464
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6451
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:6500
Room FindRoom()
Definition: Chara.cs:8125
Point GetDestination()
Definition: Chara.cs:7421
int turnLastSeen
Definition: Chara.cs:112
FactionBranch homeBranch
Definition: Chara.cs:1080
void Drink(Card t)
Definition: Chara.cs:5211
Hostility hostility
Definition: Chara.cs:293
bool IsHostile()
Definition: Chara.cs:6681
void TryTakeSharedItems(bool msg=true)
Definition: Chara.cs:7577
ConBaseTransmuteMimic mimicry
Definition: Chara.cs:106
PCCData pccData
Definition: Chara.cs:67
Chara SetHostility(Hostility h)
Definition: Chara.cs:1468
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4386
void Sniff(Chara c)
Definition: Chara.cs:8305
override bool IsPCC
Definition: Chara.cs:696
int idleActTimer
Definition: Chara.cs:114
bool IsCat
Definition: Chara.cs:1001
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:328
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:7
static LangGame Game
Definition: Lang.cs:49
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:165
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:198
int EvalueTotal(int ele, Func< Chara, bool > funcIf=null)
Definition: Party.cs:185
Chara leader
Definition: Party.cs:31
List< Chara > members
Definition: Party.cs:19
int turns
Definition: Player.cs:84
int karma
Definition: Player.cs:933
Stats stats
Definition: Player.cs:1071
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:137
virtual bool CanFish
Definition: TraitChara.cs:139
virtual bool IdleAct()
Definition: TraitChara.cs:141
TraitMap restSpots
Definition: TraitManager.cs:10
virtual bool AllowTraining
Definition: TraitShackle.cs:15
virtual bool CanRead(Chara c)
Definition: Trait.cs:995
virtual bool CanEat(Chara c)
Definition: Trait.cs:1004
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:1013
GameDate date
Definition: World.cs:6
Definition: Zone.cs:12
static int okaerinko
Definition: Zone.cs:31
virtual bool IsNefia
Definition: Zone.cs:287
FactionBranch branch
Definition: Zone.cs:34
virtual bool IsUserZone
Definition: Zone.cs:273
Chara Boss
Definition: Zone.cs:86
virtual bool IsTown
Definition: Zone.cs:225
Chara SpawnMob(string id, Point pos=null)
Definition: Zone.cs:2805
virtual bool PetFollow
Definition: Zone.cs:289
bool IsPCFaction
Definition: Zone.cs:475
virtual bool IsUnderwater
Definition: Zone.cs:271
Card AddCard(Card t, Point point)
Definition: Zone.cs:2017