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