Elin Modding Docs Doc
Loading...
Searching...
No Matches
CharaAbility.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using UnityEngine;
5
6// Token: 0x020002A4 RID: 676
7public class CharaAbility : EClass
8{
9 // Token: 0x060015F3 RID: 5619 RVA: 0x0009462E File Offset: 0x0009282E
10 public CharaAbility(Chara _owner)
11 {
12 this.owner = _owner;
13 this.Refresh();
14 }
15
16 // Token: 0x060015F4 RID: 5620 RVA: 0x00094650 File Offset: 0x00092850
17 public void Refresh()
18 {
19 this.list.items.Clear();
20 string[] actCombat = this.owner.source.actCombat;
21 for (int i = 0; i < actCombat.Length; i++)
22 {
23 string[] array = actCombat[i].Split('/', StringSplitOptions.None);
24 this.list.items.Add(new ActList.Item
25 {
26 act = ACT.dict[this.<Refresh>g__ConvertID|4_0(array[0])],
27 chance = ((array.Length > 1) ? array[1].ToInt() : 100),
28 pt = (array.Length > 2)
29 });
30 }
31 if (this.owner.trait.UseRandomAbility && this.owner._listAbility == null)
32 {
33 int num = 3 + EClass.rnd(2) - this.list.items.Count;
34 if (num > 1)
35 {
36 if (CharaAbility.randomAbilities.Count == 0)
37 {
38 this.BuildRandomAbilityList();
39 }
40 this.owner._listAbility = new List<int>();
41 for (int j = 0; j < num; j++)
42 {
43 this.owner._listAbility.Add(CharaAbility.randomAbilities.RandomItemWeighted((SourceElement.Row e) => (float)e.chance).id);
44 }
45 }
46 }
47 if (this.owner._listAbility != null)
48 {
49 foreach (int num2 in this.owner._listAbility)
50 {
51 string alias = EClass.sources.elements.map[Mathf.Abs(num2)].alias;
52 this.list.items.Add(new ActList.Item
53 {
54 act = ACT.dict[alias],
55 chance = 50,
56 pt = (num2 < 0)
57 });
58 }
59 }
60 }
61
62 // Token: 0x060015F5 RID: 5621 RVA: 0x00094854 File Offset: 0x00092A54
63 public void BuildRandomAbilityList()
64 {
65 foreach (SourceElement.Row row in EClass.sources.elements.rows)
66 {
67 if (row.abilityType.Length != 0 && !(row.aliasRef == "mold"))
68 {
69 int id = row.id;
70 if (id <= 5040)
71 {
72 if (id - 5000 <= 1 || id == 5005 || id == 5040)
73 {
74 continue;
75 }
76 }
77 else if (id <= 6400)
78 {
79 if (id == 5048 || id == 6400)
80 {
81 continue;
82 }
83 }
84 else if (id == 6410 || id == 8200)
85 {
86 continue;
87 }
88 CharaAbility.randomAbilities.Add(row);
89 }
90 }
91 }
92
93 // Token: 0x060015F6 RID: 5622 RVA: 0x0009492C File Offset: 0x00092B2C
94 public void Add(int id, int chance, bool pt)
95 {
96 if (this.owner._listAbility == null)
97 {
98 this.owner._listAbility = new List<int>();
99 }
100 this.owner._listAbility.Add(id * (pt ? -1 : 1));
101 this.Refresh();
102 }
103
104 // Token: 0x060015F7 RID: 5623 RVA: 0x0009496C File Offset: 0x00092B6C
105 public void AddRandom()
106 {
107 if (this.owner._listAbility == null)
108 {
109 this.owner._listAbility = new List<int>();
110 }
111 if (CharaAbility.randomAbilities.Count == 0)
112 {
113 this.BuildRandomAbilityList();
114 }
115 this.owner._listAbility.Add(CharaAbility.randomAbilities.RandomItemWeighted((SourceElement.Row e) => (float)e.chance).id);
116 this.Refresh();
117 }
118
119 // Token: 0x060015F8 RID: 5624 RVA: 0x000949EC File Offset: 0x00092BEC
120 public void Remove(int id)
121 {
122 this.owner._listAbility.Remove(id);
123 if (this.owner._listAbility.Count == 0)
124 {
125 this.owner._listAbility = null;
126 }
127 this.Refresh();
128 }
129
130 // Token: 0x060015FA RID: 5626 RVA: 0x00094A30 File Offset: 0x00092C30
131 [CompilerGenerated]
132 private string <Refresh>g__ConvertID|4_0(string s)
133 {
134 if (this.owner.MainElement == Element.Void)
135 {
136 return s;
137 }
138 if (EClass.sources.elements.alias[s].aliasRef == "mold")
139 {
140 return s + this.owner.MainElement.source.alias.Replace("ele", "");
141 }
142 return s;
143 }
144
145 // Token: 0x04001024 RID: 4132
146 public static List<SourceElement.Row> randomAbilities = new List<SourceElement.Row>();
147
148 // Token: 0x04001025 RID: 4133
149 public Chara owner;
150
151 // Token: 0x04001026 RID: 4134
152 public ActList list = new ActList();
153}
Definition Chara.cs:12