Elin Decompiled Documentation EA 23.187 Stable
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 {
9 List<Chara> list = Act.TP.ListCharas();
10 list.Reverse();
11 bool flag = false;
12 foreach (Chara item in list)
13 {
14 if (item.host != null || item.IsMultisize)
15 {
16 continue;
17 }
18 if (item == Act.CC)
19 {
20 if ((IsParasite && Act.CC.parasite != null) || (!IsParasite && Act.CC.ride != null))
21 {
23 flag = true;
24 break;
25 }
26 continue;
27 }
28 if (!item.trait.CanJoinPartyResident)
29 {
30 Msg.Say("ride_req");
31 return false;
32 }
33 if (item.memberType == FactionMemberType.Default && (EClass.debug.enable || (item.IsPCFaction && item.trait.CanJoinParty)))
34 {
36 flag = true;
37 break;
38 }
39 }
40 if (!flag)
41 {
42 Msg.Say("noTargetFound");
43 }
44 return false;
45 }
46
47 public static void Ride(Chara host, Chara t, bool parasite = false, bool talk = true)
48 {
49 if (parasite)
50 {
51 if (host.parasite != null)
52 {
53 Unride(host, parasite: true);
54 }
55 host.parasite = t;
56 host.Say("parasite", host, t);
57 }
58 else
59 {
60 if (host.ride != null)
61 {
62 Unride(host);
63 }
64 host.ride = t;
65 host.Say("ride", host, t);
66 }
67 if (!t.IsPCFaction)
68 {
69 t.MakeAlly();
70 }
72 if (!parasite)
73 {
74 if (t.race.tag.Contains("ride"))
75 {
76 Msg.Say("ride_good");
77 }
78 if (t.race.tag.Contains("noRide"))
79 {
80 Msg.Say("ride_bad");
81 }
82 if (host.HasElement(1417) && t.HasCondition<ConTransmuteBroom>())
83 {
84 Msg.Say("ride_broom");
85 }
86 }
87 t.host = host;
89 if (talk)
90 {
91 host.PlaySound("ride");
92 t.Talk(parasite ? "parasite" : "ride");
93 }
94 host.SetDirtySpeed();
95 t.SetDirtySpeed();
96 host.SyncRide();
97 t.noMove = false;
98 host.Refresh();
100 }
101
102 public static void Unride(Chara host, Chara mount, bool talk = true)
103 {
104 if (host != null && (host.parasite == mount || host.ride == mount))
105 {
106 Unride(host, host.parasite == mount, talk);
107 }
108 }
109
110 public static void Unride(Chara host, bool parasite = false, bool talk = true)
111 {
112 Chara chara = null;
113 if (parasite)
114 {
115 chara = host.parasite;
116 host.parasite = null;
117 host.Say("parasite_unride", host, chara);
118 }
119 else
120 {
121 chara = host.ride;
122 host.ride = null;
123 host.Say("ride_unride", host, chara);
124 }
125 chara.host = null;
126 chara._CreateRenderer();
127 if (talk)
128 {
129 chara.Talk(parasite ? "parasite_unride" : "ride_unride", null, null, forceSync: true);
130 }
131 host.PlaySound("ride");
132 host.SetDirtySpeed();
133 chara.SetDirtySpeed();
134 host.Refresh();
135 Point randomPoint = host.pos.GetRandomPoint(1);
136 if (randomPoint != null)
137 {
138 chara.MoveImmediate(randomPoint);
139 }
141 }
142}
FactionMemberType
virtual bool IsParasite
Definition: ActRide.cs:5
static void Ride(Chara host, Chara t, bool parasite=false, bool talk=true)
Definition: ActRide.cs:47
override bool Perform()
Definition: ActRide.cs:7
static void Unride(Chara host, bool parasite=false, bool talk=true)
Definition: ActRide.cs:110
static void Unride(Chara host, Chara mount, bool talk=true)
Definition: ActRide.cs:102
Definition: ACT.cs:62
static Point TP
Definition: ACT.cs:81
static Chara CC
Definition: ACT.cs:77
bool HasElement(int ele, int req=1)
Definition: Card.cs:5638
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5852
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6402
Point pos
Definition: Card.cs:57
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5551
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6499
Definition: Chara.cs:10
void Refresh(bool calledRecursive=false)
Definition: Chara.cs:1699
void SetDirtySpeed()
Definition: Chara.cs:1806
Party party
Definition: Chara.cs:43
bool HasCondition(string alias)
Definition: Chara.cs:8985
override CardRenderer _CreateRenderer()
Definition: Chara.cs:6336
override bool IsPCFaction
Definition: Chara.cs:669
void MakeAlly(bool msg=true)
Definition: Chara.cs:2223
Chara parasite
Definition: Chara.cs:30
Chara ride
Definition: Chara.cs:27
void SyncRide()
Definition: Chara.cs:3817
SourceRace.Row race
Definition: Chara.cs:462
bool enable
Definition: CoreDebug.cs:286
Definition: EClass.cs:5
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
Definition: Msg.cs:5
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:56
Definition: Point.cs:9
List< Chara > ListCharas()
Definition: Point.cs:1155
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:757
static void SetDirty()