Elin Decompiled Documentation EA 23.356.1 Nightly
Loading...
Searching...
No Matches
AI_Idle Class Reference
Inheritance diagram for AI_Idle:
AIAct Act Element EClass

Public Types

enum  Behaviour { Default , NoMove }
 
- Public Types inherited from AIAct
enum  Status { Running , Fail , Success }
 
- Public Types inherited from Act
enum  CostType { None , MP , SP }
 

Public Member Functions

override void OnStart ()
 
override IEnumerable< Status > Run ()
 
void IdleActText (string id)
 
void TryCast< T > (EffectId id, int power=100)
 
void TryCast (EffectId id, int power=100)
 
BaseArea GetRandomAssignedRoom ()
 
Chara DoSomethingToNearChara (Func< Chara, bool > funcPickChara, Action< Chara > action=null)
 
Chara DoSomethingToCharaInRadius (int radius, Func< Chara, bool > funcPickChara, Action< Chara > action=null)
 
bool TryPerformIdleUse ()
 
- Public Member Functions inherited from AIAct
override string ToString ()
 
override MultiSprite GetStateIcon ()
 
virtual bool ShouldAllyAttack (Chara tg)
 
virtual Point GetDestination ()
 
AIProgress GetProgress ()
 
string GetCurrentActionText ()
 
override bool IsToolValid ()
 
T GetChild< T > ()
 
virtual void OnStart ()
 
void SetOwner (Chara c)
 
virtual void OnSetOwner ()
 
void SetChild (AIAct seq, Func< Status > _onChildFail=null)
 
void Start ()
 
override bool Perform ()
 
Status Restart ()
 
Status Success (Action action=null)
 
virtual void OnSuccess ()
 
bool TryCancel (Card c)
 
virtual Status Cancel ()
 
virtual void OnCancel ()
 
virtual void OnCancelOrSuccess ()
 
virtual bool CanManualCancel ()
 
Status KeepRunning ()
 
void Reset ()
 
virtual void OnReset ()
 
Status Tick ()
 
virtual IEnumerable< Status > Run ()
 
Status TickChild ()
 
Status Do (AIAct _seq, Func< Status > _onChildFail=null)
 
Status DoGotoInteraction (Point pos, Func< Status > _onChildFail=null)
 
Status DoGoto (Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
 
Status DoGoto (Card card, Func< Status > _onChildFail=null)
 
Status DoGoto (Card card, int dist, bool ignoreConnection=false, Func< Status > _onChildFail=null)
 
Status DoGotoSpot (Card card, Func< Status > _onChildFail=null)
 
Status DoGoto< T > (Func< Status > _onChildFail=null)
 
Status DoGotoSpot< T > (Func< Status > _onChildFail=null, bool ignoreAccessType=false)
 
Status DoGrab (Card card, int num=-1, bool pickHeld=false, Func< Status > _onChildFail=null)
 
Status DoGrab< T > ()
 
Status DoProgress ()
 
Status DoIdle (int repeat=3)
 
Status DoWait (int count=1)
 
virtual AIProgress CreateProgress ()
 
virtual void OnCreateProgress (Progress_Custom p)
 
virtual bool CanProgress ()
 
virtual void OnBeforeProgress ()
 
virtual void OnProgress ()
 
virtual void OnProgressComplete ()
 
void SimulateZone (int days)
 
virtual void OnSimulateZone (int days)
 
virtual void OnSimulatePosition ()
 
- Public Member Functions inherited from Act
virtual CursorInfo GetCursorIcon (Card c)
 
virtual MultiSprite GetStateIcon ()
 
override Sprite GetSprite ()
 
virtual bool ShowMouseHint (Card c)
 
virtual bool IsValidTC (Card c)
 
virtual string GetHintText (string str="")
 
virtual string GetText (string str="")
 
virtual string GetTextSmall (Card c)
 
bool IsTargetHostileParty ()
 
virtual Color GetActPlanColor ()
 
virtual bool Perform ()
 
bool Perform (Chara _cc, Card _tc=null, Point _tp=null)
 
virtual bool ValidatePerform (Chara _cc, Card _tc, Point _tp)
 
virtual bool CanPerform ()
 
bool CanPerform (Chara _cc, Card _tc=null, Point _tp=null)
 
virtual bool IsToolValid ()
 
new void SetImage (Image image)
 
virtual void OnMarkMapHighlights ()
 
virtual bool ShouldMapHighlight (Point p)
 
- Public Member Functions inherited from Element
virtual SourceElement.Row GetSource ()
 
virtual int GetSourcePotential (int v)
 
virtual Sprite GetSprite ()
 
int GetMaterialSourceValue (Thing t, int v)
 
virtual long GetSourceValue (long v, int lv, SourceValueType type)
 
virtual Sprite GetIcon (string suffix="")
 
bool IsActive (Card c)
 
int SortVal (bool charaSheet=false)
 
virtual bool CanLink (ElementContainer owner)
 
bool HasTag (string tag)
 
void SetImage (Image i)
 
virtual string GetDetail ()
 
bool IsFactionElement (Chara c)
 
int GetDNABonus (Chara c)
 
Element GetParent (Card c)
 
void WriteNote (UINote n, ElementContainer owner=null, Action< UINote > onWriteNote=null)
 
void WriteNoteWithRef (UINote n, ElementContainer owner, Action< UINote > onWriteNote, Element refEle)
 
void _WriteNote (UINote n, Chara c, Act act)
 
void AddHeaderAbility (UINote n)
 
void _WriteNote (UINote n, ElementContainer owner, Action< UINote > onWriteNote, bool isRef, bool addHeader=true)
 
void AddEncNote (UINote n, Card Card, ElementContainer.NoteMode mode=ElementContainer.NoteMode.Default, Func< Element, string, string > funcText=null, Action< UINote, Element > onAddNote=null)
 
virtual void OnWriteNote (UINote n, ElementContainer owner)
 
virtual void OnChangeValue ()
 
void CheckLevelBonus (ElementContainer owner, UINote n=null)
 
int GetSortVal (UIList.SortMode m)
 
virtual Act.Cost GetCost (Chara c)
 
virtual int GetPower (Card c)
 
virtual void SetTextValue (UIText text, bool shorten=false)
 
virtual bool IsPurchaseFeatReqMet (ElementContainer owner, int lv=-1)
 
virtual void WritePurchaseReq (UINote n, int lv=1)
 

Public Attributes

int maxRepeat = 10
 
int moveFailCount
 
- Public Attributes inherited from AIAct
new Chara owner
 
Status status
 
IEnumerator< Status > Enumerator
 
AIAct child
 
AIAct parent
 
byte restartCount
 
Func< Status > onChildFail
 
Func< bool > isFail
 
- Public Attributes inherited from Element
SourceElement.Row _source
 
int id
 
int vBase
 
int vExp
 
int vPotential
 
int vTempPotential
 
int vLink
 
int vSource
 
int vSourcePotential
 
ElementContainer owner
 

Properties

override bool IsIdle [get]
 
override bool InformCancel [get]
 
override int MaxRestart [get]
 
override bool ShouldEndMimicry [get]
 
- Properties inherited from AIAct
virtual bool IsRunning [get]
 
bool IsChildRunning [get]
 
bool IsMoveAI [get]
 
virtual int MaxRestart [get]
 
virtual new string Name [get]
 
virtual MultiSprite stateIcon [get]
 
virtual Sprite actionIcon [get]
 
virtual bool IsNoGoal [get]
 
virtual bool IsAutoTurn [get]
 
virtual bool IsIdle [get]
 
virtual bool CancelOnAggro [get]
 
virtual bool PushChara [get]
 
virtual int MaxProgress [get]
 
virtual bool ShowProgress [get]
 
virtual bool UseTurbo [get]
 
virtual int CurrentProgress [get]
 
virtual bool ShowCursor [get]
 
virtual bool CancelWhenDamaged [get]
 
virtual bool CancelWhenMoved [get]
 
virtual bool InformCancel [get]
 
virtual Thing RenderThing [get]
 
AIAct Current [get]
 
override bool IsAct [get]
 
override bool ShowPotential [get]
 
override bool UsePotential [get]
 
override bool ShowRelativeAttribute [get]
 
virtual bool HasProgress [get]
 
- Properties inherited from Act
override bool ShowPotential [get]
 
override bool UsePotential [get]
 
override bool ShowRelativeAttribute [get]
 
virtual CursorInfo CursorIcon [get]
 
virtual string ID [get]
 
virtual bool IsAct [get]
 
virtual bool WillEndTurn [get]
 
virtual bool CloseLayers [get]
 
virtual int LeftHand [get]
 
virtual int RightHand [get]
 
virtual int ElementPowerMod [get]
 
virtual bool ShowMapHighlight [get]
 
virtual bool ShowMapHighlightBlock [get]
 
virtual bool PickHeldOnStart [get]
 
virtual bool DropHeldOnStart [get]
 
virtual bool CanPressRepeat [get]
 
virtual bool CanAutofire [get]
 
virtual bool ResetAxis [get]
 
virtual bool RequireTool [get]
 
virtual bool IsHostileAct [get]
 
virtual bool HideRightInfo [get]
 
virtual bool ShouldEndMimicry [get]
 
virtual bool HaveLongPressAction [get]
 
virtual float Radius [get]
 
virtual int PerformDistance [get]
 
virtual int MaxRadius [get]
 
virtual TargetType TargetType [get]
 
virtual bool LocalAct [get]
 
virtual bool CanRapidFire [get]
 
virtual float RapidDelay [get]
 
virtual bool ShowAuto [get]
 
- Properties inherited from Element
SourceElement.Row source [get]
 
virtual int DisplayValue [get]
 
virtual int MinValue [get]
 
int Value [get]
 
int ValueWithoutLink [get]
 
virtual int MinPotential [get]
 
int Potential [get]
 
virtual bool CanGainExp [get]
 
bool IsFlag [get]
 
virtual string Name [get]
 
virtual string FullName [get]
 
virtual int ExpToNext [get]
 
virtual bool UseExpMod [get]
 
virtual int CostTrain [get]
 
virtual int CostLearn [get]
 
virtual bool ShowXP [get]
 
virtual bool ShowMsgOnValueChanged [get]
 
virtual bool ShowValue [get]
 
virtual bool ShowPotential [get]
 
virtual bool UsePotential [get]
 
virtual bool PotentialAsStock [get]
 
virtual bool ShowRelativeAttribute [get]
 
virtual bool ShowBonuses [get]
 
virtual string ShortName [get]
 
bool IsGlobalElement [get]
 
bool IsFactionWideElement [get]
 
bool IsPartyWideElement [get]
 
virtual bool ShowEncNumber [get]
 
bool IsTrait [get]
 
bool IsFoodTrait [get]
 
bool IsFoodTraitMain [get]
 
bool IsMainAttribute [get]
 
Act act [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Static Private Attributes

static List< BaseArea > _listRoom = new List<BaseArea>()
 

Additional Inherited Members

- Static Public Member Functions inherited from Act
static void SetReference (Chara _cc, Card _tc=null, Point _tp=null)
 
static void SetTool (Thing t)
 
- Static Public Member Functions inherited from Element
static string GetName (string alias)
 
static SourceElement.Row Get (int id)
 
static Dictionary< int, int > GetElementMap (int[] list)
 
static Dictionary< int, int > GetElementMap (int[] list, Dictionary< int, int > map)
 
static SourceElement.Row GetRandomElement (int lv=1, bool useWeight=true)
 
static Element Create (int id, int v=0)
 
static Element Create (string id, int v=1)
 
static int GetId (string alias)
 
static int GetResistLv (int v)
 
static long GetResistDamage (long dmg, int v, int power=0)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from Act
static Chara CC
 
static Card TC
 
static Point TP = new Point()
 
static Thing TOOL
 
static int powerMod = 100
 
static bool forcePt
 
static Act CurrentAct
 
- Static Public Attributes inherited from Element
const int Div = 5
 
static Element Void = new Element()
 
static int[] List_MainAttributes = new int[9] { 70, 72, 71, 77, 74, 75, 76, 73, 79 }
 
static int[] List_MainAttributesMajor = new int[8] { 70, 72, 71, 77, 74, 75, 76, 73 }
 
static int[] List_Body = new int[4] { 70, 72, 71, 77 }
 
static int[] List_Mind = new int[4] { 74, 75, 76, 73 }
 
static List< SourceElement.Row > ListElements = new List<SourceElement.Row>()
 
static List< SourceElement.Row > ListAttackElements = new List<SourceElement.Row>()
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 6 of file AI_Idle.cs.

Member Enumeration Documentation

◆ Behaviour

Enumerator
Default 
NoMove 

Definition at line 8 of file AI_Idle.cs.

Member Function Documentation

◆ DoSomethingToCharaInRadius()

Chara AI_Idle.DoSomethingToCharaInRadius ( int  radius,
Func< Chara, bool >  funcPickChara,
Action< Chara >  action = null 
)
inline

Definition at line 1243 of file AI_Idle.cs.

1244 {
1245 List<Chara> list = owner.pos.ListCharasInRadius(owner, radius, delegate(Chara c)
1246 {
1247 if (c == owner || !owner.CanSee(c))
1248 {
1249 return false;
1250 }
1251 return funcPickChara == null || funcPickChara(c);
1252 });
1253 if (list.Count > 0)
1254 {
1255 Chara chara = list.RandomItem();
1256 action?.Invoke(chara);
1257 return chara;
1258 }
1259 return null;
1260 }
new Chara owner
Definition: AIAct.cs:14
Point pos
Definition: Card.cs:60
Definition: Chara.cs:10
bool CanSee(Card c)
Definition: Chara.cs:1279
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
Definition: Point.cs:1222

References Chara.CanSee(), Point.ListCharasInRadius(), and Card.pos.

Referenced by Run().

◆ DoSomethingToNearChara()

Chara AI_Idle.DoSomethingToNearChara ( Func< Chara, bool >  funcPickChara,
Action< Chara >  action = null 
)
inline

Definition at line 1224 of file AI_Idle.cs.

1225 {
1226 List<Chara> list = owner.pos.ListCharasInNeighbor(delegate(Chara c)
1227 {
1228 if (c == owner || !owner.CanSee(c))
1229 {
1230 return false;
1231 }
1232 return funcPickChara == null || funcPickChara(c);
1233 });
1234 if (list.Count > 0)
1235 {
1236 Chara chara = list.RandomItem();
1237 action?.Invoke(chara);
1238 return chara;
1239 }
1240 return null;
1241 }
List< Chara > ListCharasInNeighbor(Func< Chara, bool > func)
Definition: Point.cs:1202

References Chara.CanSee(), Point.ListCharasInNeighbor(), and Card.pos.

Referenced by Run().

◆ GetRandomAssignedRoom()

BaseArea AI_Idle.GetRandomAssignedRoom ( )
inline

Definition at line 1211 of file AI_Idle.cs.

1212 {
1213 _listRoom.Clear();
1214 foreach (BaseArea item in ((IEnumerable<BaseArea>)EClass._map.rooms.listRoom).Concat((IEnumerable<BaseArea>)EClass._map.rooms.listArea))
1215 {
1216 if (item.type != null && item.type.uidCharas.Contains(owner.uid))
1217 {
1218 _listRoom.Add(item);
1219 }
1220 }
1221 return _listRoom.RandomItem();
1222 }
static List< BaseArea > _listRoom
Definition: AI_Idle.cs:18
int uid
Definition: Card.cs:125
Definition: EClass.cs:6
static Map _map
Definition: EClass.cs:19
RoomManager rooms
Definition: Map.cs:34
List< Room > listRoom
Definition: RoomManager.cs:13
List< Area > listArea
Definition: RoomManager.cs:10

References EClass._map, item, RoomManager.listArea, RoomManager.listRoom, and Map.rooms.

◆ IdleActText()

void AI_Idle.IdleActText ( string  id)
inline

Definition at line 1187 of file AI_Idle.cs.

1188 {
1189 string text = "idle_" + id;
1190 owner.PlaySound(text);
1191 if (Lang.Game.map.ContainsKey(text))
1192 {
1193 owner.Say(text, owner);
1194 }
1195 }
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6645
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7324
int id
Definition: ELEMENT.cs:259
Definition: Lang.cs:7
static LangGame Game
Definition: Lang.cs:49

References Lang.Game.

Referenced by Run().

◆ OnStart()

override void AI_Idle.OnStart ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 28 of file AI_Idle.cs.

29 {
30 owner.SetTempHand(-1, -1);
31 owner.ShowEmo();
32 }
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6613
void SetTempHand(int right=0, int left=0)
Definition: Chara.cs:7153

References AIAct.owner, Chara.SetTempHand(), and Card.ShowEmo().

◆ Run()

override IEnumerable< Status > AI_Idle.Run ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 34 of file AI_Idle.cs.

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 if (owner.hp < owner.MaxHP * 60 / 100)
199 {
200 Action action = owner.things.Find((Thing thing10) => thing10.trait.GetHealAction(owner) != null)?.trait.GetHealAction(owner) ?? null;
201 if (action != null)
202 {
203 action();
204 yield return KeepRunning();
205 }
206 }
207 }
208 }
210 {
212 if (owner.sharedCheckTurn < 0 && EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
213 {
216 owner.sharedCheckTurn += (EClass.debug.enable ? 20 : 200);
217 }
218 }
219 if ((EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (owner.IsPCParty ? 10 : (owner.IsPCFaction ? 2 : 0)) > EClass.rnd(100))
220 {
221 Thing thing2 = owner.things.Find("polish_powder");
222 if (thing2 != null && EClass._map.props.installed.Find<TraitGrindstone>() != null)
223 {
224 foreach (Thing thing10 in owner.things)
225 {
226 if (!thing10.IsEquipment || thing10.encLV >= 0)
227 {
228 continue;
229 }
230 for (int num2 = 0; num2 < 5; num2++)
231 {
232 if (thing10.encLV >= 0)
233 {
234 break;
235 }
236 owner.Say("polish", owner, thing10);
237 thing10.ModEncLv(1);
238 thing2.ModNum(-1);
239 if (thing2.isDestroyed)
240 {
241 break;
242 }
243 }
244 if (thing2.isDestroyed)
245 {
246 break;
247 }
248 }
249 }
250 }
251 if (owner.IsPCParty)
252 {
254 {
255 TraitShackle traitShackle = owner.pos.FindThing<TraitShackle>();
256 if (traitShackle != null && traitShackle.AllowTraining)
257 {
259 {
260 shackle = traitShackle
261 });
262 }
263 yield return Restart();
264 }
265 if (EClass.rnd(20) == 0)
266 {
267 Thing thing3 = owner.things.Find((Thing a) => a.parent == owner && a.isGifted && (a.category.id == "skillbook" || a.category.id == "ancientbook"));
268 if (thing3 != null && thing3.trait.CanRead(owner) && (thing3.Num == 1 || !owner.things.IsFull()))
269 {
270 yield return Do(new AI_Read
271 {
272 target = thing3
273 });
274 }
275 }
276 if (!EClass._zone.IsRegion)
277 {
278 if (EClass.rnd(100) == 0 && owner.HasElement(1227))
279 {
280 List<Chara> list2 = new List<Chara>();
281 foreach (Chara member in EClass.pc.party.members)
282 {
283 if (member.Evalue(1227) > 0)
284 {
285 list2.Add(member);
286 }
287 }
288 if (list2.Count > 2 + EClass.pc.party.EvalueTotal(1272, (Chara chara6) => chara6.IsPC || chara6.faith == EClass.game.religions.Harmony))
289 {
290 list2.Remove(owner);
291 owner.SetEnemy(list2.RandomItem());
292 yield return Success();
293 }
294 }
295 if (EClass.rnd(20) == 0 && owner.IsMarried)
296 {
297 List<Chara> list3 = new List<Chara>();
298 foreach (Chara member2 in EClass.pc.party.members)
299 {
300 if (member2 != owner && member2.IsMarried)
301 {
302 list3.Add(member2);
303 }
304 }
305 if (list3.Count > EClass.pc.Evalue(1276))
306 {
307 owner.SetEnemy(list3.RandomItem());
308 yield return Success();
309 }
310 }
311 }
312 if (EClass.rnd(150) == 0 && owner.host != null && owner.host.parasite == owner && owner.GetInt(108) == 1)
313 {
314 owner.host.PlaySound("whip");
315 owner.host.Say("use_whip3", owner, owner.host);
316 owner.Talk("insult");
317 owner.host.PlayAnime(AnimeID.Shiver);
318 owner.host.DamageHP(5 + EClass.rndHalf(owner.host.MaxHP / 5), 919, 100, AttackSource.Condition);
320 yield return KeepRunning();
321 }
322 if (EClass.rnd(EClass.debug.enable ? 2 : 20) == 0 && owner.CanSee(EClass.pc) && !(EClass.pc.ai is AI_Eat))
323 {
325 }
326 if (owner.isSynced && EClass.rnd((owner.host == null) ? 200 : 150) == 0 && owner.GetInt(106) == 0)
327 {
328 if (EClass.rnd(2) == 0 && owner.GetInt(108) == 1)
329 {
330 owner.Talk("insult");
331 }
332 else
333 {
335 }
336 }
337 if (EClass.rnd(100) == 0 && EClass._zone.IsTown)
338 {
340 }
341 if ((EClass.rnd(20) == 0 || EClass.debug.enable) && owner.GetCurrency() >= 500)
342 {
343 bool flag = EClass._zone.IsTown;
345 {
346 foreach (Chara member3 in EClass._zone.branch.members)
347 {
348 if (member3.ExistsOnMap && member3.trait is TraitTrainer)
349 {
350 flag = true;
351 }
352 }
353 }
354 if (flag)
355 {
356 bool flag2 = false;
357 foreach (Element value in owner.elements.dict.Values)
358 {
359 if (!(value.source.category != "skill") && value.vTempPotential < 900)
360 {
361 flag2 = true;
362 break;
363 }
364 }
365 if (flag2)
366 {
367 int num3 = owner.GetCurrency();
368 if (num3 >= 20000)
369 {
370 num3 = 20000;
371 }
372 owner.PlaySound("pay");
373 int num4 = num3 / 200;
374 foreach (Element value2 in owner.elements.dict.Values)
375 {
376 if (!(value2.source.category != "skill"))
377 {
378 int num5 = num4 * 100 / (100 + (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) * (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) / 100);
379 num5 += 1 + EClass.rnd(3);
380 owner.elements.ModTempPotential(value2.id, Mathf.Max(1, num5), 9999);
381 }
382 }
383 Msg.Say("party_train", owner, Lang._currency(num3));
384 owner.PlaySound("ding_potential");
385 owner.ModCurrency(-num3);
386 }
387 }
388 }
389 if (EClass.rnd(100) == 0 && EClass.pc.ai is AI_Fish && owner.stamina.value > 0 && owner.things.Find<TraitToolFishing>() != null)
390 {
391 Point randomPointInRadius = EClass.pc.pos.GetRandomPointInRadius(0, 3);
392 if (randomPointInRadius != null)
393 {
394 randomPointInRadius = AI_Fish.GetFishingPoint(randomPointInRadius);
395 if (randomPointInRadius.IsValid)
396 {
397 yield return Do(new AI_Fish
398 {
399 pos = randomPointInRadius
400 });
401 }
402 }
403 }
404 }
405 if (owner.c_uidMaster != 0)
406 {
407 Chara chara2 = owner.master;
408 if (chara2 == null || !chara2.IsAliveInCurrentZone)
409 {
410 chara2 = owner.FindMaster();
411 }
412 if (chara2 != null && chara2.IsAliveInCurrentZone)
413 {
414 if (owner.enemy == null)
415 {
416 owner.SetEnemy(chara2.enemy);
417 }
418 int num6 = owner.Dist(chara2.pos);
419 if (owner.source.aiIdle != "root" && num6 > EClass.game.config.tactics.AllyDistance(owner) && EClass._zone.PetFollow && owner.c_minionType == MinionType.Default)
420 {
421 if (owner.HasAccess(chara2.pos))
422 {
423 owner.TryMoveTowards(chara2.pos);
424 }
425 yield return KeepRunning();
426 continue;
427 }
428 }
429 }
430 if (!EClass._zone.IsRegion)
431 {
432 if (EClass.rnd(5) == 0 && owner.HasElement(1425) && owner.mimicry == null)
433 {
434 owner.UseAbility(8794, owner);
435 }
436 if (EClass.rnd((!(owner.id == "unseenhand")) ? 10 : (owner.isSummon ? 9999 : 2)) == 0 && owner.HasElement(1427) && owner.mimicry == null)
437 {
438 owner.UseAbility(8796, owner);
439 }
441 {
442 DoSomethingToNearChara((Chara chara6) => !chara6.IsPCFactionOrMinion && !chara6.IsHostile(owner), delegate(Chara chara6)
443 {
444 owner.DoHostileAction(chara6, immediate: true);
445 chara6.pos.TryWitnessCrime(owner, chara6);
446 if (owner.mimicry != null)
447 {
448 owner.mimicry.Reveal(chara6, surprise: true);
449 }
450 });
451 }
452 }
453 if (owner.mimicry != null && owner.HasElement(1429))
454 {
456 }
457 Party party = owner.party;
458 if (party == null || party.leader == owner || !party.leader.IsAliveInCurrentZone || owner.host != null || !EClass._zone.PetFollow)
459 {
460 break;
461 }
462 if (owner.source.aiIdle == "root")
463 {
464 yield return KeepRunning();
465 continue;
466 }
468 {
469 yield return KeepRunning();
470 continue;
471 }
472 if (owner.HasAccess(party.leader.pos) && owner.TryMoveTowards(party.leader.pos) == Card.MoveResult.Fail && owner.Dist(party.leader) > 4)
473 {
475 bool flag3 = (EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (EClass.pc.enemy == null || !EClass.pc.enemy.IsAliveInCurrentZone);
476 if (moveFailCount >= (flag3 ? 100 : 10))
477 {
478 owner.Teleport(party.leader.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true), silent: false, force: true);
479 moveFailCount = 0;
480 }
481 }
482 else
483 {
484 moveFailCount = 0;
485 }
486 yield return KeepRunning();
487 }
488 if (EClass._zone.IsNefia && EClass._zone.Boss == owner && EClass.rnd(20) == 0)
489 {
491 }
492 if (EClass._zone.IsRegion && EClass.rnd(10) != 0)
493 {
494 yield return Restart();
495 }
496 if (((owner.homeBranch != null && owner.homeBranch == EClass.Branch && EClass.rnd(100) == 0) || (owner.IsGuest() && EClass.rnd(50) == 0)) && owner.FindBed() == null)
497 {
499 }
500 if (!EClass._zone.IsRegion)
501 {
502 switch (owner.id)
503 {
504 case "azzrasizzle":
505 case "geist":
506 {
508 {
509 break;
510 }
511 Point nearestPoint = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false);
512 if (nearestPoint == null)
513 {
514 break;
515 }
516 foreach (Chara item3 in nearestPoint.ListCharasInRadius(owner, 6, (Chara _c) => _c != owner && !_c.IsPCFactionOrMinion && _c.id != "cocoon" && _c.id != "cocoon_alien"))
517 {
518 item3.Teleport(nearestPoint.GetNearestPoint(allowBlock: false, allowChara: false) ?? nearestPoint);
519 }
520 if (owner != null)
521 {
523 {
524 EClass.pc.ai.Cancel();
525 }
526 owner.Teleport(nearestPoint);
527 }
528 yield return Success();
529 break;
530 }
531 case "spider_queen":
532 {
533 if (EClass.rnd(20) != 0 || !owner.CanDuplicate(DuplicateCondition.SpiderEgg) || EClass._zone.IsUserZone)
534 {
535 break;
536 }
537 int n2 = 0;
538 owner.pos.ForeachNeighbor(delegate(Point p)
539 {
540 if (p.HasChara && p.FirstChara.id == "cocoon")
541 {
542 n2++;
543 }
544 });
545 if (n2 < 2)
546 {
547 Point randomPoint2 = owner.pos.GetRandomPoint(1, requireLos: false, allowChara: false, allowBlocked: false, 20);
548 if (randomPoint2 != null)
549 {
550 Chara chara3 = EClass._zone.SpawnMob("cocoon", randomPoint2);
551 owner.Say("egglay", owner);
553 }
554 }
555 break;
556 }
557 case "mech_scarab":
558 {
560 {
561 break;
562 }
563 int n = 0;
564 owner.pos.ForeachNeighbor(delegate(Point p)
565 {
566 if (p.HasChara && p.FirstChara.id == "mech_scarab")
567 {
568 n++;
569 }
570 });
571 if (n >= 2)
572 {
573 break;
574 }
575 Point randomPoint = owner.pos.GetRandomPoint(1, requireLos: false, allowChara: false, allowBlocked: false, 20);
576 if (randomPoint != null)
577 {
578 Card c = EClass._zone.AddCard(owner.Duplicate(), randomPoint);
579 if (randomPoint.Distance(EClass.pc.pos) < EClass.pc.GetHearingRadius())
580 {
581 Msg.Say("self_dupe", owner, c);
582 }
583 }
584 break;
585 }
586 }
587 if (owner.HasElement(1432) && owner.TryFuse(0.001f))
588 {
589 yield return Success();
590 }
591 }
592 if (owner.IsMinion && owner.master != null && owner.master.id == "keeper_garden" && !(owner.master.ai is GoalCombat))
593 {
595 yield return Success();
596 }
598 {
599 Room room = owner.pos.cell.room;
600 if (room != null)
601 {
602 Point point = null;
603 if (owner.memberType == FactionMemberType.Guest && room.data.accessType != BaseArea.AccessType.Public)
604 {
605 point = FindMovePoint(BaseArea.AccessType.Public);
606 }
607 else if (owner.memberType == FactionMemberType.Default && room.data.accessType == BaseArea.AccessType.Private)
608 {
609 point = FindMovePoint(BaseArea.AccessType.Resident) ?? FindMovePoint(BaseArea.AccessType.Public);
610 }
611 if (point != null)
612 {
613 yield return DoGoto(point);
614 }
615 }
616 }
617 string id;
618 int num7;
620 {
621 if (owner.IsPCFaction && owner.GetInt(32) + 4320 < EClass.world.date.GetRaw())
622 {
623 if (owner.GetInt(32) != 0 && Zone.okaerinko < 10)
624 {
625 owner.Talk("welcomeBack");
626 Zone.okaerinko++;
627 }
629 }
631 {
633 {
634 id = "money";
635 num7 = EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(500)))) + 1;
636 string[] strs = new string[4] { "1294", "1294", "1130", "1131" };
637 ThrowMethod throwMethod = ThrowMethod.Reward;
639 {
640 owner.Talk("curse_wed");
641 throwMethod = ThrowMethod.Punish;
642 SetId("stone", 1);
643 if (EClass.rnd(3) == 0)
644 {
645 SetId("shuriken", 1);
646 }
647 if (EClass.rnd(3) == 0)
648 {
649 SetId("explosive", 1);
650 }
651 if (EClass.rnd(3) == 0)
652 {
653 SetId("explosive_mega", 1);
654 }
655 if (EClass.rnd(3) == 0)
656 {
657 SetId("rock", 1);
658 }
659 }
660 else
661 {
662 if (EClass.rnd(2) == 0)
663 {
664 owner.PlaySound((EClass.rnd(3) == 0) ? "clap1" : ((EClass.rnd(2) == 0) ? "clap2" : "clap3"));
665 }
666 owner.Talk("grats_wed");
667 if (EClass.rnd(5) == 0)
668 {
669 SetId("money2", 1);
670 }
671 if (EClass.rnd(4) == 0)
672 {
673 SetId("plat", 1);
674 }
675 if (EClass.rnd(3) == 0)
676 {
677 SetId(strs.RandomItem(), 1);
678 }
679 }
680 Thing thing4 = ThingGen.Create(id, -1, owner.LV).SetNum(num7);
681 thing4.SetRandomDir();
682 ActThrow.Throw(owner, EClass.pc.pos, thing4, throwMethod);
683 if (EClass.pc.IsAliveInCurrentZone && throwMethod == ThrowMethod.Reward && thing4.ExistsOnMap && thing4.pos.Equals(EClass.pc.pos) && !strs.Contains(thing4.id))
684 {
685 EClass.pc.Pick(thing4);
686 }
687 }
688 else if (EClass.rnd(5) == 0 && owner.hostility >= Hostility.Neutral && EClass.pc.IsPCC && EClass.pc.pccData.state == PCCState.Undie && !EClass.pc.pos.cell.IsTopWaterAndNoSnow)
689 {
690 owner.Talk("pervert3");
691 }
692 else if (EClass.rnd(15) == 0 && EClass._zone.IsTown && owner.hostility >= Hostility.Neutral && !owner.IsPCFaction && !EClass.pc.HasCondition<ConIncognito>())
693 {
694 bool flag4 = EClass._zone is Zone_Derphy;
695 string text = ((EClass.player.karma > 10) ? ((EClass.player.karma < 90) ? "" : (flag4 ? "rumor_bad" : "rumor_good")) : (flag4 ? "rumor_good" : "rumor_bad"));
696 if (!text.IsEmpty())
697 {
698 owner.Talk(text);
699 }
700 if ((flag4 ? (EClass.player.karma >= 90) : (EClass.player.karma <= 10)) && EClass.rnd(10) == 0)
701 {
702 Thing t = ThingGen.Create("stone", -1, owner.LV);
703 AI_PlayMusic.ignoreDamage = true;
705 AI_PlayMusic.ignoreDamage = false;
706 }
707 }
708 else
709 {
710 owner.TalkTopic("fov");
711 }
712 owner.turnLastSeen = EClass.player.stats.turns;
713 }
714 }
715 if (EClass.rnd(25) == 0 && owner.IsInMutterDistance())
716 {
718 {
719 owner.PlayAnime(AnimeID.Shiver);
720 }
722 if (tC == null || tC.pop.items.Count == 0)
723 {
724 if (owner.noMove)
725 {
726 foreach (Thing thing11 in owner.pos.Things)
727 {
728 if (thing11.IsInstalled && thing11.trait is TraitGeneratorWheel)
729 {
730 owner.Talk("labor");
731 owner.PlayAnime(AnimeID.Shiver);
732 yield return Restart();
733 }
734 }
735 }
736 if (owner.isDrunk && (owner.race.id == "cat" || owner.id == "sailor"))
737 {
738 owner.Talk("drunk_cat");
739 }
740 else if (owner.isRestrained)
741 {
742 owner.Talk("restrained");
743 }
744 else if (owner.GetInt(106) == 0 && !owner.IsPCParty)
745 {
746 if (owner.HasElement(1232) && EClass.rnd(4) == 0)
747 {
748 owner.Talk("baby");
749 }
750 else if (EClass.rnd((owner.host == null) ? 2 : 10) == 0 && owner.isSynced && owner.TalkTopic().IsEmpty())
751 {
752 owner.Talk(owner.pos.IsHotSpring ? "hotspring" : "idle");
753 }
754 }
755 }
756 }
757 if (EClass.rnd(8) == 0 && owner.race.id == "chicken")
758 {
759 owner.PlaySound("Animal/Chicken/chicken");
760 }
761 if (EClass.rnd(80) == 0 && owner.race.id == "cat")
762 {
763 owner.PlaySound("Animal/Cat/cat");
764 }
765 if (owner.trait.IdAmbience != null && owner.IsInMutterDistance(15))
766 {
767 float mtp = 1f;
768 Room room2 = owner.Cell.room;
769 Room room3 = EClass.pc.Cell.room;
770 if (room2 != room3 && room3 != null)
771 {
772 mtp = ((room2?.lot != room3?.lot) ? 0.4f : 0.7f);
773 }
774 EClass.Sound.PlayAmbience(owner.trait.IdAmbience, owner.pos.Position(), mtp);
775 }
776 if (EClass.rnd((EClass._zone is Zone_Wedding && !owner.HasCondition<ConDrunk>()) ? 30 : 2000) == 0 && owner.IsHuman && (owner.host == null || owner.host.ride != owner))
777 {
778 Thing thing5 = owner.things.Find((Thing a) => !a.IsNegativeGift && a.trait.CanDrink(owner), recursive: false);
779 if (thing5 != null && thing5.trait is TraitPotion && owner.IsPCParty)
780 {
781 thing5 = null;
782 }
783 bool flag5 = EClass.Branch != null && EClass.Branch.policies.IsActive(2503);
784 if (owner.homeBranch != null && owner.homeBranch.policies.IsActive(2503))
785 {
786 flag5 = true;
787 }
788 if (thing5 == null && !flag5)
789 {
790 thing5 = ThingGen.Create("crimAle");
791 owner.Drink(thing5);
792 }
793 if (thing5 != null && !thing5.isDestroyed)
794 {
795 owner.TryUse(thing5);
796 yield return Restart();
797 }
798 }
799 if (EClass.rnd(owner.IsPCParty ? 1000 : 200) == 0 && owner.isDrunk && (owner.isSynced || EClass.rnd(5) == 0))
800 {
801 DoSomethingToCharaInRadius(3, null, delegate(Chara chara6)
802 {
803 owner.Say("drunk_mess", owner, chara6);
804 owner.Talk("drunk_mess");
805 bool flag7 = EClass.rnd(5) == 0 && !chara6.IsPC;
806 if (chara6.IsPCParty && owner.hostility >= Hostility.Friend)
807 {
808 flag7 = false;
809 }
810 if (flag7)
811 {
812 owner.Say("drunk_counter", chara6, owner);
813 chara6.Talk("drunk_counter");
814 chara6.DoHostileAction(owner);
815 }
816 });
817 }
818 if (EClass.rnd(100) == 0 && owner.trait.CanFish && owner.stamina.value > 0)
819 {
820 Point fishingPoint = AI_Fish.GetFishingPoint(owner.pos);
821 if (fishingPoint.IsValid)
822 {
823 yield return Do(new AI_Fish
824 {
825 pos = fishingPoint
826 });
827 }
828 }
829 string idAct = owner.source.actIdle.RandomItem();
830 if (EClass.rnd(EClass.world.date.IsNight ? 1500 : 15000) == 0 && !owner.IsPCFaction && !owner.noMove)
831 {
832 owner.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
833 }
834 if (!owner.noMove)
835 {
836 if (EClass.rnd(3) == 0 && owner.IsCat)
837 {
838 Chara chara4 = ((EClass.rnd(5) == 0) ? EClass.pc.party.members.RandomItem() : EClass._map.charas.RandomItem());
839 Thing thing6 = chara4.things.Find<TraitFoodChuryu>();
840 if (chara4 != owner && thing6 != null)
841 {
842 yield return Do(new AI_Churyu
843 {
844 churyu = thing6,
845 slave = chara4
846 });
847 }
848 }
849 if (EClass.rnd(100) == 0 && (owner.HasHobbyOrWork("Pet") || owner.HasHobbyOrWork("Fluffy")))
850 {
851 yield return Do(new AI_Mofu());
852 }
853 }
854 if (EClass.rnd((owner.host != null && owner.GetInt(106) != 0) ? 1000 : 40) == 0 && owner.IsHuman)
855 {
856 DoSomethingToNearChara((Chara chara6) => (!chara6.IsPCParty || EClass.rnd(5) == 0) && chara6.IsMofuable && !owner.IsHostile(chara6) && !chara6.IsInCombat && owner.CanSee(chara6), delegate(Chara c2)
857 {
858 owner.Cuddle(c2);
859 });
860 yield return KeepRunning();
861 }
862 if (EClass.rnd(100) == 0)
863 {
864 bool flag6 = owner.HasElement(1291);
865 if (owner.trait is TraitBitch || flag6)
866 {
867 Chara chara5 = DoSomethingToNearChara((Chara chara6) => chara6.IsIdle && !chara6.IsPCParty && !(chara6.trait is TraitBitch) && chara6.Evalue(418) <= 0);
868 if (chara5 != null)
869 {
870 yield return Do(new AI_Fuck
871 {
872 target = chara5,
873 variation = ((!flag6) ? AI_Fuck.Variation.Bitch : AI_Fuck.Variation.MotherMilk)
874 });
875 }
876 }
877 }
878 if (EClass.rnd(50) == 0 && owner.trait is TraitBard)
879 {
880 yield return Do(new AI_PlayMusic());
881 }
882 if (EClass.rnd(4) == 0 && TryPerformIdleUse())
883 {
884 yield return Restart();
885 }
886 if (EClass.rnd(20) == 0 && owner.trait.IdleAct())
887 {
888 yield return Restart();
889 }
890 if (idAct == "janitor" && EClass.rnd(5) == 0)
891 {
892 DoSomethingToCharaInRadius(4, null, delegate(Chara chara6)
893 {
894 if (chara6.HasElement(1211) && !(EClass._zone is Zone_Casino))
895 {
896 owner.Talk("snail");
897 Thing t3 = ThingGen.Create("1142");
898 ActThrow.Throw(owner, chara6.pos, t3);
899 }
900 });
901 yield return Restart();
902 }
904 {
905 TraitShackle traitShackle2 = owner.pos.FindThing<TraitShackle>();
906 if (traitShackle2 != null && traitShackle2.AllowTraining)
907 {
909 {
910 shackle = traitShackle2
911 });
912 yield return Restart();
913 }
914 }
915 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>())
916 {
918 }
919 if (EClass.rnd(200) == 0 && !owner.noMove)
920 {
921 Point cleanPoint = AI_Clean.GetCleanPoint(owner, 4);
922 if (cleanPoint != null)
923 {
924 yield return Do(new AI_Clean
925 {
926 pos = cleanPoint
927 });
928 }
929 }
930 if (EClass.rnd(owner.isSynced ? 10 : 2000) == 0 && owner.ability.Has(5058))
931 {
932 if (!owner.UseAbility(5058) && !owner.IsPCFaction)
933 {
936 if (owner.isSynced)
937 {
939 }
940 }
941 yield return Restart();
942 }
943 if (EClass.rnd(35) == 0 && owner.id == "child" && owner.pos.cell.IsSnowTile)
944 {
945 foreach (Chara chara6 in EClass._map.charas)
946 {
947 if (EClass.rnd(3) != 0 && chara6 != owner && chara6.pos.cell.IsSnowTile && chara6.Dist(owner) <= 6 && Los.IsVisible(chara6, owner))
948 {
949 Thing t2 = ThingGen.Create("snow");
950 ActThrow.Throw(owner, chara6.pos, t2);
951 break;
952 }
953 }
954 }
955 if (EClass.rnd(EClass.debug.enable ? 3 : 30) == 0)
956 {
957 Thing thing7 = owner.things.Find<TraitBall>();
958 if (thing7 == null)
959 {
961 {
962 owner.pos.ForeachNeighbor(delegate(Point p)
963 {
964 Card card2 = p.FindThing<TraitBall>()?.owner;
965 if (card2 != null)
966 {
967 owner.Pick(card2.Thing);
968 }
969 });
970 }
971 }
972 else
973 {
974 foreach (Chara chara7 in EClass._map.charas)
975 {
976 if (EClass.rnd(3) != 0 && chara7 != owner && chara7.Dist(owner) <= 6 && chara7.Dist(owner) >= 3 && Los.IsVisible(chara7, owner))
977 {
978 ActThrow.Throw(owner, chara7.pos, thing7);
979 break;
980 }
981 }
982 }
983 }
984 if (EClass.rnd(20) == 0 && AI_Shopping.TryShop(owner, realtime: true))
985 {
986 yield return Restart();
987 }
988 if (EClass.rnd(20) == 0 && owner.IsPCFaction && AI_Shopping.TryRestock(owner, realtime: true))
989 {
990 yield return Restart();
991 }
993 if (owner.idleActTimer <= 0 && !owner.source.actIdle.IsEmpty())
994 {
995 owner.idleActTimer = 10 + EClass.rnd(50);
996 switch (idAct)
997 {
998 case "torture_snail":
999 DoSomethingToNearChara((Chara chara6) => chara6.race.id == "snail" || chara6.HasElement(1211), delegate(Chara chara6)
1000 {
1001 owner.Say("use_whip3", owner, chara6);
1002 owner.PlaySound("whip");
1003 owner.Talk("insult");
1004 if (chara6.IsPC)
1005 {
1006 Steam.GetAchievement(ID_Achievement.SNAIL);
1007 }
1008 chara6.PlayAnime(AnimeID.Shiver);
1009 chara6.OnInsulted();
1010 });
1011 break;
1012 case "buffMage":
1013 if (EClass.rnd(2) == 0)
1014 {
1015 TryCast<ConHolyVeil>(EffectId.HolyVeil, 300 + EClass.rnd(300));
1016 }
1017 else
1018 {
1019 TryCast<ConLevitate>(EffectId.Levitate, 300 + EClass.rnd(300));
1020 }
1021 break;
1022 case "buffThief":
1023 TryCast<ConNightVision>(EffectId.CatsEye, 100 + EClass.rnd(100));
1024 break;
1025 case "buffGuildWatch":
1026 TryCast<ConGravity>(EffectId.Gravity, 300 + EClass.rnd(300));
1027 break;
1028 case "buffHealer":
1029 if (!owner.IsPCParty || owner.hp != owner.MaxHP)
1030 {
1031 TryCast(EffectId.Heal);
1032 }
1033 break;
1034 case "readBook":
1035 {
1036 if (EClass.rnd(2) == 0 || (owner.IsPCParty && EClass.rnd(20) != 0))
1037 {
1038 break;
1039 }
1040 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);
1041 Thing thing8 = null;
1042 if (list4.Count > 0)
1043 {
1044 thing8 = list4.RandomItem();
1045 if (!thing8.trait.CanRead(owner))
1046 {
1047 thing8 = null;
1048 }
1049 }
1050 if (thing8 == null)
1051 {
1052 if (owner.things.IsFull())
1053 {
1054 break;
1055 }
1056 thing8 = ThingGen.CreateFromCategory((EClass.rnd(5) != 0) ? "spellbook" : "ancientbook");
1057 thing8.isNPCProperty = true;
1058 }
1059 if ((!(thing8.id == "1084") || !owner.IsPCFaction) && !(thing8.id == "book_death") && !(thing8.id == "book_black"))
1060 {
1061 if (!owner.HasElement(285))
1062 {
1063 owner.elements.ModBase(285, 1);
1064 }
1065 yield return Do(new AI_Read
1066 {
1067 target = thing8
1068 });
1069 }
1070 break;
1071 }
1072 default:
1073 if (LangGame.Has("idle_" + idAct))
1074 {
1075 IdleActText(idAct);
1076 }
1077 break;
1078 }
1079 yield return Restart();
1080 }
1081 if (owner.host != null)
1082 {
1083 yield return Restart();
1084 }
1086 {
1088 {
1089 yield return DoGoto(owner.orgPos);
1090 }
1091 yield return Restart();
1092 }
1094 {
1095 yield return DoGoto(EClass.pc);
1096 }
1097 if (EClass.rnd(100) == 0 && !owner.IsPCFaction)
1098 {
1099 if (owner.id == "ashland" || owner.id == "fiama")
1100 {
1101 Card card = EClass._map.Installed.traits.restSpots.RandomItem();
1102 if (card != null)
1103 {
1104 yield return DoGotoSpot(card);
1105 }
1106 else
1107 {
1108 Room room4 = owner.FindRoom();
1109 if (room4 != null)
1110 {
1111 yield return DoGoto(room4.GetRandomPoint().GetNearestPoint());
1112 }
1113 }
1114 }
1116 {
1117 yield return DoGoto(owner.orgPos, 0, ignoreConnection: false, delegate
1118 {
1119 if (!EClass._zone.IsPCFaction)
1120 {
1121 owner.Teleport(owner.orgPos, silent: false, force: true);
1122 }
1123 return Status.Success;
1124 });
1125 }
1126 }
1127 if (EClass.rnd(100) == 0 && owner.id == "bee")
1128 {
1129 Thing thing9 = EClass._map.ListThing<TraitBeekeep>()?.RandomItem();
1130 if (thing9 != null)
1131 {
1132 yield return DoGoto(thing9.pos);
1133 }
1134 }
1135 if (EClass.rnd(10) == 0 && !EClass._zone.IsUnderwater && (owner.race.tag.Contains("water") || owner.source.tag.Contains("water")) && !owner.pos.IsDeepWater)
1136 {
1137 for (int num8 = 0; num8 < 100; num8++)
1138 {
1139 Point randomPoint3 = EClass._map.GetRandomPoint();
1140 if (randomPoint3.IsDeepWater && !randomPoint3.IsBlocked)
1141 {
1142 yield return DoGoto(randomPoint3);
1143 break;
1144 }
1145 }
1146 }
1147 string aiIdle = owner.source.aiIdle;
1148 if (!(aiIdle == "stand") && !(aiIdle == "root"))
1149 {
1150 if (EClass.rnd(15) == 0 && (owner.mimicry == null || owner.mimicry.IsChara))
1151 {
1152 owner.MoveRandom();
1153 }
1154 if (owner == null)
1155 {
1156 yield return Cancel();
1157 }
1158 }
1159 if (EClass._zone.IsPCFaction && owner.IsPCFaction && !owner.IsPCParty && (owner.GetWork("Clean") != null || owner.GetWork("Chore") != null) && !(EClass.pc.ai is AI_UseCrafter))
1160 {
1161 AI_Haul aI_Haul = AI_Haul.TryGetAI(owner);
1162 if (aI_Haul != null)
1163 {
1164 yield return Do(aI_Haul);
1165 }
1166 }
1167 yield return Restart();
1168 Point FindMovePoint(BaseArea.AccessType type)
1169 {
1170 for (int i = 0; i < 20; i++)
1171 {
1172 Point randomPoint4 = owner.pos.GetRandomPoint(5 + i, requireLos: false);
1173 if (randomPoint4 != null && randomPoint4.IsInBounds && (randomPoint4.cell.room == null || randomPoint4.cell.room.data.accessType == type))
1174 {
1175 return randomPoint4;
1176 }
1177 }
1178 return null;
1179 }
1180 void SetId(string _id, int _num)
1181 {
1182 id = _id;
1183 num7 = _num;
1184 }
1185 }
AnimeID
Definition: AnimeID.cs:2
AttackSource
Definition: AttackSource.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
Status Do(AIAct _seq, Func< Status > _onChildFail=null)
Definition: AIAct.cs:430
virtual Status Cancel()
Definition: AIAct.cs:305
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:1224
int moveFailCount
Definition: AI_Idle.cs:16
Chara DoSomethingToCharaInRadius(int radius, Func< Chara, bool > funcPickChara, Action< Chara > action=null)
Definition: AI_Idle.cs:1243
void IdleActText(string id)
Definition: AI_Idle.cs:1187
bool TryPerformIdleUse()
Definition: AI_Idle.cs:1262
void TryCast(EffectId id, int power=100)
Definition: AI_Idle.cs:1205
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
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
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 IsInMutterDistance(int d=10)
Definition: Card.cs:8285
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:8241
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
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)
void OnInsulted()
Definition: Chara.cs:8734
bool HasHobbyOrWork(string alias)
Definition: Chara.cs:9457
override bool IsAliveInCurrentZone
Definition: Chara.cs:569
Thing FindBestFoodToEat()
Definition: Chara.cs:8049
new TraitChara trait
Definition: Chara.cs:511
Hostility OriginalHostility
Definition: Chara.cs:477
Card held
Definition: Chara.cs:72
AIAct ai
Definition: Chara.cs:208
bool TryUse(Thing t)
Definition: Chara.cs:8390
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:6635
int sharedCheckTurn
Definition: Chara.cs:122
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:8070
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9881
Faction faction
Definition: Chara.cs:433
override bool IsPC
Definition: Chara.cs:632
bool isDrunk
Definition: Chara.cs:128
Chara host
Definition: Chara.cs:35
Chara GetNearbyCatToSniff()
Definition: Chara.cs:8640
bool CanSeeLos(Card c, int dist=-1)
Definition: Chara.cs:1311
bool IsMofuable
Definition: Chara.cs:1160
override bool IsPCParty
Definition: Chara.cs:635
Party party
Definition: Chara.cs:45
bool IsInCombat
Definition: Chara.cs:913
TraitBed TryAssignBed()
Definition: Chara.cs:7829
void PickHeld(bool msg=false)
Definition: Chara.cs:4832
bool HasCondition(string alias)
Definition: Chara.cs:10053
void Banish(Chara owner)
Definition: Chara.cs:2578
AIAct SetAI(AIAct g)
Definition: Chara.cs:9496
bool IsIdle
Definition: Chara.cs:902
TraitBed FindBed()
Definition: Chara.cs:7817
bool CanDuplicate(DuplicateCondition con=DuplicateCondition.Default)
Definition: Chara.cs:1928
Stats hunger
Definition: Chara.cs:1203
override bool IsMinion
Definition: Chara.cs:647
override bool isSynced
Definition: Chara.cs:711
Point orgPos
Definition: Chara.cs:23
bool IsHuman
Definition: Chara.cs:928
bool MoveRandom()
Definition: Chara.cs:2844
void TryPutSharedItems(IEnumerable< Thing > containers, bool msg=true)
Definition: Chara.cs:7847
override bool IsPCFaction
Definition: Chara.cs:691
bool HasAccess(Card c)
Definition: Chara.cs:1345
bool CanEat(Thing t, bool shouldEat=false)
Definition: Chara.cs:8095
Chara Duplicate()
Definition: Chara.cs:1986
override int MaxHP
Definition: Chara.cs:728
void TryClearInventory()
Definition: Chara.cs:9105
void ClearInventory(ClearInventoryType type)
Definition: Chara.cs:9139
SourceChara.Row source
Definition: Chara.cs:164
Stats mana
Definition: Chara.cs:1215
FactionMemberType memberType
Definition: Chara.cs:48
string TalkTopic(string topic="calm")
Definition: Chara.cs:7438
Stats stamina
Definition: Chara.cs:1207
bool MoveNeighborDefinitely()
Definition: Chara.cs:2858
bool UseAbility(int idAct, Card tc=null, Point pos=null, bool pt=false)
Definition: Chara.cs:6167
Chara parasite
Definition: Chara.cs:32
Chara master
Definition: Chara.cs:90
Chara ride
Definition: Chara.cs:29
void AddCooldown(int idEle, int turns=0)
Definition: Chara.cs:9277
bool IsGuest()
Definition: Chara.cs:7043
Hobby GetWork(string id)
Definition: Chara.cs:9607
Thing nextUse
Definition: Chara.cs:102
Affinity affinity
Definition: Chara.cs:320
MoveResult TryMoveTowards(Point p)
Definition: Chara.cs:2884
Religion faith
Definition: Chara.cs:445
bool IsMarried
Definition: Chara.cs:617
Chara enemy
Definition: Chara.cs:88
CharaAbility ability
Definition: Chara.cs:430
Chara FindMaster()
Definition: Chara.cs:2653
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6718
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:6767
Room FindRoom()
Definition: Chara.cs:8446
Point GetDestination()
Definition: Chara.cs:7729
int turnLastSeen
Definition: Chara.cs:114
FactionBranch homeBranch
Definition: Chara.cs:1115
void Drink(Card t)
Definition: Chara.cs:5467
Hostility hostility
Definition: Chara.cs:297
bool IsHostile()
Definition: Chara.cs:6952
void TryTakeSharedItems(bool msg=true)
Definition: Chara.cs:7885
ConBaseTransmuteMimic mimicry
Definition: Chara.cs:108
PCCData pccData
Definition: Chara.cs:69
Chara SetHostility(Hostility h)
Definition: Chara.cs:1507
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4612
void Sniff(Chara c)
Definition: Chara.cs:8652
override bool IsPCC
Definition: Chara.cs:702
bool TryFuse(float chance=1f)
Definition: Chara.cs:1840
int idleActTimer
Definition: Chara.cs:116
bool IsCat
Definition: Chara.cs:1036
SourceRace.Row race
Definition: Chara.cs:470
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
static Game game
Definition: EClass.cs:9
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
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
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
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:2369
PropsInstalled Installed
Definition: Map.cs:128
PropsManager props
Definition: Map.cs:94
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:549
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1399
bool IsBlocked
Definition: Point.cs:359
List< Thing > Things
Definition: Point.cs:334
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:620
bool Equals(int _x, int _z)
Definition: Point.cs:962
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
Definition: Point.cs:874
bool IsValid
Definition: Point.cs:84
Point GetRandomPointInRadius(int minRadius, int maxRadius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=2000)
Definition: Point.cs:784
int Distance(Point p)
Definition: Point.cs:991
Chara FirstChara
Definition: Point.cs:284
bool IsInBounds
Definition: Point.cs:100
Cell cell
Definition: Point.cs:47
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1142
bool HasChara
Definition: Point.cs:234
bool IsHotSpring
Definition: Point.cs:371
bool IsDeepWater
Definition: Point.cs:272
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:770
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
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 Action GetHealAction(Chara c)
Definition: Trait.cs:639
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:2988
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:2159

References Lang._currency(), EClass._map, EClass._zone, Chara.ability, AreaData.accessType, Element.act, Zone.AddCard(), Chara.AddCondition(), Chara.AddCooldown(), Card.AddThing(), Chara.affinity, Chara.ai, TraitShackle.AllowTraining, ConfigTactics.AllyDistance(), Chara.Banish(), Zone.Boss, EClass.Branch, Zone.branch, Card.c_bloodData, Card.c_isImportant, Card.c_minionType, Card.c_uidMaster, AIAct.Cancel(), Trait.CanDrink(), Chara.CanDuplicate(), Trait.CanEat(), Chara.CanEat(), TraitChara.CanFish, Trait.CanRead(), Chara.CanSee(), Chara.CanSeeLos(), card, Game.cards, Card.category, Card.Cell, Point.cell, Map.charas, Chara.ClearInventory(), Game.config, ThingGen.Create(), ThingGen.CreateFromCategory(), Chara.Cuddle(), Affinity.CurrentStage, Card.DamageHP(), BaseArea.data, World.date, EClass.debug, ElementContainer.dict, Card.Dist(), Point.Distance(), AIAct.Do(), AIAct.DoGoto(), AIAct.DoGotoSpot(), Chara.DoHostileAction(), DoSomethingToCharaInRadius(), DoSomethingToNearChara(), Chara.Drink(), Chara.Duplicate(), Card.elements, CoreDebug.enable, Card.encLV, Chara.enemy, Point.Equals(), Card.Evalue(), Party.EvalueTotal(), Card.ExistsOnMap, Chara.faction, Chara.faith, Props.Find(), ThingContainer.Find(), Chara.FindBed(), Chara.FindBestFoodToEat(), Chara.FindMaster(), Chara.FindRoom(), Point.FindThing(), Point.FirstChara, Point.ForeachNeighbor(), EClass.game, Steam.GetAchievement(), AI_Clean.GetCleanPoint(), Card.GetCurrency(), Chara.GetDestination(), AI_Fish.GetFishingPoint(), CraftUtil.GetFoodScore(), Trait.GetHealAction(), Card.GetHearingRadius(), Card.GetInt(), FactionBranch.GetMeal(), Chara.GetNearbyCatToSniff(), Point.GetNearestPoint(), Stats.GetPhase(), BaseArea.GetRandomPoint(), Point.GetRandomPoint(), Point.GetRandomPointInRadius(), Date.GetRaw(), CardRenderer.GetTC(), CardManager.globalCharas, ReligionManager.Harmony, CharaAbility.Has(), LangGame.Has(), Chara.HasAccess(), Point.HasChara, Chara.HasCondition(), Card.HasEditorTag(), Party.HasElement(), Card.HasElement(), Cell.HasFire, Chara.HasHobbyOrWork(), Chara.held, Chara.homeBranch, Chara.host, Chara.hostility, Card.HostRenderer, Card.hp, Chara.hunger, Card.id, Element.id, TraitChara.IdAmbience, TraitChara.IdleAct(), IdleActText(), Chara.idleActTimer, TraitChara.IdleBehaviour, if(), Map.Installed, PropsManager.installed, LayerCraft.Instance, LayerDragGrid.Instance, Chara.InstantEat(), PolicyManager.IsActive(), Chara.IsAliveInCurrentZone, Point.IsBlocked, Chara.IsCat, Card.isDestroyed, Chara.isDrunk, Card.IsEquipment, ThingContainer.IsFull(), Card.isGifted, Chara.IsGuest(), Chara.IsHostile(), Point.IsHotSpring, Chara.IsHuman, Chara.IsIdle, Point.IsInBounds, Chara.IsInCombat, Card.IsInMutterDistance(), Card.IsInstalled, Chara.IsMarried, Chara.IsMinion, Chara.IsMofuable, Zone.IsNefia, Date.IsNight, Chara.IsPC, Chara.IsPCC, Chara.IsPCFaction, Zone.IsPCFaction, Card.IsPCFactionOrMinion, Chara.IsPCParty, Spatial.IsRegion, Card.isRestrained, Card.IsRestrainedResident, Thing.IsSharedContainer, Cell.IsSnowTile, Card.isSummon, Chara.isSynced, Cell.IsTopWaterAndNoSnow, Zone.IsTown, Zone.IsUserZone, Point.IsValid, Los.IsVisible(), Affinity.IsWeddingHater, item, ActList.items, PopManager.items, Player.karma, AIAct.KeepRunning(), Party.leader, CharaAbility.list, ThingContainer.List(), Room.lot, Card.LV, Chara.mana, Chara.master, Stats.max, Chara.MaxHP, FactionBranch.members, Party.members, Chara.memberType, Chara.mimicry, Stats.Mod(), ElementContainer.ModBase(), Card.ModCurrency(), Card.ModEncLv(), Card.ModNum(), ElementContainer.ModTempPotential(), moveFailCount, Chara.MoveNeighborDefinitely(), Chara.nextUse, Card.noMove, Card.Num, Zone.okaerinko, Chara.OnInsulted(), Chara.orgPos, Chara.OriginalHostility, AIAct.owner, Chara.parasite, Card.parent, Chara.party, EClass.pc, Chara.pccData, Zone.PetFollow, Chara.Pick(), Chara.PickHeld(), Card.PlayAnime(), EClass.player, Card.PlaySound(), FactionBranch.policies, TCText.pop, Card.pos, Point.Position(), Map.props, Chara.race, Game.religions, AIAct.Restart(), TraitManager.restSpots, ConBaseTransmuteMimic.Reveal(), Chara.ride, EClass.rnd(), EClass.rndHalf(), Cell.room, Msg.Say(), Card.Say(), Chara.SetAI(), Chara.SetEnemy(), Chara.SetHostility(), Card.SetInt(), Card.SetNum(), Card.SetRandomDir(), Chara.sharedCheckTurn, Chara.Sniff(), EClass.Sound, Chara.source, Element.source, Zone.SpawnMob(), Chara.stamina, Player.stats, AIAct.Success, Game.Config.tactics, Card.Talk(), Chara.TalkTopic(), Card.Teleport(), Card.Thing, Card.things, Point.Things, ActThrow.Throw(), Card.trait, Chara.trait, Props.traits, Chara.TryAssignBed(), TryCast(), Chara.TryClearInventory(), Chara.TryFuse(), Chara.TryMoveTowards(), TryPerformIdleUse(), Chara.TryPutSharedItems(), AI_Shopping.TryRestock(), AI_Shopping.TryShop(), Chara.TryTakeSharedItems(), Chara.TryUse(), Point.TryWitnessCrime(), Chara.turnLastSeen, Player.Stats.turns, Chara.UseAbility(), Stats.value, Element.ValueWithoutLink, Element.vTempPotential, and EClass.world.

◆ TryCast()

void AI_Idle.TryCast ( EffectId  id,
int  power = 100 
)
inline

Definition at line 1205 of file AI_Idle.cs.

1206 {
1207 owner.Say("idle_cast", owner);
1208 ActEffect.Proc(id, power, BlessedState.Normal, owner);
1209 }
BlessedState
Definition: BlessedState.cs:2
static void Proc(EffectId id, Card cc, Card tc=null, int power=100, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:1125

References ActEffect.Proc().

Referenced by Run().

◆ TryCast< T >()

void AI_Idle.TryCast< T > ( EffectId  id,
int  power = 100 
)
inline
Type Constraints
T :Condition 

Definition at line 1197 of file AI_Idle.cs.

1197 : Condition
1198 {
1199 if (!owner.HasCondition<T>())
1200 {
1201 TryCast(id, power);
1202 }
1203 }

◆ TryPerformIdleUse()

bool AI_Idle.TryPerformIdleUse ( )
inline

Definition at line 1262 of file AI_Idle.cs.

1263 {
1264 for (int i = 0; i < 10; i++)
1265 {
1266 if (owner == null)
1267 {
1268 return true;
1269 }
1270 Point randomPoint = owner.pos.GetRandomPoint(7, requireLos: true, allowChara: true, allowBlocked: true);
1271 if (randomPoint == null || randomPoint.detail == null)
1272 {
1273 continue;
1274 }
1275 foreach (Thing thing in randomPoint.detail.things)
1276 {
1277 if (!thing.IsInstalled)
1278 {
1279 continue;
1280 }
1281 int num = owner.Dist(thing);
1282 if (EClass.rnd((owner.memberType == FactionMemberType.Guest) ? 5 : 50) == 0 && thing.HasTag(CTAG.tourism) && num <= 2)
1283 {
1284 owner.LookAt(thing);
1285 owner.Talk("nice_statue");
1286 return true;
1287 }
1288 if (EClass.rnd(thing.trait.IdleUseChance) == 0 && thing.trait.IdleUse(owner, num))
1289 {
1290 if (owner != null)
1291 {
1292 owner.LookAt(thing);
1293 }
1294 return true;
1295 }
1296 }
1297 }
1298 return false;
1299 }
CTAG
Definition: CTAG.cs:2
bool HasTag(CTAG tag)
Definition: Card.cs:2728
List< Thing > things
Definition: CellDetail.cs:11
override void LookAt(Card c)
Definition: Chara.cs:3810
CellDetail detail
Definition: Point.cs:67
virtual int IdleUseChance
Definition: Trait.cs:375
virtual bool IdleUse(Chara c, int dist)
Definition: Trait.cs:683

References Point.detail, Point.GetRandomPoint(), Card.HasTag(), Trait.IdleUse(), Trait.IdleUseChance, Card.IsInstalled, EClass.rnd(), Card.things, and Card.trait.

Referenced by Run().

Member Data Documentation

◆ _listRoom

List<BaseArea> AI_Idle._listRoom = new List<BaseArea>()
staticprivate

Definition at line 18 of file AI_Idle.cs.

◆ maxRepeat

int AI_Idle.maxRepeat = 10

Definition at line 14 of file AI_Idle.cs.

◆ moveFailCount

int AI_Idle.moveFailCount

Definition at line 16 of file AI_Idle.cs.

Referenced by Run().

Property Documentation

◆ InformCancel

override bool AI_Idle.InformCancel
get

Definition at line 22 of file AI_Idle.cs.

◆ IsIdle

override bool AI_Idle.IsIdle
get

Definition at line 20 of file AI_Idle.cs.

◆ MaxRestart

override int AI_Idle.MaxRestart
get

Definition at line 24 of file AI_Idle.cs.

◆ ShouldEndMimicry

override bool AI_Idle.ShouldEndMimicry
get

Definition at line 26 of file AI_Idle.cs.


The documentation for this class was generated from the following file: