Elin Decompiled Documentation EA 23.130 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)
 

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

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

References owner, and Refresh().

Member Function Documentation

◆ Add()

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

Definition at line 131 of file CharaAbility.cs.

132 {
133 if (owner._listAbility == null)
134 {
135 owner._listAbility = new List<int>();
136 }
137 owner._listAbility.Add(id * ((!pt) ? 1 : (-1)));
138 Refresh();
139 }
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 141 of file CharaAbility.cs.

142 {
143 if (owner._listAbility == null)
144 {
145 owner._listAbility = new List<int>();
146 }
147 owner._listAbility.Add(GetRandomAbilityList().RandomItemWeighted((SourceElement.Row e) => e.chance).id);
148 Refresh();
149 }
List< SourceElement.Row > GetRandomAbilityList()
Definition: CharaAbility.cs:54

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 8200:
33 continue;
34 }
35 if (row.idMold != 0 && !adv)
36 {
37 switch (row.aliasRef)
38 {
39 case "eleEther":
40 case "eleAcid":
41 case "eleCut":
42 case "eleImpact":
43 continue;
44 }
45 }
46 if (!row.tag.Contains("noRandomAbility"))
47 {
48 list.Add(row);
49 }
50 }
51 return list;
52 }
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 54 of file CharaAbility.cs.

55 {
56 if (randomAbilities.Count == 0)
57 {
59 }
60 if (randomAbilitiesAdv.Count == 0)
61 {
63 }
64 if (!(owner.trait is TraitAdventurer))
65 {
66 return randomAbilities;
67 }
68 return randomAbilitiesAdv;
69 }
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:493

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

Referenced by AddRandom(), and Refresh().

◆ Refresh()

void CharaAbility.Refresh ( )
inline

Definition at line 77 of file CharaAbility.cs.

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

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

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: