Elin Decompiled Documentation EA 23.286 Nightly Patch 1
Loading...
Searching...
No Matches
ActRide.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2
3public class ActRide : Ability
4{
5 public virtual bool IsParasite => false;
6
7 public override bool Perform()
8 {
10 {
12 return false;
13 }
14 List<Chara> list = Act.TP.ListCharas();
15 list.Reverse();
16 bool flag = false;
17 foreach (Chara item in list)
18 {
19 if (item.host != null || item.IsMultisize)
20 {
21 continue;
22 }
23 if (item == Act.CC)
24 {
25 if ((IsParasite && Act.CC.parasite != null) || (!IsParasite && Act.CC.ride != null))
26 {
28 flag = true;
29 break;
30 }
31 continue;
32 }
33 if (!item.trait.CanJoinPartyResident)
34 {
35 Msg.Say("ride_req");
36 return false;
37 }
38 if (item.memberType == FactionMemberType.Default && (EClass.debug.enable || (item.IsPCFaction && item.trait.CanJoinParty)))
39 {
41 flag = true;
42 break;
43 }
44 }
45 if (!flag)
46 {
47 Msg.Say("noTargetFound");
48 }
49 return false;
50 }
51
52 public static void Ride(Chara host, Chara t, bool parasite = false, bool talk = true)
53 {
54 if (parasite)
55 {
56 if (host.parasite != null)
57 {
58 Unride(host, parasite: true);
59 }
60 host.parasite = t;
61 host.Say("parasite", host, t);
62 }
63 else
64 {
65 if (host.ride != null)
66 {
67 Unride(host);
68 }
69 host.ride = t;
70 host.Say("ride", host, t);
71 }
72 if (!t.IsPCFaction)
73 {
74 t.MakeAlly();
75 }
77 if (!parasite)
78 {
79 if (t.race.tag.Contains("ride"))
80 {
81 Msg.Say("ride_good");
82 }
83 if (t.race.tag.Contains("noRide"))
84 {
85 Msg.Say("ride_bad");
86 }
87 if (host.HasElement(1417) && t.HasCondition<ConTransmuteBroom>())
88 {
89 Msg.Say("ride_broom");
90 }
91 }
92 t.host = host;
94 if (talk)
95 {
96 host.PlaySound("ride");
97 t.Talk(parasite ? "parasite" : "ride");
98 }
99 host.SetDirtySpeed();
100 t.SetDirtySpeed();
101 host.SyncRide();
102 t.noMove = false;
103 host.Refresh();
105 }
106
107 public static void Unride(Chara host, Chara mount, bool talk = true)
108 {
109 if (host != null && (host.parasite == mount || host.ride == mount))
110 {
111 Unride(host, host.parasite == mount, talk);
112 }
113 }
114
115 public static void Unride(Chara host, bool parasite = false, bool talk = true)
116 {
117 Chara chara = null;
118 if (parasite)
119 {
120 chara = host.parasite;
121 host.parasite = null;
122 host.Say("parasite_unride", host, chara);
123 }
124 else
125 {
126 chara = host.ride;
127 host.ride = null;
128 host.Say("ride_unride", host, chara);
129 }
130 chara.host = null;
131 chara._CreateRenderer();
132 if (talk)
133 {
134 chara.Talk(parasite ? "parasite_unride" : "ride_unride", null, null, forceSync: true);
135 }
136 host.PlaySound("ride");
137 host.SetDirtySpeed();
138 chara.SetDirtySpeed();
139 host.Refresh();
140 Point randomPoint = host.pos.GetRandomPoint(1);
141 if (randomPoint != null)
142 {
143 chara.MoveImmediate(randomPoint);
144 }
146 }
147}
FactionMemberType
virtual bool IsParasite
Definition: ActRide.cs:5
static void Ride(Chara host, Chara t, bool parasite=false, bool talk=true)
Definition: ActRide.cs:52
override bool Perform()
Definition: ActRide.cs:7
static void Unride(Chara host, bool parasite=false, bool talk=true)
Definition: ActRide.cs:115
static void Unride(Chara host, Chara mount, bool talk=true)
Definition: ActRide.cs:107
Definition: ACT.cs:62
static Point TP
Definition: ACT.cs:81
static Chara CC
Definition: ACT.cs:77
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6375
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6935
Point pos
Definition: Card.cs:60
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5935
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6122
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7052
Definition: Chara.cs:10
void Refresh(bool calledRecursive=false)
Definition: Chara.cs:1759
void SetDirtySpeed()
Definition: Chara.cs:1896
Party party
Definition: Chara.cs:43
bool HasCondition(string alias)
Definition: Chara.cs:9612
override CardRenderer _CreateRenderer()
Definition: Chara.cs:6786
override bool IsPCFaction
Definition: Chara.cs:685
void MakeAlly(bool msg=true)
Definition: Chara.cs:2337
Chara parasite
Definition: Chara.cs:30
Chara ride
Definition: Chara.cs:27
void SyncRide()
Definition: Chara.cs:4001
SourceRace.Row race
Definition: Chara.cs:466
bool enable
Definition: CoreDebug.cs:286
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:21
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
Definition: Msg.cs:5
static string SayInvalidAction()
Definition: Msg.cs:106
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
void AddMemeber(Chara c, bool showMsg=false)
Definition: Party.cs:57
Definition: Point.cs:9
List< Chara > ListCharas()
Definition: Point.cs:1171
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:769
static void SetDirty()