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