Elin Decompiled Documentation EA 23.287 Stable Patch 3
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 4 of file CharaAbility.cs.

Constructor & Destructor Documentation

◆ CharaAbility()

CharaAbility.CharaAbility ( Chara  _owner)
inline

Definition at line 72 of file CharaAbility.cs.

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

References owner, and Refresh().

Member Function Documentation

◆ Add()

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

Definition at line 132 of file CharaAbility.cs.

133 {
134 if (owner._listAbility == null)
135 {
136 owner._listAbility = new List<int>();
137 }
138 owner._listAbility.Add(id * ((!pt) ? 1 : (-1)));
139 if (owner.IsPC && owner.HasElement(1274))
140 {
141 Element element = owner.elements.GetElement(id);
142 if (element == null)
143 {
144 owner.elements.ModBase(id, 1);
145 }
146 else if (!(element is Spell))
147 {
148 element.vPotential = 0;
149 }
150 }
151 Refresh();
152 if (owner.IsPC)
153 {
155 }
156 }
ElementContainerCard elements
Definition: Card.cs:42
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6122
override bool IsPC
Definition: Chara.cs:626
List< int > _listAbility
Definition: Chara.cs:61
Element ModBase(int ele, int v)
Element GetElement(string alias)
static void Redraw()
Definition: SPELL.cs:626

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 158 of file CharaAbility.cs.

159 {
160 if (owner._listAbility == null)
161 {
162 owner._listAbility = new List<int>();
163 }
164 owner._listAbility.Add(GetRandomAbilityList().RandomItemWeighted((SourceElement.Row e) => e.chance).id);
165 Refresh();
166 }
List< SourceElement.Row > GetRandomAbilityList()
Definition: CharaAbility.cs:55

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

Referenced by Zone.TryGenerateEvolved().

◆ BuildRandomAbilityList()

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

Definition at line 14 of file CharaAbility.cs.

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

56 {
57 if (randomAbilities.Count == 0)
58 {
60 }
61 if (randomAbilitiesAdv.Count == 0)
62 {
64 }
65 if (!(owner.trait is TraitAdventurer))
66 {
67 return randomAbilities;
68 }
69 return randomAbilitiesAdv;
70 }
static List< SourceElement.Row > randomAbilities
Definition: CharaAbility.cs:6
static List< SourceElement.Row > randomAbilitiesAdv
Definition: CharaAbility.cs:8
static List< SourceElement.Row > BuildRandomAbilityList(bool adv)
Definition: CharaAbility.cs:14
new TraitChara trait
Definition: Chara.cs:505

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

Referenced by AddRandom(), and Refresh().

◆ Has()

bool CharaAbility.Has ( int  id)
inline

Definition at line 190 of file CharaAbility.cs.

191 {
192 foreach (ActList.Item item in list.items)
193 {
194 if (item.act.id == id)
195 {
196 return true;
197 }
198 }
199 return false;
200 }
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 78 of file CharaAbility.cs.

79 {
80 list.items.Clear();
81 string[] actCombat = owner.source.actCombat;
82 for (int i = 0; i < actCombat.Length; i++)
83 {
84 string[] array = actCombat[i].Split('/');
85 list.items.Add(new ActList.Item
86 {
87 act = ACT.dict[ConvertID(array[0])],
88 chance = ((array.Length > 1) ? array[1].ToInt() : 100),
89 pt = (array.Length > 2)
90 });
91 }
93 {
94 int num = owner.trait.MaxRandomAbility + EClass.rnd(2) - list.items.Count;
95 if (num > 1)
96 {
97 owner._listAbility = new List<int>();
98 for (int j = 0; j < num; j++)
99 {
100 owner._listAbility.Add(GetRandomAbilityList().RandomItemWeighted((SourceElement.Row e) => e.chance).id);
101 }
102 }
103 }
104 if (owner._listAbility == null)
105 {
106 return;
107 }
108 foreach (int item in owner._listAbility)
109 {
110 string alias = EClass.sources.elements.map[Mathf.Abs(item)].alias;
111 list.items.Add(new ActList.Item
112 {
113 act = ACT.dict[alias],
114 chance = 50,
115 pt = (item < 0)
116 });
117 }
118 string ConvertID(string s)
119 {
121 {
122 return s;
123 }
124 if (EClass.sources.elements.alias[s].aliasRef == "mold")
125 {
126 return s + owner.MainElement.source.alias.Replace("ele", "");
127 }
128 return s;
129 }
130 }
Element MainElement
Definition: Chara.cs:731
SourceChara.Row source
Definition: Chara.cs:160
static int rnd(long a)
Definition: EClass.cs:59
SourceElement.Row source
Definition: ELEMENT.cs:278
static Element Void
Definition: ELEMENT.cs:243
virtual int MaxRandomAbility
Definition: TraitChara.cs:97

References Chara._listAbility, SourceManager.elements, GetRandomAbilityList(), 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 168 of file CharaAbility.cs.

169 {
170 owner._listAbility.Remove(id);
171 if (owner.IsPC && owner.HasElement(1274) && owner.HasElement(id) && owner._listAbility.IndexOf(id) == -1)
172 {
173 Element element = EClass.pc.elements.GetElement(id);
174 if (!(element is Spell))
175 {
176 element.vPotential = -1;
177 }
178 }
179 if (owner._listAbility.Count == 0)
180 {
181 owner._listAbility = null;
182 }
183 Refresh();
184 if (owner.IsPC)
185 {
187 }
188 }
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 10 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 6 of file CharaAbility.cs.

Referenced by GetRandomAbilityList().

◆ randomAbilitiesAdv

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

Definition at line 8 of file CharaAbility.cs.

Referenced by GetRandomAbilityList().


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