Elin Decompiled Documentation EA 23.189 Nightly
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 (int a, int start, int step, int rate=75)
 
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 Refresh();
140 }
List< int > _listAbility
Definition: Chara.cs:61

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

Referenced by DNA.Apply().

◆ AddRandom()

void CharaAbility.AddRandom ( )
inline

Definition at line 142 of file CharaAbility.cs.

143 {
144 if (owner._listAbility == null)
145 {
146 owner._listAbility = new List<int>();
147 }
148 owner._listAbility.Add(GetRandomAbilityList().RandomItemWeighted((SourceElement.Row e) => e.chance).id);
149 Refresh();
150 }
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:5
static SourceManager sources
Definition: EClass.cs:42
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:501

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

Referenced by AddRandom(), and Refresh().

◆ Has()

bool CharaAbility.Has ( int  id)
inline

Definition at line 162 of file CharaAbility.cs.

163 {
164 foreach (ActList.Item item in list.items)
165 {
166 if (item.act.id == id)
167 {
168 return true;
169 }
170 }
171 return false;
172 }
List< Item > items
Definition: ActList.cs:14

References item, ActList.items, and list.

Referenced by AI_Idle.Run().

◆ 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:715
SourceChara.Row source
Definition: Chara.cs:156
static int rnd(long a)
Definition: EClass.cs:58
SourceElement.Row source
Definition: ELEMENT.cs:271
static Element Void
Definition: ELEMENT.cs:236
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 152 of file CharaAbility.cs.

153 {
154 owner._listAbility.Remove(id);
155 if (owner._listAbility.Count == 0)
156 {
157 owner._listAbility = null;
158 }
159 Refresh();
160 }

References Chara._listAbility, owner, 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: