Elin Decompiled Documentation EA 23.153 Nightly
Loading...
Searching...
No Matches
Party.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using Newtonsoft.Json;
3using UnityEngine;
4
5public class Party : EClass
6{
7 [JsonProperty]
8 public int uidLeader;
9
10 [JsonProperty]
11 public List<int> uidMembers = new List<int>();
12
13 public List<Chara> _members;
14
15 public RefChara refLeader = new RefChara();
16
17 public List<Chara> members
18 {
19 get
20 {
21 if (_members != null)
22 {
23 return _members;
24 }
25 return SetMembers();
26 }
27 }
28
30 {
31 get
32 {
34 }
35 set
36 {
37 refLeader.Set(ref uidLeader, value);
38 }
39 }
40
41 public List<Chara> SetMembers()
42 {
43 _members = new List<Chara>();
44 HashSet<int> hashSet = new HashSet<int>();
45 foreach (int uidMember in uidMembers)
46 {
47 if (!hashSet.Contains(uidMember))
48 {
49 hashSet.Add(uidMember);
50 members.Add(RefChara.Get(uidMember));
51 }
52 }
53 return _members;
54 }
55
56 public void AddMemeber(Chara c, bool showMsg = false)
57 {
58 if (c.party == this)
59 {
60 return;
61 }
62 if (!c.IsGlobal)
63 {
64 Debug.LogError("exception: " + c?.ToString() + " is not global chara");
65 }
66 members.Add(c);
67 uidMembers.Add(c.uid);
68 c.party = this;
69 c.isSale = false;
70 c.SetBool(18, enable: false);
71 if (c.homeBranch != null)
72 {
76 if (c.homeBranch.owner.map != null)
77 {
78 c.homeBranch.owner.map.props.sales.Remove(c);
79 }
80 }
81 if (showMsg)
82 {
83 Msg.Say("party_join", c.Name);
84 SE.Play("party_join");
85 }
87 }
88
89 public void RemoveMember(Chara c)
90 {
91 if (c.host != null)
92 {
93 ActRide.Unride(c.host, c.host.parasite == c);
94 }
95 members.Remove(c);
96 uidMembers.Remove(c.uid);
97 c.party = null;
98 c.c_wasInPcParty = false;
99 c.SetDirtySpeed();
100 if (c.homeBranch != null)
101 {
104 }
106 }
107
108 public void Replace(Chara c, int index)
109 {
110 members.Remove(c);
111 uidMembers.Remove(c.uid);
112 members.Insert(index, c);
113 uidMembers.Insert(index, c.uid);
114 }
115
116 public void SetLeader(Chara c)
117 {
118 leader = c;
119 }
120
121 public Element GetPartySkill(int ele)
122 {
123 return GetBestSkill(ele);
124 }
125
126 public void ModExpPartySkill(int ele, int a)
127 {
128 }
129
130 public Element GetBestSkill(int ele)
131 {
132 Element element = Element.Create(ele);
133 foreach (Chara member in members)
134 {
135 if (member.IsAliveInCurrentZone && member.Evalue(ele) > element.Value)
136 {
137 element = member.elements.GetElement(ele);
138 }
139 }
140 return element;
141 }
142
143 public bool IsCriticallyWounded(bool includePc = false)
144 {
145 foreach (Chara member in members)
146 {
147 if ((!includePc || !member.IsPC) && member.IsCriticallyWounded())
148 {
149 return true;
150 }
151 }
152 return false;
153 }
154
155 public int EValue(int ele)
156 {
157 int num = 0;
158 foreach (Chara member in members)
159 {
160 if (member.Evalue(ele) > num)
161 {
162 num = member.Evalue(ele);
163 }
164 }
165 return num;
166 }
167
168 public bool HasElement(int ele)
169 {
170 foreach (Chara member in members)
171 {
172 if (member.HasElement(ele))
173 {
174 return true;
175 }
176 }
177 return false;
178 }
179
180 public int Count()
181 {
182 int num = 0;
183 foreach (Chara member in members)
184 {
185 if (!member.isDead)
186 {
187 num++;
188 }
189 }
190 return num;
191 }
192}
static void Unride(Chara host, Chara mount, bool talk=true)
Definition: ActRide.cs:101
void SetBool(int id, bool enable)
Definition: BaseCard.cs:20
ElementContainerCard elements
Definition: Card.cs:37
bool HasElement(int ele, int req=1)
Definition: Card.cs:5566
string Name
Definition: Card.cs:2073
int uid
Definition: Card.cs:118
int Evalue(int ele)
Definition: Card.cs:2507
Definition: Chara.cs:10
override bool IsAliveInCurrentZone
Definition: Chara.cs:557
void SetDirtySpeed()
Definition: Chara.cs:1659
bool IsCriticallyWounded(bool includeRide=false)
Definition: Chara.cs:1029
void RefreshWorkElements(ElementContainer parent=null)
Definition: Chara.cs:8319
override bool IsPC
Definition: Chara.cs:608
Chara host
Definition: Chara.cs:33
override bool IsGlobal
Definition: Chara.cs:606
Party party
Definition: Chara.cs:43
Chara parasite
Definition: Chara.cs:30
FactionBranch homeBranch
Definition: Chara.cs:932
bool isDead
Definition: Chara.cs:385
Definition: EClass.cs:5
Element GetElement(string alias)
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1097
void RefreshEfficiency()
PolicyManager policies
ElementContainerZone elements
PropsManager props
Definition: Map.cs:91
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
Element GetBestSkill(int ele)
Definition: Party.cs:130
int uidLeader
Definition: Party.cs:8
Element GetPartySkill(int ele)
Definition: Party.cs:121
List< Chara > _members
Definition: Party.cs:13
RefChara refLeader
Definition: Party.cs:15
List< Chara > SetMembers()
Definition: Party.cs:41
List< int > uidMembers
Definition: Party.cs:11
void Replace(Chara c, int index)
Definition: Party.cs:108
void RemoveMember(Chara c)
Definition: Party.cs:89
int Count()
Definition: Party.cs:180
bool IsCriticallyWounded(bool includePc=false)
Definition: Party.cs:143
Chara leader
Definition: Party.cs:30
bool HasElement(int ele)
Definition: Party.cs:168
void ModExpPartySkill(int ele, int a)
Definition: Party.cs:126
List< Chara > members
Definition: Party.cs:18
int EValue(int ele)
Definition: Party.cs:155
void AddMemeber(Chara c, bool showMsg=false)
Definition: Party.cs:56
void SetLeader(Chara c)
Definition: Party.cs:116
List< Card > sales
Definition: PropsManager.cs:14
static Chara Get(int uid)
Definition: RefChara.cs:36
Chara GetAndCache(int uid)
Definition: RefChara.cs:5
void Set(ref int val, Chara c)
Definition: RefChara.cs:30
static void SetDirty()
Map map
Definition: Zone.cs:60