Elin Decompiled Documentation EA 23.320 Nyaightly Patch 1
Loading...
Searching...
No Matches
CharaAbility Class Reference
Inheritance diagram for CharaAbility:
EClass

Public Member Functions

List< SourceElement.RowGetRandomAbilityList ()
 
 CharaAbility (Chara _owner)
 
void Refresh ()
 
void Add (int id, int chance, bool pt)
 
void AddRandom ()
 
void Remove (int id)
 
bool Has (int id)
 

Static Public Member Functions

static List< SourceElement.RowBuildRandomAbilityList (bool adv)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
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)
 

Public Attributes

Chara owner
 
ActList list = new ActList()
 

Static Public Attributes

static List< SourceElement.RowrandomAbilities = new List<SourceElement.Row>()
 
static List< SourceElement.RowrandomAbilitiesAdv = new List<SourceElement.Row>()
 
- Static Public Attributes inherited from EClass
static Core core
 

Additional Inherited Members

- 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]
 

Detailed Description

Definition at line 5 of file CharaAbility.cs.

Constructor & Destructor Documentation

◆ CharaAbility()

CharaAbility.CharaAbility ( Chara  _owner)
inline

Definition at line 73 of file CharaAbility.cs.

74 {
75 owner = _owner;
76 Refresh();
77 }
void Refresh()
Definition: CharaAbility.cs:79

References owner, and Refresh().

Member Function Documentation

◆ Add()

void CharaAbility.Add ( int  id,
int  chance,
bool  pt 
)
inline

Definition at line 164 of file CharaAbility.cs.

165 {
166 if (owner._listAbility == null)
167 {
168 owner._listAbility = new List<int>();
169 }
170 owner._listAbility.Add(id * ((!pt) ? 1 : (-1)));
171 if (owner.IsPC && owner.HasElement(1274))
172 {
173 Element element = owner.elements.GetElement(id);
174 if (element == null)
175 {
176 owner.elements.ModBase(id, 1);
177 }
178 else if (!(element is Spell))
179 {
180 element.vPotential = 0;
181 }
182 }
183 Refresh();
184 if (owner.IsPC)
185 {
187 }
188 }
ElementContainerCard elements
Definition: Card.cs:42
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6304
override bool IsPC
Definition: Chara.cs:630
List< int > _listAbility
Definition: Chara.cs:61
Element ModBase(int ele, int v)
Element GetElement(string alias)
static void Redraw()
Definition: SPELL.cs:630

References Chara._listAbility, Card.elements, ElementContainer.GetElement(), Card.HasElement(), Chara.IsPC, ElementContainer.ModBase(), owner, LayerAbility.Redraw(), and Refresh().

Referenced by DNA.Apply().

◆ AddRandom()

void CharaAbility.AddRandom ( )
inline

Definition at line 190 of file CharaAbility.cs.

191 {
192 if (owner._listAbility == null)
193 {
194 owner._listAbility = new List<int>();
195 }
196 owner._listAbility.Add(GetRandomAbilityList().RandomItemWeighted((SourceElement.Row e) => e.chance).id);
197 Refresh();
198 }
List< SourceElement.Row > GetRandomAbilityList()
Definition: CharaAbility.cs:56

References Chara._listAbility, GetRandomAbilityList(), owner, and Refresh().

Referenced by Zone.TryGenerateEvolved().

◆ BuildRandomAbilityList()

static List< SourceElement.Row > CharaAbility.BuildRandomAbilityList ( bool  adv)
inlinestatic

Definition at line 15 of file CharaAbility.cs.

16 {
17 List<SourceElement.Row> list = new List<SourceElement.Row>();
18 foreach (SourceElement.Row row in EClass.sources.elements.rows)
19 {
20 if (row.abilityType.Length == 0 || row.aliasRef == "mold")
21 {
22 continue;
23 }
24 switch (row.id)
25 {
26 case 5000:
27 case 5001:
28 case 5005:
29 case 5040:
30 case 5048:
31 case 6400:
32 case 6410:
33 case 6800:
34 case 8200:
35 continue;
36 }
37 if (row.idMold != 0 && !adv)
38 {
39 switch (row.aliasRef)
40 {
41 case "eleEther":
42 case "eleAcid":
43 case "eleCut":
44 case "eleImpact":
45 continue;
46 }
47 }
48 if (!row.tag.Contains("noRandomAbility"))
49 {
50 list.Add(row);
51 }
52 }
53 return list;
54 }
ActList list
Definition: CharaAbility.cs:13
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:43
SourceElement elements

References SourceManager.elements, list, and EClass.sources.

Referenced by GetRandomAbilityList().

◆ GetRandomAbilityList()

List< SourceElement.Row > CharaAbility.GetRandomAbilityList ( )
inline

Definition at line 56 of file CharaAbility.cs.

57 {
58 if (randomAbilities.Count == 0)
59 {
61 }
62 if (randomAbilitiesAdv.Count == 0)
63 {
65 }
66 if (!(owner.trait is TraitAdventurer))
67 {
68 return randomAbilities;
69 }
70 return randomAbilitiesAdv;
71 }
static List< SourceElement.Row > randomAbilities
Definition: CharaAbility.cs:7
static List< SourceElement.Row > randomAbilitiesAdv
Definition: CharaAbility.cs:9
static List< SourceElement.Row > BuildRandomAbilityList(bool adv)
Definition: CharaAbility.cs:15
new TraitChara trait
Definition: Chara.cs:509

References BuildRandomAbilityList(), owner, randomAbilities, randomAbilitiesAdv, and Chara.trait.

Referenced by AddRandom(), and Refresh().

◆ Has()

bool CharaAbility.Has ( int  id)
inline

Definition at line 222 of file CharaAbility.cs.

223 {
224 foreach (ActList.Item item in list.items)
225 {
226 if (item.act.id == id)
227 {
228 return true;
229 }
230 }
231 return false;
232 }
List< Item > items
Definition: ActList.cs:14

References item, ActList.items, and list.

Referenced by Element._WriteNote(), AI_Idle.Run(), LayerAbility.SelectGroup(), GoalCombat.TryUseAbility(), and Chara.UseAbility().

◆ Refresh()

void CharaAbility.Refresh ( )
inline

Definition at line 79 of file CharaAbility.cs.

80 {
81 this.list.items.Clear();
82 List<string> list = owner.source.actCombat.ToList();
83 bool flag = true;
84 for (int num = list.Count - 1; num >= 0; num--)
85 {
86 string text = list[num];
87 string text2 = text.Split('/')[0];
88 if (text2.IsEmpty())
89 {
90 list.RemoveAt(num);
91 flag = false;
92 }
93 else if (!EClass.sources.elements.alias.ContainsKey(text2) || !ACT.dict.ContainsKey(text2))
94 {
95 if (EClass.sources.elements.fuzzyAlias.TryGetValue(text2.Trim(), out var value) && ACT.dict.ContainsKey(value))
96 {
97 list[num] = text.Replace(text2, value);
98 }
99 else
100 {
101 list.RemoveAt(num);
102 ModUtil.LogModError("source chara row '" + owner.id + "' has invalid actCombat '" + text + "'", owner.source);
103 }
104 flag = false;
105 }
106 }
107 if (!flag)
108 {
109 owner.source.actCombat = list.ToArray();
110 }
111 foreach (string item in list)
112 {
113 string[] array = item.Split('/');
114 this.list.items.Add(new ActList.Item
115 {
116 act = ACT.dict[ConvertID(array[0])],
117 chance = ((array.Length > 1) ? array[1].ToInt() : 100),
118 pt = (array.Length > 2)
119 });
120 }
121 if (owner.trait.MaxRandomAbility > 0 && owner._listAbility == null)
122 {
123 int num2 = owner.trait.MaxRandomAbility + EClass.rnd(2) - this.list.items.Count;
124 if (num2 > 1)
125 {
126 owner._listAbility = new List<int>();
127 for (int i = 0; i < num2; i++)
128 {
129 owner._listAbility.Add(GetRandomAbilityList().RandomItemWeighted((SourceElement.Row e) => e.chance).id);
130 }
131 }
132 }
133 if (owner._listAbility == null)
134 {
135 return;
136 }
137 foreach (int item2 in owner._listAbility)
138 {
139 string text3 = EClass.sources.elements.map.TryGetValue(Mathf.Abs(item2))?.alias;
140 if (!text3.IsEmpty())
141 {
142 this.list.items.Add(new ActList.Item
143 {
144 act = ACT.dict[text3],
145 chance = 50,
146 pt = (item2 < 0)
147 });
148 }
149 }
150 string ConvertID(string s)
151 {
153 {
154 return s;
155 }
156 if (EClass.sources.elements.alias[s].aliasRef == "mold")
157 {
158 return s + owner.MainElement.source.alias.Replace("ele", "");
159 }
160 return s;
161 }
162 }
Definition: ACT.cs:6
static Dictionary< string, Act > dict
Definition: ACT.cs:23
string id
Definition: Card.cs:36
Element MainElement
Definition: Chara.cs:735
SourceChara.Row source
Definition: Chara.cs:162
static int rnd(long a)
Definition: EClass.cs:59
SourceElement.Row source
Definition: ELEMENT.cs:280
static Element Void
Definition: ELEMENT.cs:245
Dictionary< string, string > fuzzyAlias
virtual int MaxRandomAbility
Definition: TraitChara.cs:98

References Chara._listAbility, ACT.dict, SourceManager.elements, SourceElement.fuzzyAlias, GetRandomAbilityList(), Card.id, item, ActList.items, list, Chara.MainElement, TraitChara.MaxRandomAbility, owner, EClass.rnd(), Chara.source, Element.source, EClass.sources, Chara.trait, and Element.Void.

Referenced by Add(), AddRandom(), CharaAbility(), and Remove().

◆ Remove()

void CharaAbility.Remove ( int  id)
inline

Definition at line 200 of file CharaAbility.cs.

201 {
202 owner._listAbility.Remove(id);
203 if (owner.IsPC && owner.HasElement(1274) && owner.HasElement(id) && owner._listAbility.IndexOf(id) == -1)
204 {
205 Element element = EClass.pc.elements.GetElement(id);
206 if (!(element is Spell))
207 {
208 element.vPotential = -1;
209 }
210 }
211 if (owner._listAbility.Count == 0)
212 {
213 owner._listAbility = null;
214 }
215 Refresh();
216 if (owner.IsPC)
217 {
219 }
220 }
static Chara pc
Definition: EClass.cs:15

References Chara._listAbility, Card.elements, ElementContainer.GetElement(), Card.HasElement(), Chara.IsPC, owner, EClass.pc, LayerAbility.Redraw(), and Refresh().

Referenced by DNA.Apply().

Member Data Documentation

◆ list

◆ owner

Chara CharaAbility.owner

Definition at line 11 of file CharaAbility.cs.

Referenced by Add(), AddRandom(), CharaAbility(), GetRandomAbilityList(), Refresh(), and Remove().

◆ randomAbilities

List<SourceElement.Row> CharaAbility.randomAbilities = new List<SourceElement.Row>()
static

Definition at line 7 of file CharaAbility.cs.

Referenced by GetRandomAbilityList().

◆ randomAbilitiesAdv

List<SourceElement.Row> CharaAbility.randomAbilitiesAdv = new List<SourceElement.Row>()
static

Definition at line 9 of file CharaAbility.cs.

Referenced by GetRandomAbilityList().


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