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

Public Member Functions

override bool CanManualCancel ()
 
override IEnumerable< StatusRun ()
 
Point GetPoint (int d, bool onlyValid=true)
 
int GetNextDir ()
 
Status Stop (Action action=null)
 
override void OnCancel ()
 
- 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)
 
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

TraitTrolley trolley
 
bool running
 
- 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
 

Static Public Attributes

static int[][] DirList
 
static Vector2Int[] VecList
 
- 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 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
 

Properties

int dir [get]
 
override bool CancelWhenDamaged [get]
 
override bool CancelWhenMoved [get]
 
override bool CancelOnAggro [get]
 
override bool ShowCursor [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]
 

Additional Inherited Members

- Public Types inherited from AIAct
enum  Status { Running , Fail , Success }
 
- Public Types inherited from Act
enum  CostType { None , MP , SP }
 
- 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 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)
 

Detailed Description

Definition at line 5 of file AI_Trolley.cs.

Member Function Documentation

◆ CanManualCancel()

override bool AI_Trolley.CanManualCancel ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 51 of file AI_Trolley.cs.

52 {
53 return true;
54 }

◆ GetNextDir()

int AI_Trolley.GetNextDir ( )
inline

Definition at line 123 of file AI_Trolley.cs.

124 {
125 int[] array = DirList[dir];
126 for (int i = 0; i < 3 + ((!running) ? 1 : 0); i++)
127 {
128 int num = array[i];
129 if (GetPoint(num) != null)
130 {
131 return num;
132 }
133 }
134 return -1;
135 }
bool running
Definition: AI_Trolley.cs:25
Point GetPoint(int d, bool onlyValid=true)
Definition: AI_Trolley.cs:100
static int[][] DirList
Definition: AI_Trolley.cs:7

References dir, DirList, GetPoint(), and running.

Referenced by Run().

◆ GetPoint()

Point AI_Trolley.GetPoint ( int  d,
bool  onlyValid = true 
)
inline

Definition at line 100 of file AI_Trolley.cs.

101 {
102 Point point = new Point();
103 Point pos = trolley.owner.pos;
104 point.Set(pos.x + VecList[d].x, pos.z + VecList[d].y);
105 if (!point.IsValid || !point.IsInBounds || !point.HasRail || point.IsBlocked)
106 {
107 return null;
108 }
109 foreach (Thing thing in point.Things)
110 {
111 if (!thing.IsMultisize)
112 {
113 return null;
114 }
115 }
116 if (EClass.pc.pos.Equals(point))
117 {
118 return null;
119 }
120 return point;
121 }
static Vector2Int[] VecList
Definition: AI_Trolley.cs:15
TraitTrolley trolley
Definition: AI_Trolley.cs:23
virtual bool IsMultisize
Definition: Card.cs:2034
Point pos
Definition: Card.cs:55
Definition: EClass.cs:5
static Chara pc
Definition: EClass.cs:14
Definition: Point.cs:9
Point Set(int _x, int _z)
Definition: Point.cs:479
bool HasRail
Definition: Point.cs:133
bool IsBlocked
Definition: Point.cs:339
List< Thing > Things
Definition: Point.cs:314
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool Equals(int _x, int _z)
Definition: Point.cs:924
bool IsValid
Definition: Point.cs:88
bool IsInBounds
Definition: Point.cs:104
Definition: Thing.cs:8
Card owner
Definition: Trait.cs:26

References Point.Equals(), Point.HasRail, Point.IsBlocked, Point.IsInBounds, Card.IsMultisize, Point.IsValid, Trait.owner, EClass.pc, Card.pos, Point.Set(), trolley, VecList, Point.x, and Point.z.

Referenced by GetNextDir(), and Run().

◆ OnCancel()

override void AI_Trolley.OnCancel ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 147 of file AI_Trolley.cs.

148 {
149 Stop();
150 }
Status Stop(Action action=null)
Definition: AI_Trolley.cs:137

References Stop().

◆ Run()

override IEnumerable< Status > AI_Trolley.Run ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 56 of file AI_Trolley.cs.

57 {
58 owner.Say("ride", owner, trolley.owner);
59 if (!trolley.HideChara)
60 {
61 owner.Talk("ride2");
62 }
63 while (true)
64 {
65 int nextDir = GetNextDir();
66 if (!trolley.owner.ExistsOnMap || nextDir == -1)
67 {
68 yield return Stop();
69 }
70 if (owner.rarity >= Rarity.Legendary && owner.FindNearestNewEnemy())
71 {
72 yield return Stop();
73 }
74 trolley.owner.dir = nextDir;
75 Point point = GetPoint(dir);
76 owner.SetDir(nextDir);
77 owner.PlayAnime(AnimeID.Truck);
78 string idSound = trolley.GetIdSound();
79 if (owner.IsPC)
80 {
81 owner.PlaySound(idSound);
82 }
83 else if (!(EClass.pc.ai is AI_Trolley))
84 {
85 owner.PlaySound(idSound);
86 EClass.Sound.Stop(idSound, Mathf.Max(1f, trolley.FadeDuration));
87 }
88 foreach (Chara item in point.ListCharas())
89 {
90 owner.Kick(item, ignoreSelf: true, karmaLoss: false);
91 }
92 EClass._map.MoveCard(point, owner);
95 running = true;
96 yield return KeepRunning();
97 }
98 }
AnimeID
Definition: AnimeID.cs:2
Rarity
Definition: Rarity.cs:2
new Chara owner
Definition: AIAct.cs:14
Status KeepRunning()
Definition: AIAct.cs:321
int GetNextDir()
Definition: AI_Trolley.cs:123
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:5949
Rarity rarity
Definition: Card.cs:298
bool ExistsOnMap
Definition: Card.cs:1961
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5127
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:5423
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Definition: Chara.cs:10
AIAct ai
Definition: Chara.cs:187
override bool IsPC
Definition: Chara.cs:597
void Kick(Point p, bool ignoreSelf=false)
Definition: Chara.cs:5174
override void SetDir(int d)
Definition: Chara.cs:3198
bool FindNearestNewEnemy()
Definition: Chara.cs:5869
static Map _map
Definition: EClass.cs:18
static SoundManager Sound
Definition: EClass.cs:46
void MoveCard(Point p, Card t)
Definition: Map.cs:835
List< Chara > ListCharas()
Definition: Point.cs:1135
virtual string GetIdSound()
Definition: TraitTrolley.cs:65
virtual float FadeDuration
Definition: TraitTrolley.cs:18
virtual bool HideChara
Definition: TraitTrolley.cs:3

References EClass._map, Chara.ai, dir, Card.ExistsOnMap, TraitTrolley.FadeDuration, Chara.FindNearestNewEnemy(), TraitTrolley.GetIdSound(), GetNextDir(), GetPoint(), TraitTrolley.HideChara, Chara.IsPC, item, AIAct.KeepRunning(), Chara.Kick(), Map.MoveCard(), Card.MoveImmediate(), AIAct.owner, Trait.owner, EClass.pc, Card.PlayAnime(), Card.PlaySound(), Card.rarity, running, Card.Say(), Chara.SetDir(), EClass.Sound, Stop(), Card.Talk(), and trolley.

◆ Stop()

Status AI_Trolley.Stop ( Action  action = null)
inline

Definition at line 137 of file AI_Trolley.cs.

138 {
140 if (owner != null)
141 {
142 owner.Say("ride_unride", owner, trolley.owner);
143 }
144 return Success();
145 }

References TraitTrolley.FadeDuration, TraitTrolley.GetIdSound(), AIAct.owner, Trait.owner, Card.Say(), EClass.Sound, AIAct.Success, and trolley.

Referenced by OnCancel(), and Run().

Member Data Documentation

◆ DirList

int [][] AI_Trolley.DirList
static
Initial value:
= new int[4][]
{
new int[4] { 0, 1, 3, 2 },
new int[4] { 1, 0, 2, 3 },
new int[4] { 2, 1, 3, 0 },
new int[4] { 3, 2, 0, 1 }
}

Definition at line 7 of file AI_Trolley.cs.

Referenced by GetNextDir().

◆ running

bool AI_Trolley.running

Definition at line 25 of file AI_Trolley.cs.

Referenced by GetNextDir(), and Run().

◆ trolley

TraitTrolley AI_Trolley.trolley

Definition at line 23 of file AI_Trolley.cs.

Referenced by TraitTrolley.CanActivate(), BaseTileMap.DrawTile(), GetPoint(), Run(), and Stop().

◆ VecList

Vector2Int [] AI_Trolley.VecList
static
Initial value:
= new Vector2Int[4]
{
new Vector2Int(0, -1),
new Vector2Int(1, 0),
new Vector2Int(0, 1),
new Vector2Int(-1, 0)
}

Definition at line 15 of file AI_Trolley.cs.

Referenced by GetPoint().

Property Documentation

◆ CancelOnAggro

override bool AI_Trolley.CancelOnAggro
get

Definition at line 47 of file AI_Trolley.cs.

◆ CancelWhenDamaged

override bool AI_Trolley.CancelWhenDamaged
get

Definition at line 29 of file AI_Trolley.cs.

30 {
31 get
32 {
33 if (owner != null)
34 {
35 if (owner.IsPC)
36 {
37 return owner.hp < owner.MaxHP / 3;
38 }
39 return true;
40 }
41 return false;
42 }
43 }

◆ CancelWhenMoved

override bool AI_Trolley.CancelWhenMoved
get

Definition at line 45 of file AI_Trolley.cs.

◆ dir

int AI_Trolley.dir
get

Definition at line 27 of file AI_Trolley.cs.

Referenced by GetNextDir(), and Run().

◆ ShowCursor

override bool AI_Trolley.ShowCursor
get

Definition at line 49 of file AI_Trolley.cs.


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