Elin Decompiled Documentation EA 23.102 Nightly
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();
99 }
100
101 public static void Unride(Chara host, bool parasite = false, bool talk = true)
102 {
103 Chara chara = null;
104 if (parasite)
105 {
106 chara = host.parasite;
107 host.parasite = null;
108 host.Say("parasite_unride", host, chara);
109 }
110 else
111 {
112 chara = host.ride;
113 host.ride = null;
114 host.Say("ride_unride", host, chara);
115 }
116 chara.host = null;
117 chara._CreateRenderer();
118 if (talk)
119 {
120 chara.Talk(parasite ? "parasite_unride" : "ride_unride", null, null, forceSync: true);
121 }
122 host.PlaySound("ride");
123 host.SetDirtySpeed();
124 chara.SetDirtySpeed();
125 host.Refresh();
126 Point randomPoint = host.pos.GetRandomPoint(1);
127 if (randomPoint != null)
128 {
129 chara.MoveImmediate(randomPoint);
130 }
131 }
132}
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:101
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:5214
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
Point pos
Definition: Card.cs:55
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5127
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Definition: Chara.cs:10
void Refresh(bool calledRecursive=false)
Definition: Chara.cs:1504
void SetDirtySpeed()
Definition: Chara.cs:1605
Party party
Definition: Chara.cs:43
bool HasCondition(string alias)
Definition: Chara.cs:8568
override CardRenderer _CreateRenderer()
Definition: Chara.cs:5993
override bool IsPCFaction
Definition: Chara.cs:656
void MakeAlly(bool msg=true)
Definition: Chara.cs:2004
Chara parasite
Definition: Chara.cs:30
Chara ride
Definition: Chara.cs:27
void SyncRide()
Definition: Chara.cs:3559
SourceRace.Row race
Definition: Chara.cs:449
bool enable
Definition: CoreDebug.cs:285
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:51
Definition: Point.cs:9
List< Chara > ListCharas()
Definition: Point.cs:1135
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:741