Elin Decompiled Documentation EA 23.167 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< StatusRun ()
 
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 ()
 
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< StatusRun ()
 
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, 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 ()
 
virtual bool CanPerform ()
 
bool Perform (Chara _cc, Card _tc=null, Point _tp=null)
 
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 int GetSourceValue (int 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)
 
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)
 
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< StatusEnumerator
 
AIAct child
 
AIAct parent
 
byte restartCount
 
Func< StatusonChildFail
 
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]
 
- 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 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]
 
virtual bool IsCrime [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)
 
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 int GetResistDamage (int dmg, int v, int power=0)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
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.RowListElements = new List<SourceElement.Row>()
 
static List< SourceElement.RowListAttackElements = 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 929 of file AI_Idle.cs.

930 {
931 List<Chara> list = owner.pos.ListCharasInRadius(owner, radius, delegate(Chara c)
932 {
933 if (c == owner || !owner.CanSee(c))
934 {
935 return false;
936 }
937 return funcPickChara == null || funcPickChara(c);
938 });
939 if (list.Count > 0)
940 {
941 Chara chara = list.RandomItem();
942 action?.Invoke(chara);
943 return chara;
944 }
945 return null;
946 }
new Chara owner
Definition: AIAct.cs:14
Point pos
Definition: Card.cs:55
Definition: Chara.cs:10
bool CanSee(Card c)
Definition: Chara.cs:1070
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
Definition: Point.cs:1200

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 910 of file AI_Idle.cs.

911 {
912 List<Chara> list = owner.pos.ListCharasInNeighbor(delegate(Chara c)
913 {
914 if (c == owner || !owner.CanSee(c))
915 {
916 return false;
917 }
918 return funcPickChara == null || funcPickChara(c);
919 });
920 if (list.Count > 0)
921 {
922 Chara chara = list.RandomItem();
923 action?.Invoke(chara);
924 return chara;
925 }
926 return null;
927 }
List< Chara > ListCharasInNeighbor(Func< Chara, bool > func)
Definition: Point.cs:1180

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

Referenced by Run().

◆ GetRandomAssignedRoom()

BaseArea AI_Idle.GetRandomAssignedRoom ( )
inline

Definition at line 897 of file AI_Idle.cs.

898 {
899 _listRoom.Clear();
900 foreach (BaseArea item in ((IEnumerable<BaseArea>)EClass._map.rooms.listRoom).Concat((IEnumerable<BaseArea>)EClass._map.rooms.listArea))
901 {
902 if (item.type != null && item.type.uidCharas.Contains(owner.uid))
903 {
904 _listRoom.Add(item);
905 }
906 }
907 return _listRoom.RandomItem();
908 }
static List< BaseArea > _listRoom
Definition: AI_Idle.cs:18
int uid
Definition: Card.cs:118
Definition: EClass.cs:5
static Map _map
Definition: EClass.cs:18
RoomManager rooms
Definition: Map.cs:31
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 873 of file AI_Idle.cs.

874 {
875 string text = "idle_" + id;
876 owner.PlaySound(text);
877 if (Lang.Game.map.ContainsKey(text))
878 {
879 owner.Say(text, owner);
880 }
881 }
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5776
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6423
int id
Definition: ELEMENT.cs:248
Definition: Lang.cs:6
static LangGame Game
Definition: Lang.cs:48

References Lang.Game.

Referenced by Run().

◆ OnStart()

override void AI_Idle.OnStart ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 26 of file AI_Idle.cs.

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

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

◆ Run()

override IEnumerable< Status > AI_Idle.Run ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 32 of file AI_Idle.cs.

33 {
34 while (true)
35 {
36 if (owner.held != null)
37 {
39 }
40 if (owner.nextUse != null)
41 {
42 Thing nextUse = owner.nextUse;
43 owner.nextUse = null;
44 if (nextUse.parent == owner && !nextUse.isDestroyed)
45 {
46 owner.TryUse(nextUse);
47 }
48 yield return KeepRunning();
49 }
51 {
52 if (EClass.rnd(5) == 0)
53 {
54 owner.Talk("onFire");
55 }
57 {
58 yield return Restart();
59 }
60 }
61 if (EClass.rnd(owner.IsPCParty ? 10 : 100) == 0 && owner.hunger.GetPhase() >= 3)
62 {
63 Thing thing = owner.things.Find((Thing a) => owner.CanEat(a, owner.IsPCFaction) && !a.c_isImportant, recursive: false);
64 if (thing == null && owner.IsPCFaction)
65 {
66 thing = owner.FindBestFoodToEat();
67 }
68 if (thing == null && owner.IsPCFaction && EClass._zone.IsPCFaction)
69 {
71 if (thing != null)
72 {
73 owner.Pick(thing);
74 }
75 }
76 if (thing == null && !owner.IsPCParty)
77 {
78 if (!owner.IsPCFaction && EClass.rnd(8) != 0)
79 {
80 owner.hunger.Mod(-30);
81 }
82 else if (!owner.things.IsFull())
83 {
84 thing = ThingGen.CreateFromCategory("food", EClass.rnd(EClass.rnd(60) + 1) + 10);
85 thing.isNPCProperty = true;
86 if ((thing.ChildrenAndSelfWeight < 5000 || !owner.IsPCParty) && thing.trait.CanEat(owner))
87 {
88 thing = owner.AddThing(thing);
89 }
90 }
91 }
92 if (thing != null)
93 {
95 {
96 owner.InstantEat(thing, sound: false);
97 yield return Restart();
98 }
99 else if (thing.Num == 1 || !owner.things.IsFull())
100 {
101 yield return Do(new AI_Eat
102 {
103 target = thing
104 });
105 }
106 }
107 }
108 if (EClass.rnd(3) == 0 && owner.mana.value > 0 && !EClass._zone.IsRegion)
109 {
110 Act act = null;
111 Act actRevive = null;
112 foreach (ActList.Item item in owner.ability.list.items)
113 {
114 Act act2 = item.act;
115 if (act2.id == 8430)
116 {
117 actRevive = act2;
118 }
119 string[] abilityType = act2.source.abilityType;
120 if (!abilityType.IsEmpty() && (abilityType[0] == "heal" || abilityType[0] == "hot"))
121 {
122 act = item.act;
123 }
124 }
125 if (act != null)
126 {
127 List<Chara> list = (owner.IsPCParty ? EClass.pc.party.members : new List<Chara> { owner });
128 foreach (Chara item2 in list)
129 {
130 if (!((float)item2.hp > (float)item2.MaxHP * 0.75f) && owner.CanSeeLos(item2) && (!(act.source.abilityType[0] == "hot") || !item2.HasCondition<ConHOT>()))
131 {
132 owner.UseAbility(act, item2);
133 yield return KeepRunning();
134 break;
135 }
136 }
137 }
138 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))
139 {
140 yield return KeepRunning();
141 }
142 }
144 {
146 if (owner.sharedCheckTurn < 0 && EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
147 {
150 owner.sharedCheckTurn += (EClass.debug.enable ? 20 : 200);
151 }
152 }
153 if ((EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (owner.IsPCParty ? 10 : (owner.IsPCFaction ? 2 : 0)) > EClass.rnd(100))
154 {
155 Thing thing2 = owner.things.Find("polish_powder");
156 if (thing2 != null && EClass._map.props.installed.Find<TraitGrindstone>() != null)
157 {
158 foreach (Thing thing8 in owner.things)
159 {
160 if (!thing8.IsEquipment || thing8.encLV >= 0)
161 {
162 continue;
163 }
164 for (int i = 0; i < 5; i++)
165 {
166 if (thing8.encLV >= 0)
167 {
168 break;
169 }
170 owner.Say("polish", owner, thing8);
171 thing8.ModEncLv(1);
172 thing2.ModNum(-1);
173 if (thing2.isDestroyed)
174 {
175 break;
176 }
177 }
178 if (thing2.isDestroyed)
179 {
180 break;
181 }
182 }
183 }
184 }
185 if (owner.IsPCParty)
186 {
188 {
189 TraitShackle traitShackle = owner.pos.FindThing<TraitShackle>();
190 if (traitShackle != null && traitShackle.AllowTraining)
191 {
193 {
194 shackle = traitShackle
195 });
196 }
197 yield return Restart();
198 }
199 if (EClass.rnd(20) == 0)
200 {
201 Thing thing3 = owner.things.Find((Thing a) => a.parent == owner && a.isGifted && (a.category.id == "skillbook" || a.category.id == "ancientbook"));
202 if (thing3 != null && thing3.trait.CanRead(owner) && (thing3.Num == 1 || !owner.things.IsFull()))
203 {
204 yield return Do(new AI_Read
205 {
206 target = thing3
207 });
208 }
209 }
210 if (EClass.rnd(100) == 0 && !EClass._zone.IsRegion && owner.HasElement(1227))
211 {
212 List<Chara> list2 = new List<Chara>();
213 foreach (Chara member in EClass.pc.party.members)
214 {
215 if (member.Evalue(1227) > 0)
216 {
217 list2.Add(member);
218 }
219 }
220 if (list2.Count > 2)
221 {
222 list2.Remove(owner);
223 owner.SetEnemy(list2.RandomItem());
224 yield return Success();
225 }
226 }
227 if (EClass.rnd(150) == 0 && owner.host != null && owner.host.parasite == owner && owner.GetInt(108) == 1)
228 {
229 owner.host.PlaySound("whip");
230 owner.host.Say("use_whip3", owner, owner.host);
231 owner.Talk("insult");
232 owner.host.PlayAnime(AnimeID.Shiver);
233 owner.host.DamageHP(5 + EClass.rndHalf(owner.host.MaxHP / 5), 919, 100, AttackSource.Condition);
235 yield return KeepRunning();
236 }
237 if (EClass.rnd(EClass.debug.enable ? 2 : 20) == 0 && owner.CanSee(EClass.pc) && !(EClass.pc.ai is AI_Eat))
238 {
240 }
241 if (owner.isSynced && EClass.rnd((owner.host == null) ? 200 : 150) == 0 && owner.GetInt(106) == 0)
242 {
243 if (EClass.rnd(2) == 0 && owner.GetInt(108) == 1)
244 {
245 owner.Talk("insult");
246 }
247 else
248 {
250 }
251 }
252 if (EClass.rnd(100) == 0 && EClass._zone.IsTown)
253 {
255 }
256 if ((EClass.rnd(20) == 0 || EClass.debug.enable) && owner.GetCurrency() >= 500)
257 {
258 bool flag = EClass._zone.IsTown;
260 {
261 foreach (Chara member2 in EClass._zone.branch.members)
262 {
263 if (member2.ExistsOnMap && member2.trait is TraitTrainer)
264 {
265 flag = true;
266 }
267 }
268 }
269 if (flag)
270 {
271 bool flag2 = false;
272 foreach (Element value in owner.elements.dict.Values)
273 {
274 if (!(value.source.category != "skill") && value.vTempPotential < 900)
275 {
276 flag2 = true;
277 break;
278 }
279 }
280 if (flag2)
281 {
282 int num = owner.GetCurrency();
283 if (num >= 20000)
284 {
285 num = 20000;
286 }
287 owner.PlaySound("pay");
288 int num2 = num / 200;
289 foreach (Element value2 in owner.elements.dict.Values)
290 {
291 if (!(value2.source.category != "skill"))
292 {
293 int num3 = num2 * 100 / (100 + (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) * (100 + value2.vTempPotential / 2 + value2.ValueWithoutLink) / 100);
294 num3 += 1 + EClass.rnd(3);
295 owner.elements.ModTempPotential(value2.id, Mathf.Max(1, num3), 9999);
296 }
297 }
298 Msg.Say("party_train", owner, Lang._currency(num));
299 owner.PlaySound("ding_potential");
300 owner.ModCurrency(-num);
301 }
302 }
303 }
304 }
305 if (owner.c_uidMaster != 0)
306 {
307 Chara chara = owner.master;
308 if (chara == null || !chara.IsAliveInCurrentZone)
309 {
310 chara = owner.FindMaster();
311 }
312 if (chara != null && chara.IsAliveInCurrentZone)
313 {
314 if (owner.enemy == null)
315 {
316 owner.SetEnemy(chara.enemy);
317 }
318 int num4 = owner.Dist(chara.pos);
319 if (owner.source.aiIdle != "root" && num4 > EClass.game.config.tactics.AllyDistance(owner) && EClass._zone.PetFollow && owner.c_minionType == MinionType.Default)
320 {
321 if (owner.HasAccess(chara.pos))
322 {
323 owner.TryMoveTowards(chara.pos);
324 }
325 yield return KeepRunning();
326 continue;
327 }
328 }
329 }
330 Party party = owner.party;
331 if (party == null || party.leader == owner || !party.leader.IsAliveInCurrentZone || owner.host != null || !EClass._zone.PetFollow)
332 {
333 break;
334 }
335 if (owner.source.aiIdle == "root")
336 {
337 yield return KeepRunning();
338 continue;
339 }
341 {
342 yield return KeepRunning();
343 continue;
344 }
345 if (owner.HasAccess(party.leader.pos) && owner.TryMoveTowards(party.leader.pos) == Card.MoveResult.Fail && owner.Dist(party.leader) > 4)
346 {
348 bool flag3 = (EClass._zone is Zone_Civilized || EClass._zone.IsPCFaction) && (EClass.pc.enemy == null || !EClass.pc.enemy.IsAliveInCurrentZone);
349 if (moveFailCount >= (flag3 ? 100 : 10))
350 {
351 owner.Teleport(party.leader.pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true), silent: false, force: true);
352 moveFailCount = 0;
353 }
354 }
355 else
356 {
357 moveFailCount = 0;
358 }
359 yield return KeepRunning();
360 }
361 if (EClass._zone.IsNefia && EClass._zone.Boss == owner && EClass.rnd(20) == 0)
362 {
364 }
365 if (EClass._zone.IsRegion && EClass.rnd(10) != 0)
366 {
367 yield return Restart();
368 }
369 if (((owner.homeBranch != null && owner.homeBranch == EClass.Branch && EClass.rnd(100) == 0) || (owner.IsGuest() && EClass.rnd(50) == 0)) && owner.FindBed() == null)
370 {
372 }
373 if (owner.id == "geist" && EClass.rnd(20) == 0)
374 {
375 Point nearestPoint = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false);
376 if (nearestPoint != null)
377 {
378 foreach (Chara item3 in nearestPoint.ListCharasInRadius(owner, 6, (Chara _c) => _c != owner && !_c.IsPCFactionOrMinion))
379 {
380 item3.Teleport(nearestPoint.GetNearestPoint(allowBlock: false, allowChara: false) ?? nearestPoint);
381 }
382 if (owner != null)
383 {
385 {
386 EClass.pc.ai.Cancel();
387 }
388 owner.Teleport(nearestPoint);
389 }
390 yield return Success();
391 }
392 }
394 {
395 Room room = owner.pos.cell.room;
396 if (room != null)
397 {
398 Point point = null;
399 if (owner.memberType == FactionMemberType.Guest && room.data.accessType != 0)
400 {
401 point = FindMovePoint(BaseArea.AccessType.Public);
402 }
403 else if (owner.memberType == FactionMemberType.Default && room.data.accessType == BaseArea.AccessType.Private)
404 {
405 point = FindMovePoint(BaseArea.AccessType.Resident) ?? FindMovePoint(BaseArea.AccessType.Public);
406 }
407 if (point != null)
408 {
409 yield return DoGoto(point);
410 }
411 }
412 }
414 {
415 if (owner.IsPCFaction && owner.GetInt(32) + 4320 < EClass.world.date.GetRaw())
416 {
417 if (owner.GetInt(32) != 0 && Zone.okaerinko < 10)
418 {
419 owner.Talk("welcomeBack");
420 Zone.okaerinko++;
421 }
423 }
425 {
426 if (EClass.rnd(5) == 0 && owner.hostility >= Hostility.Neutral && EClass.pc.IsPCC && EClass.pc.pccData.state == PCCState.Undie && !EClass.pc.pos.cell.IsTopWaterAndNoSnow)
427 {
428 owner.Talk("pervert3");
429 }
430 else if (EClass.rnd(15) == 0 && EClass._zone.IsTown && owner.hostility >= Hostility.Neutral && !owner.IsPCFaction && !EClass.pc.HasCondition<ConIncognito>())
431 {
432 bool flag4 = EClass._zone is Zone_Derphy;
433 string text = ((EClass.player.karma > 10) ? ((EClass.player.karma < 90) ? "" : (flag4 ? "rumor_bad" : "rumor_good")) : (flag4 ? "rumor_good" : "rumor_bad"));
434 if (!text.IsEmpty())
435 {
436 owner.Talk(text);
437 }
438 if ((flag4 ? (EClass.player.karma >= 90) : (EClass.player.karma <= 10)) && EClass.rnd(10) == 0)
439 {
440 Thing t2 = ThingGen.Create("stone");
441 AI_PlayMusic.ignoreDamage = true;
443 AI_PlayMusic.ignoreDamage = false;
444 }
445 }
446 else
447 {
448 owner.TalkTopic("fov");
449 }
450 owner.turnLastSeen = EClass.player.stats.turns;
451 }
452 }
453 if (EClass.rnd(25) == 0 && owner.IsInMutterDistance())
454 {
456 {
457 owner.PlayAnime(AnimeID.Shiver);
458 }
460 if (tC == null || tC.pop.items.Count == 0)
461 {
462 if (owner.noMove)
463 {
464 foreach (Thing thing9 in owner.pos.Things)
465 {
466 if (thing9.IsInstalled && thing9.trait is TraitGeneratorWheel)
467 {
468 owner.Talk("labor");
469 owner.PlayAnime(AnimeID.Shiver);
470 yield return Restart();
471 }
472 }
473 }
474 if (owner.isDrunk && (owner.race.id == "cat" || owner.id == "sailor"))
475 {
476 owner.Talk("drunk_cat");
477 }
478 else if (owner.isRestrained)
479 {
480 owner.Talk("restrained");
481 }
482 else if (owner.GetInt(106) == 0 && !owner.IsPCParty)
483 {
484 if (owner.HasElement(1232) && EClass.rnd(4) == 0)
485 {
486 owner.Talk("baby");
487 }
488 else if (EClass.rnd((owner.host == null) ? 2 : 10) == 0 && owner.isSynced && owner.TalkTopic().IsEmpty())
489 {
490 owner.Talk(owner.pos.IsHotSpring ? "hotspring" : "idle");
491 }
492 }
493 }
494 }
495 if (EClass.rnd(8) == 0 && owner.race.id == "chicken")
496 {
497 owner.PlaySound("Animal/Chicken/chicken");
498 }
499 if (EClass.rnd(80) == 0 && owner.race.id == "cat")
500 {
501 owner.PlaySound("Animal/Cat/cat");
502 }
503 if (owner.trait.IdAmbience != null && owner.IsInMutterDistance(15))
504 {
505 float mtp = 1f;
506 Room room2 = owner.Cell.room;
507 Room room3 = EClass.pc.Cell.room;
508 if (room2 != room3 && room3 != null)
509 {
510 mtp = ((room2?.lot != room3?.lot) ? 0.4f : 0.7f);
511 }
512 EClass.Sound.PlayAmbience(owner.trait.IdAmbience, owner.pos.Position(), mtp);
513 }
514 if (EClass.rnd(2000) == 0 && owner.IsHuman && (owner.host == null || owner.host.ride != owner))
515 {
516 Thing thing4 = owner.things.Find((Thing a) => !a.IsNegativeGift && a.trait.CanDrink(owner), recursive: false);
517 if (thing4 != null && thing4.trait is TraitPotion && owner.IsPCParty)
518 {
519 thing4 = null;
520 }
521 bool flag5 = EClass.Branch != null && EClass.Branch.policies.IsActive(2503);
522 if (owner.homeBranch != null && owner.homeBranch.policies.IsActive(2503))
523 {
524 flag5 = true;
525 }
526 if (thing4 == null && !flag5)
527 {
528 thing4 = ThingGen.Create("crimAle");
529 owner.Drink(thing4);
530 }
531 if (thing4 != null && !thing4.isDestroyed)
532 {
533 owner.TryUse(thing4);
534 yield return Restart();
535 }
536 }
537 if (EClass.rnd(owner.IsPCParty ? 1000 : 200) == 0 && owner.isDrunk && (owner.isSynced || EClass.rnd(5) == 0))
538 {
539 DoSomethingToCharaInRadius(3, null, delegate(Chara c)
540 {
541 owner.Say("drunk_mess", owner, c);
542 owner.Talk("drunk_mess");
543 bool flag6 = EClass.rnd(5) == 0 && !c.IsPC;
544 if (c.IsPCParty && owner.hostility >= Hostility.Friend)
545 {
546 flag6 = false;
547 }
548 if (flag6)
549 {
550 owner.Say("drunk_counter", c, owner);
551 c.Talk("drunk_counter");
553 }
554 });
555 }
556 if (EClass.rnd(100) == 0 && owner.trait.CanFish && owner.stamina.value > 0)
557 {
558 Point fishingPoint = AI_Fish.GetFishingPoint(owner.pos);
559 if (fishingPoint.IsValid)
560 {
561 yield return Do(new AI_Fish
562 {
563 pos = fishingPoint
564 });
565 }
566 }
567 string idAct = owner.source.actIdle.RandomItem();
568 if (EClass.rnd(EClass.world.date.IsNight ? 1500 : 15000) == 0 && !owner.IsPCFaction && !owner.noMove)
569 {
570 owner.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
571 }
572 if (EClass.rnd((owner.host != null && owner.GetInt(106) != 0) ? 1000 : 40) == 0 && owner.IsHuman)
573 {
574 DoSomethingToNearChara((Chara c) => (!c.IsPCParty || EClass.rnd(5) == 0) && c.IsMofuable && !owner.IsHostile(c) && !c.IsInCombat, delegate(Chara c)
575 {
576 owner.Cuddle(c);
577 });
578 yield return KeepRunning();
579 }
580 if (EClass.rnd(100) == 0 && owner.trait is TraitBitch)
581 {
582 Chara chara2 = DoSomethingToNearChara((Chara c) => c.IsIdle && !c.IsPCParty && !(c.trait is TraitBitch) && c.Evalue(418) <= 0);
583 if (chara2 != null)
584 {
585 yield return Do(new AI_Fuck
586 {
587 target = chara2,
588 bitch = true
589 });
590 }
591 }
592 if (EClass.rnd(50) == 0 && owner.trait is TraitBard)
593 {
594 yield return Do(new AI_PlayMusic());
595 }
596 if (EClass.rnd(4) == 0 && TryPerformIdleUse())
597 {
598 yield return Restart();
599 }
600 if (EClass.rnd(20) == 0 && owner.trait.IdleAct())
601 {
602 yield return Restart();
603 }
604 if (idAct == "janitor" && EClass.rnd(5) == 0)
605 {
606 DoSomethingToCharaInRadius(4, null, delegate(Chara c)
607 {
608 if (c.HasElement(1211) && !(EClass._zone is Zone_Casino))
609 {
610 owner.Talk("snail");
611 Thing t4 = ThingGen.Create("1142");
612 ActThrow.Throw(owner, c.pos, t4);
613 }
614 });
615 yield return Restart();
616 }
618 {
619 TraitShackle traitShackle2 = owner.pos.FindThing<TraitShackle>();
620 if (traitShackle2 != null && traitShackle2.AllowTraining)
621 {
623 {
624 shackle = traitShackle2
625 });
626 yield return Restart();
627 }
628 }
629 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>())
630 {
632 }
633 if (EClass.rnd(200) == 0 && !owner.noMove)
634 {
635 Point cleanPoint = AI_Clean.GetCleanPoint(owner, 4);
636 if (cleanPoint != null)
637 {
638 yield return Do(new AI_Clean
639 {
640 pos = cleanPoint
641 });
642 }
643 }
644 if (EClass.rnd(35) == 0 && owner.id == "child" && owner.pos.cell.IsSnowTile)
645 {
646 foreach (Chara chara3 in EClass._map.charas)
647 {
648 if (EClass.rnd(3) != 0 && chara3 != owner && chara3.pos.cell.IsSnowTile && chara3.Dist(owner) <= 6 && Los.IsVisible(chara3, owner))
649 {
650 Thing t3 = ThingGen.Create("snow");
651 ActThrow.Throw(owner, chara3.pos, t3);
652 break;
653 }
654 }
655 }
656 if (EClass.rnd(EClass.debug.enable ? 3 : 30) == 0)
657 {
658 Thing thing5 = owner.things.Find<TraitBall>();
659 if (thing5 == null)
660 {
661 owner.pos.ForeachNeighbor(delegate(Point p)
662 {
663 Card card2 = p.FindThing<TraitBall>()?.owner;
664 if (card2 != null)
665 {
666 owner.Pick(card2.Thing);
667 }
668 });
669 }
670 else
671 {
672 foreach (Chara chara4 in EClass._map.charas)
673 {
674 if (EClass.rnd(3) != 0 && chara4 != owner && chara4.Dist(owner) <= 6 && chara4.Dist(owner) >= 3 && Los.IsVisible(chara4, owner))
675 {
676 ActThrow.Throw(owner, chara4.pos, thing5);
677 break;
678 }
679 }
680 }
681 }
682 if (EClass.rnd(20) == 0 && AI_Shopping.TryShop(owner, realtime: true))
683 {
684 yield return Restart();
685 }
686 if (EClass.rnd(20) == 0 && owner.IsPCFaction && AI_Shopping.TryRestock(owner, realtime: true))
687 {
688 yield return Restart();
689 }
691 if (owner.idleActTimer <= 0 && !owner.source.actIdle.IsEmpty())
692 {
693 owner.idleActTimer = 10 + EClass.rnd(50);
694 switch (idAct)
695 {
696 case "torture_snail":
697 DoSomethingToNearChara((Chara c) => c.race.id == "snail", delegate(Chara c)
698 {
699 owner.Say("use_whip3", owner, c);
700 owner.PlaySound("whip");
701 owner.Talk("insult");
702 c.PlayAnime(AnimeID.Shiver);
703 c.OnInsulted();
704 });
705 break;
706 case "buffMage":
707 if (EClass.rnd(2) == 0)
708 {
709 TryCast<ConHolyVeil>(EffectId.HolyVeil, 300 + EClass.rnd(300));
710 }
711 else
712 {
713 TryCast<ConLevitate>(EffectId.Levitate, 300 + EClass.rnd(300));
714 }
715 break;
716 case "buffThief":
717 TryCast<ConNightVision>(EffectId.CatsEye, 100 + EClass.rnd(100));
718 break;
719 case "buffGuildWatch":
720 TryCast<ConGravity>(EffectId.Gravity, 300 + EClass.rnd(300));
721 break;
722 case "buffHealer":
723 TryCast(EffectId.Heal);
724 break;
725 case "readBook":
726 {
727 if (EClass.rnd(2) == 0 || (owner.IsPCParty && EClass.rnd(20) != 0))
728 {
729 break;
730 }
731 List<Thing> list3 = owner.things.List((Thing a) => a.parent == owner && (a.category.id == "spellbook" || a.category.id == "ancientbook" || a.category.id == "skillbook"), onlyAccessible: true);
732 Thing thing6 = null;
733 if (list3.Count > 0)
734 {
735 thing6 = list3.RandomItem();
736 if (!thing6.trait.CanRead(owner))
737 {
738 thing6 = null;
739 }
740 }
741 if (thing6 == null)
742 {
743 if (owner.things.IsFull())
744 {
745 break;
746 }
747 thing6 = ThingGen.CreateFromCategory((EClass.rnd(5) != 0) ? "spellbook" : "ancientbook");
748 thing6.isNPCProperty = true;
749 }
750 if (!(thing6.id == "1084") || !owner.IsPCFaction)
751 {
752 if (!owner.HasElement(285))
753 {
754 owner.elements.ModBase(285, 1);
755 }
756 yield return Do(new AI_Read
757 {
758 target = thing6
759 });
760 }
761 break;
762 }
763 default:
764 if (LangGame.Has("idle_" + idAct))
765 {
766 IdleActText(idAct);
767 }
768 break;
769 }
770 yield return Restart();
771 }
772 if (owner.host != null)
773 {
774 yield return Restart();
775 }
777 {
779 {
780 yield return DoGoto(owner.orgPos);
781 }
782 yield return Restart();
783 }
785 {
786 yield return DoGoto(EClass.pc);
787 }
788 if (EClass.rnd(100) == 0 && !owner.IsPCFaction)
789 {
790 if (owner.id == "ashland" || owner.id == "fiama")
791 {
793 if (card != null)
794 {
795 yield return DoGotoSpot(card);
796 }
797 else
798 {
799 Room room4 = owner.FindRoom();
800 if (room4 != null)
801 {
802 yield return DoGoto(room4.GetRandomPoint().GetNearestPoint());
803 }
804 }
805 }
807 {
808 yield return DoGoto(owner.orgPos, 0, ignoreConnection: false, delegate
809 {
810 if (!EClass._zone.IsPCFaction)
811 {
812 owner.Teleport(owner.orgPos, silent: false, force: true);
813 }
814 return Status.Success;
815 });
816 }
817 }
818 if (EClass.rnd(100) == 0 && owner.id == "bee")
819 {
820 Thing thing7 = EClass._map.ListThing<TraitBeekeep>()?.RandomItem();
821 if (thing7 != null)
822 {
823 yield return DoGoto(thing7.pos);
824 }
825 }
826 if (EClass.rnd(10) == 0 && !EClass._zone.IsUnderwater && (owner.race.tag.Contains("water") || owner.source.tag.Contains("water")) && !owner.pos.IsDeepWater)
827 {
828 for (int j = 0; j < 100; j++)
829 {
830 Point randomPoint = EClass._map.GetRandomPoint();
831 if (randomPoint.IsDeepWater && !randomPoint.IsBlocked)
832 {
833 yield return DoGoto(randomPoint);
834 break;
835 }
836 }
837 }
838 string aiIdle = owner.source.aiIdle;
839 if (!(aiIdle == "stand") && !(aiIdle == "root"))
840 {
841 if (EClass.rnd(15) == 0)
842 {
844 }
845 if (owner == null)
846 {
847 yield return Cancel();
848 }
849 }
850 if (EClass._zone.IsPCFaction && owner.IsPCFaction && !owner.IsPCParty && (owner.GetWork("Clean") != null || owner.GetWork("Chore") != null) && !(EClass.pc.ai is AI_UseCrafter))
851 {
852 AI_Haul aI_Haul = AI_Haul.TryGetAI(owner);
853 if (aI_Haul != null)
854 {
855 yield return Do(aI_Haul);
856 }
857 }
858 yield return Restart();
859 Point FindMovePoint(BaseArea.AccessType type)
860 {
861 for (int k = 0; k < 20; k++)
862 {
863 Point randomPoint2 = owner.pos.GetRandomPoint(5 + k, requireLos: false);
864 if (randomPoint2 != null && randomPoint2.IsInBounds && (randomPoint2.cell.room == null || randomPoint2.cell.room.data.accessType == type))
865 {
866 return randomPoint2;
867 }
868 }
869 return null;
870 }
871 }
AnimeID
Definition: AnimeID.cs:2
AttackSource
Definition: AttackSource.cs:2
ClearInventoryType
EditorTag
Definition: EditorTag.cs:2
EffectId
Definition: EffectId.cs:2
FactionMemberType
Hostility
Definition: Hostility.cs:2
MinionType
Definition: MinionType.cs:2
ThrowMethod
Definition: ThrowMethod.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
Status Do(AIAct _seq, Func< Status > _onChildFail=null)
Definition: AIAct.cs:416
virtual Status Cancel()
Definition: AIAct.cs:291
Status
Definition: AIAct.cs:8
Status DoGotoSpot(Card card, Func< Status > _onChildFail=null)
Definition: AIAct.cs:461
Status DoGoto(Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
Definition: AIAct.cs:432
Status KeepRunning()
Definition: AIAct.cs:321
Status Restart()
Definition: AIAct.cs:237
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:272
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:910
int moveFailCount
Definition: AI_Idle.cs:16
Chara DoSomethingToCharaInRadius(int radius, Func< Chara, bool > funcPickChara, Action< Chara > action=null)
Definition: AI_Idle.cs:929
void IdleActText(string id)
Definition: AI_Idle.cs:873
bool TryPerformIdleUse()
Definition: AI_Idle.cs:948
void TryCast(EffectId id, int power=100)
Definition: AI_Idle.cs:891
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
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:93
Definition: ACT.cs:62
BaseArea.AccessType accessType
Definition: AreaData.cs:42
AccessType
Definition: BaseArea.cs:9
AreaData data
Definition: BaseArea.cs:29
virtual Point GetRandomPoint(bool walkable=true, bool allowChara=true)
Definition: BaseArea.cs:88
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39
GlobalCharaList globalCharas
Definition: CardManager.cs:46
TC GetTC(string id)
Definition: Card.cs:11
bool isDestroyed
Definition: Card.cs:71
bool IsPCFactionOrMinion
Definition: Card.cs:2208
void Teleport(Point point, bool silent=false, bool force=false)
Definition: Card.cs:5505
ElementContainerCard elements
Definition: Card.cs:37
string id
Definition: Card.cs:31
bool IsRestrainedResident
Definition: Card.cs:2194
void DamageHP(int dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:3908
bool HasElement(int ele, int req=1)
Definition: Card.cs:5566
bool isRestrained
Definition: Card.cs:550
CardRenderer HostRenderer
Definition: Card.cs:2378
int c_uidMaster
Definition: Card.cs:1409
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3020
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6326
int hp
Definition: Card.cs:226
ICardParent parent
Definition: Card.cs:51
bool ExistsOnMap
Definition: Card.cs:2021
int GetCurrency(string id="money")
Definition: Card.cs:3820
bool IsInMutterDistance(int d=10)
Definition: Card.cs:7279
Trait trait
Definition: Card.cs:49
void ModCurrency(int a, string id="money")
Definition: Card.cs:3806
int encLV
Definition: Card.cs:310
bool IsEquipment
Definition: Card.cs:2109
void ModEncLv(int a)
Definition: Card.cs:3691
bool c_isImportant
Definition: Card.cs:996
MoveResult
Definition: Card.cs:13
bool noMove
Definition: Card.cs:754
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2536
ThingContainer things
Definition: Card.cs:34
bool IsInstalled
Definition: Card.cs:2317
virtual Thing Thing
Definition: Card.cs:1994
int Evalue(int ele)
Definition: Card.cs:2507
int Dist(Card c)
Definition: Card.cs:7235
bool isGifted
Definition: Card.cs:766
Cell Cell
Definition: Card.cs:1991
int ChildrenAndSelfWeight
Definition: Card.cs:1977
int Num
Definition: Card.cs:154
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:5795
SourceCategory.Row category
Definition: Card.cs:1985
void ModNum(int a, bool notify=true)
Definition: Card.cs:3376
Room room
Definition: Cell.cs:102
bool IsSnowTile
Definition: Cell.cs:782
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712
bool HasFire
Definition: Cell.cs:676
ActList list
Definition: CharaAbility.cs:12
void OnInsulted()
Definition: Chara.cs:7563
bool UseAbility(string idAct, Card tc=null, Point pos=null, bool pt=false)
Definition: Chara.cs:5354
override bool IsAliveInCurrentZone
Definition: Chara.cs:557
Thing FindBestFoodToEat()
Definition: Chara.cs:7011
new TraitChara trait
Definition: Chara.cs:499
Card held
Definition: Chara.cs:70
AIAct ai
Definition: Chara.cs:198
bool TryUse(Thing t)
Definition: Chara.cs:7306
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:5776
int sharedCheckTurn
Definition: Chara.cs:118
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:7032
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:8566
Faction faction
Definition: Chara.cs:423
override bool IsPC
Definition: Chara.cs:608
bool isDrunk
Definition: Chara.cs:124
Chara host
Definition: Chara.cs:33
bool CanSeeLos(Card c, int dist=-1)
Definition: Chara.cs:1102
bool IsMofuable
Definition: Chara.cs:960
override bool IsPCParty
Definition: Chara.cs:611
Party party
Definition: Chara.cs:43
bool IsInCombat
Definition: Chara.cs:860
TraitBed TryAssignBed()
Definition: Chara.cs:6812
void PickHeld(bool msg=false)
Definition: Chara.cs:4233
bool HasCondition(string alias)
Definition: Chara.cs:8723
AIAct SetAI(AIAct g)
Definition: Chara.cs:8196
bool IsIdle
Definition: Chara.cs:849
TraitBed FindBed()
Definition: Chara.cs:6800
Stats hunger
Definition: Chara.cs:994
override bool isSynced
Definition: Chara.cs:687
Point orgPos
Definition: Chara.cs:21
bool IsHuman
Definition: Chara.cs:878
bool MoveRandom()
Definition: Chara.cs:2352
void TryPutSharedItems(IEnumerable< Thing > containers, bool msg=true)
Definition: Chara.cs:6830
override bool IsPCFaction
Definition: Chara.cs:667
bool HasAccess(Card c)
Definition: Chara.cs:1132
bool CanEat(Thing t, bool shouldEat=false)
Definition: Chara.cs:7058
override int MaxHP
Definition: Chara.cs:704
void ClearInventory(ClearInventoryType type)
Definition: Chara.cs:7919
SourceChara.Row source
Definition: Chara.cs:154
Stats mana
Definition: Chara.cs:1006
FactionMemberType memberType
Definition: Chara.cs:46
string TalkTopic(string topic="calm")
Definition: Chara.cs:6468
Stats stamina
Definition: Chara.cs:998
bool MoveNeighborDefinitely()
Definition: Chara.cs:2366
Chara parasite
Definition: Chara.cs:30
Chara master
Definition: Chara.cs:88
bool IsGuest()
Definition: Chara.cs:6124
Hobby GetWork(string id)
Definition: Chara.cs:8307
Thing nextUse
Definition: Chara.cs:100
MoveResult TryMoveTowards(Point p)
Definition: Chara.cs:2392
Chara enemy
Definition: Chara.cs:86
CharaAbility ability
Definition: Chara.cs:420
Chara FindMaster()
Definition: Chara.cs:2161
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:5815
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:5864
Room FindRoom()
Definition: Chara.cs:7362
Point GetDestination()
Definition: Chara.cs:6719
int turnLastSeen
Definition: Chara.cs:110
FactionBranch homeBranch
Definition: Chara.cs:932
void Drink(Card t)
Definition: Chara.cs:4715
Hostility hostility
Definition: Chara.cs:287
bool IsHostile()
Definition: Chara.cs:6041
void TryTakeSharedItems(bool msg=true)
Definition: Chara.cs:6868
PCCData pccData
Definition: Chara.cs:67
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4017
override bool IsPCC
Definition: Chara.cs:678
int idleActTimer
Definition: Chara.cs:112
SourceRace.Row race
Definition: Chara.cs:460
Definition: ConHOT.cs:4
int AllyDistance(Chara c)
bool enable
Definition: CoreDebug.cs:285
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
bool IsNight
Definition: Date.cs:112
static Game game
Definition: EClass.cs:8
static int rnd(int a)
Definition: EClass.cs:58
static Zone _zone
Definition: EClass.cs:20
static World world
Definition: EClass.cs:40
static FactionBranch Branch
Definition: EClass.cs:22
static int rndHalf(int a)
Definition: EClass.cs:82
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static SoundManager Sound
Definition: EClass.cs:46
Dictionary< int, Element > dict
Element ModTempPotential(int ele, int v, int threshMsg=0)
Element ModBase(int ele, int v)
int ValueWithoutLink
Definition: ELEMENT.cs:292
SourceElement.Row source
Definition: ELEMENT.cs:271
int vTempPotential
Definition: ELEMENT.cs:256
Act act
Definition: ELEMENT.cs:392
Thing GetMeal(Chara c)
List< Chara > members
PolicyManager policies
ConfigTactics tactics
Definition: Game.cs:90
CardManager cards
Definition: Game.cs:155
Config config
Definition: Game.cs:215
static bool Has(string id)
Definition: LangGame.cs:46
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162
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:2200
PropsInstalled Installed
Definition: Map.cs:123
PropsManager props
Definition: Map.cs:91
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:6
Chara leader
Definition: Party.cs:30
bool HasElement(int ele)
Definition: Party.cs:168
List< Chara > members
Definition: Party.cs:18
int turns
Definition: Player.cs:84
int karma
Definition: Player.cs:801
Stats stats
Definition: Player.cs:936
Definition: Point.cs:9
ref Vector3 Position(int height)
Definition: Point.cs:536
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1377
bool IsBlocked
Definition: Point.cs:351
List< Thing > Things
Definition: Point.cs:326
bool Equals(int _x, int _z)
Definition: Point.cs:940
bool IsValid
Definition: Point.cs:88
int Distance(Point p)
Definition: Point.cs:969
bool IsInBounds
Definition: Point.cs:104
Cell cell
Definition: Point.cs:51
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1120
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
Definition: Point.cs:607
bool HasChara
Definition: Point.cs:226
bool IsHotSpring
Definition: Point.cs:363
bool IsDeepWater
Definition: Point.cs:264
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:753
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:357
Definition: Room.cs:4
Lot lot
Definition: Room.cs:21
virtual bool IsRegion
Definition: Spatial.cs:501
virtual void Mod(int a)
Definition: Stats.cs:135
override int GetPhase()
Definition: Stats.cs:117
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
Definition: TCText.cs:6
PopManager pop
Definition: TCText.cs:9
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
Thing Find(int uid)
bool IsFull(int y=0)
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
bool IsSharedContainer
Definition: Thing.cs:92
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:13
virtual bool CanRead(Chara c)
Definition: Trait.cs:960
virtual bool CanEat(Chara c)
Definition: Trait.cs:969
virtual bool CanDrink(Chara c)
Definition: Trait.cs:978
GameDate date
Definition: World.cs:6
Definition: Zone.cs:12
static int okaerinko
Definition: Zone.cs:31
virtual bool IsNefia
Definition: Zone.cs:280
FactionBranch branch
Definition: Zone.cs:34
Chara Boss
Definition: Zone.cs:83
virtual bool IsTown
Definition: Zone.cs:220
virtual bool PetFollow
Definition: Zone.cs:282
bool IsPCFaction
Definition: Zone.cs:466
virtual bool IsUnderwater
Definition: Zone.cs:264

References Lang._currency(), EClass._map, EClass._zone, Chara.ability, AreaData.accessType, Element.act, Chara.AddCondition(), Card.AddThing(), Chara.ai, TraitShackle.AllowTraining, ConfigTactics.AllyDistance(), Zone.Boss, EClass.Branch, Zone.branch, Card.c_isImportant, Card.c_uidMaster, AIAct.Cancel(), Trait.CanDrink(), Trait.CanEat(), Chara.CanEat(), TraitChara.CanFish, Trait.CanRead(), Chara.CanSee(), Chara.CanSeeLos(), card, Game.cards, Card.category, Card.Cell, Point.cell, Map.charas, Card.ChildrenAndSelfWeight, Chara.ClearInventory(), Game.config, ThingGen.Create(), ThingGen.CreateFromCategory(), Chara.Cuddle(), 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(), Card.elements, CoreDebug.enable, Card.encLV, Chara.enemy, Point.Equals(), Card.Evalue(), Card.ExistsOnMap, Chara.faction, Props.Find(), ThingContainer.Find(), Chara.FindBed(), Chara.FindBestFoodToEat(), Chara.FindMaster(), Chara.FindRoom(), Point.FindThing(), Point.ForeachNeighbor(), EClass.game, AI_Clean.GetCleanPoint(), Card.GetCurrency(), Chara.GetDestination(), AI_Fish.GetFishingPoint(), BaseCard.GetInt(), FactionBranch.GetMeal(), Point.GetNearestPoint(), Stats.GetPhase(), BaseArea.GetRandomPoint(), Date.GetRaw(), CardRenderer.GetTC(), CardManager.globalCharas, LangGame.Has(), Chara.HasAccess(), Point.HasChara, Chara.HasCondition(), Card.HasEditorTag(), Party.HasElement(), Card.HasElement(), Cell.HasFire, 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, Chara.InstantEat(), PolicyManager.IsActive(), Chara.IsAliveInCurrentZone, Point.IsBlocked, 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.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, Chara.isSynced, Cell.IsTopWaterAndNoSnow, Zone.IsTown, Point.IsValid, Los.IsVisible(), item, ActList.items, PopManager.items, Player.karma, AIAct.KeepRunning(), Party.leader, CharaAbility.list, ThingContainer.List(), Point.ListCharasInRadius(), Room.lot, Chara.mana, Chara.master, Stats.max, Chara.MaxHP, FactionBranch.members, Party.members, Chara.memberType, 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, 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, AIAct.Restart(), TraitManager.restSpots, EClass.rnd(), EClass.rndHalf(), Cell.room, Msg.Say(), Card.Say(), Chara.SetAI(), Chara.SetEnemy(), BaseCard.SetInt(), Chara.sharedCheckTurn, EClass.Sound, Chara.source, Element.source, 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.TryMoveTowards(), TryPerformIdleUse(), Chara.TryPutSharedItems(), AI_Shopping.TryRestock(), AI_Shopping.TryShop(), Chara.TryTakeSharedItems(), Chara.TryUse(), 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 891 of file AI_Idle.cs.

892 {
893 owner.Say("idle_cast", owner);
894 ActEffect.Proc(id, power, BlessedState.Normal, owner);
895 }
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:830

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 883 of file AI_Idle.cs.

883 : Condition
884 {
885 if (!owner.HasCondition<T>())
886 {
887 TryCast(id, power);
888 }
889 }

◆ TryPerformIdleUse()

bool AI_Idle.TryPerformIdleUse ( )
inline

Definition at line 948 of file AI_Idle.cs.

949 {
950 for (int i = 0; i < 10; i++)
951 {
952 Point randomPoint = owner.pos.GetRandomPoint(7, requireLos: true, allowChara: true, allowBlocked: true);
953 if (randomPoint == null || randomPoint.detail == null)
954 {
955 continue;
956 }
957 foreach (Thing thing in randomPoint.detail.things)
958 {
959 if (thing.IsInstalled)
960 {
961 int num = owner.Dist(thing);
962 if (EClass.rnd((owner.memberType == FactionMemberType.Guest) ? 5 : 50) == 0 && thing.HasTag(CTAG.tourism) && num <= 2)
963 {
964 owner.LookAt(thing);
965 owner.Talk("nice_statue");
966 return true;
967 }
968 if (EClass.rnd(thing.trait.IdleUseChance) == 0 && thing.trait.IdleUse(owner, num))
969 {
970 owner.LookAt(thing);
971 return true;
972 }
973 }
974 }
975 }
976 return false;
977 }
CTAG
Definition: CTAG.cs:2
bool HasTag(CTAG tag)
Definition: Card.cs:2531
List< Thing > things
Definition: CellDetail.cs:11
override void LookAt(Card c)
Definition: Chara.cs:3303
CellDetail detail
Definition: Point.cs:71
virtual int IdleUseChance
Definition: Trait.cs:360
virtual bool IdleUse(Chara c, int dist)
Definition: Trait.cs:638

References Point.detail, Point.GetRandomPoint(), Card.HasTag(), Trait.IdleUse(), Trait.IdleUseChance, Card.IsInstalled, EClass.rnd(), CellDetail.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.


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