Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
DNA Class Reference
Inheritance diagram for DNA:
EClass

Public Types

enum  Type { Inferior = 0 , Default = 3 , Superior = 5 , Brain = 8 }
 

Public Member Functions

void Apply (Chara c)
 
void Apply (Chara c, bool reverse)
 
bool CanRemove ()
 
void GenerateWithGene (Type _type, Card gene, Chara model=null)
 
void Generate (Type _type, Chara model=null)
 
void CalcCost ()
 
void CalcSlot ()
 
string GetMaterialId (Type type)
 
int GetDurationHour ()
 
Type GetRandomType ()
 
string GetText ()
 
void WriteNote (UINote n)
 
Element GetInvalidFeat (Chara c)
 
Element GetInvalidAction (Chara c)
 

Static Public Member Functions

static Thing GenerateGene (Chara c, Type? type=null)
 
static Thing GenerateGene (CardRow r, Type? type=null, int lv=-1, int seed=-1)
 
static Thing CopyDNA (Thing from, Thing to)
 
static Thing GenerateRandomGene (int lv=-1, int seed=-1)
 
static Thing GenerateManiGene (Card owner)
 
static Type GetType (string idMat)
 
- Static Public Member Functions inherited from EClass
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

string id
 
int[] ints = new int[6]
 
List< int > vals = new List<int>()
 
BitArray32 bits
 

Properties

Type type [get, set]
 
int cost [get, set]
 
int lv [get, set]
 
int seed [get, set]
 
int slot [get, set]
 
- 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]
 

Private Member Functions

void _OnSerializing (StreamingContext context)
 
void _OnDeserialized (StreamingContext context)
 

Additional Inherited Members

- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 7 of file DNA.cs.

Member Enumeration Documentation

◆ Type

enum DNA.Type
Enumerator
Inferior 
Default 
Superior 
Brain 

Definition at line 9 of file DNA.cs.

10 {
11 Inferior = 0,
12 Default = 3,
13 Superior = 5,
14 Brain = 8
15 }

Member Function Documentation

◆ _OnDeserialized()

void DNA._OnDeserialized ( StreamingContext  context)
inlineprivate

Definition at line 95 of file DNA.cs.

96 {
97 if (ints.Length < 6)
98 {
99 Array.Resize(ref ints, 6);
100 slot = 1;
101 }
102 }
int slot
Definition: DNA.cs:77
int[] ints
Definition: DNA.cs:21

References ints, and slot.

◆ _OnSerializing()

void DNA._OnSerializing ( StreamingContext  context)
inlineprivate

Definition at line 89 of file DNA.cs.

90 {
91 ints[4] = bits.ToInt();
92 }
BitArray32 bits
Definition: DNA.cs:26
int ToInt()
Definition: BitArray32.cs:84

References bits, ints, and BitArray32.ToInt().

◆ Apply() [1/2]

void DNA.Apply ( Chara  c)
inline

Definition at line 165 of file DNA.cs.

166 {
167 if (c.c_genes == null)
168 {
169 c.c_genes = new CharaGenes();
170 }
171 CharaGenes c_genes = c.c_genes;
172 if (type == Type.Inferior)
173 {
174 c.c_genes.inferior++;
175 return;
176 }
177 c.feat -= cost;
178 Apply(c, reverse: false);
179 c_genes.items.Add(this);
180 }
CharaGenes c_genes
Definition: Card.cs:1745
int inferior
Definition: CharaGenes.cs:10
List< DNA > items
Definition: CharaGenes.cs:7
Type type
Definition: DNA.cs:29
int cost
Definition: DNA.cs:41
Type
Definition: DNA.cs:10
void Apply(Chara c)
Definition: DNA.cs:165

References Apply(), Card.c_genes, cost, CharaGenes.inferior, CharaGenes.items, and type.

Referenced by Apply().

◆ Apply() [2/2]

void DNA.Apply ( Chara  c,
bool  reverse 
)
inline

Definition at line 182 of file DNA.cs.

183 {
184 if (type == Type.Brain)
185 {
186 c._tactics = null;
187 return;
188 }
189 for (int i = 0; i < vals.Count; i += 2)
190 {
191 int num = vals[i];
192 int num2 = vals[i + 1];
194 switch (row.category)
195 {
196 case "slot":
197 if (reverse)
198 {
199 c.body.RemoveBodyPart(row.id);
200 }
201 else
202 {
203 c.body.AddBodyPart(row.id);
204 }
206 break;
207 case "feat":
208 c.SetFeat(num, c.elements.ValueWithoutLink(num) + ((!reverse) ? 1 : (-1)), !reverse);
209 break;
210 case "ability":
211 if (reverse)
212 {
213 c.ability.Remove(num * ((num2 >= 0) ? 1 : (-1)));
214 }
215 else
216 {
217 c.ability.Add(num, Mathf.Abs(num2), num2 < 0);
218 }
219 break;
220 default:
221 if (!reverse && c.elements.ValueWithoutLink(row.id) == 0)
222 {
223 c.elements.Learn(row.id, num2);
224 }
225 else
226 {
227 c.elements.ModBase(num, reverse ? (-num2) : num2);
228 }
229 break;
230 }
231 }
232 }
ElementContainerCard elements
Definition: Card.cs:37
void Add(int id, int chance, bool pt)
void Remove(int id)
void AddBodyPart(int ele, Thing thing=null)
Definition: CharaBody.cs:261
void RefreshBodyParts()
Definition: CharaBody.cs:287
void RemoveBodyPart(int ele)
Definition: CharaBody.cs:310
CharaBody body
Definition: Chara.cs:91
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:8964
CharaAbility ability
Definition: Chara.cs:409
List< int > vals
Definition: DNA.cs:24
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
void Learn(int ele, int v=1)
int ValueWithoutLink(int ele)
Element ModBase(int ele, int v)
SourceElement elements

References Chara.ability, CharaAbility.Add(), CharaBody.AddBodyPart(), Chara.body, SourceElement.Row.category, Card.elements, SourceManager.elements, SourceElement.Row.id, ElementContainer.Learn(), ElementContainer.ModBase(), CharaBody.RefreshBodyParts(), CharaAbility.Remove(), CharaBody.RemoveBodyPart(), Chara.SetFeat(), EClass.sources, type, vals, and ElementContainer.ValueWithoutLink().

◆ CalcCost()

void DNA.CalcCost ( )
inline

Definition at line 465 of file DNA.cs.

466 {
467 if (cost < 0)
468 {
469 cost = 0;
470 }
471 }

References cost.

Referenced by Generate().

◆ CalcSlot()

void DNA.CalcSlot ( )
inline

Definition at line 473 of file DNA.cs.

474 {
475 slot = 0;
476 for (int i = 0; i < vals.Count; i += 2)
477 {
478 Element element = Element.Create(vals[i], vals[i + 1]);
479 if (element.source.geneSlot < 0)
480 {
481 slot = 99;
482 }
483 if (element.source.geneSlot > slot)
484 {
485 slot = element.source.geneSlot;
486 }
487 }
488 if (slot < 0)
489 {
490 slot = 0;
491 }
492 }
SourceElement.Row source
Definition: ELEMENT.cs:263
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:913

References Element.Create(), slot, Element.source, and vals.

Referenced by Generate().

◆ CanRemove()

bool DNA.CanRemove ( )
inline

Definition at line 234 of file DNA.cs.

235 {
236 for (int i = 0; i < vals.Count; i += 2)
237 {
238 int num = vals[i];
239 if (num == 1237 || num == 1415)
240 {
241 return false;
242 }
243 }
244 return true;
245 }

References vals.

Referenced by WindowCharaMini.Refresh(), and WriteNote().

◆ CopyDNA()

static Thing DNA.CopyDNA ( Thing  from,
Thing  to 
)
inlinestatic

Definition at line 130 of file DNA.cs.

131 {
132 to.c_DNA = from.c_DNA;
133 to.c_idRefCard = from.c_idRefCard;
134 to.ChangeMaterial(from.material);
135 return to;
136 }
SourceMaterial.Row material
Definition: Card.cs:1927
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2838
DNA c_DNA
Definition: Card.cs:1781
string c_idRefCard
Definition: Card.cs:1637

References Card.c_DNA, Card.c_idRefCard, Card.ChangeMaterial(), and Card.material.

Referenced by Card.TryMakeRandomItem().

◆ Generate()

void DNA.Generate ( Type  _type,
Chara  model = null 
)
inline

Definition at line 254 of file DNA.cs.

255 {
256 type = _type;
257 cost = 0;
258 slot = 0;
259 vals.Clear();
260 Debug.Log(seed);
262 if (model == null)
263 {
264 model = CharaGen.Create(id);
265 if (lv > model.LV)
266 {
267 model.SetLv(lv);
268 }
269 }
270 if (type == Type.Inferior || model == null)
271 {
272 type = Type.Inferior;
273 return;
274 }
275 if (type == Type.Brain)
276 {
277 cost = 4;
278 return;
279 }
280 int body = 0;
281 int action = 0;
282 int feat = 0;
283 int maxSlot = 1;
284 List<Element> listAttb = model.elements.ListBestAttributes();
285 List<Element> listSkill = model.elements.ListBestSkills();
286 List<Element> listFeat = model.elements.ListGeneFeats();
288 if (listFeat.Count == 0)
289 {
290 listFeat = model.ListAvailabeFeats(pet: true);
291 }
293 switch (type)
294 {
295 case Type.Default:
296 AddRandom(EClass.rnd(EClass.rnd(4)) + 1);
297 if (EClass.rnd(3) == 0 || vals.Count == 0)
298 {
299 AddSpecial();
300 }
301 break;
302 case Type.Superior:
303 AddRandom(EClass.rnd(EClass.rnd(4)) + 3);
304 if (EClass.rnd(3) == 0)
305 {
306 AddSpecial();
307 }
308 AddSpecial();
309 break;
310 }
311 if (vals.Count == 0)
312 {
313 for (int i = 0; i < 10; i++)
314 {
315 if (EClass.rnd(4) == 0)
316 {
317 AddSpecial();
318 }
319 else
320 {
321 AddRandom(1);
322 }
323 if (vals.Count > 0)
324 {
325 break;
326 }
327 }
328 }
329 Rand.SetSeed();
330 CalcCost();
331 CalcSlot();
332 void AddAction()
333 {
334 if (model.ability.list.items.Count != 0)
335 {
336 ActList.Item a = model.ability.list.items.RandomItem();
337 if (!(a.act.source.category != "ability"))
338 {
339 AddVal(a.act.source.id, a.chance * ((!a.pt) ? 1 : (-1)), allowStack: false, (int v) => 8 + a.act.source.cost[0] / 10 * 2);
340 action++;
341 }
342 }
343 }
344 void AddAttribute()
345 {
346 Element element = listAttb[EClass.rnd(3)];
347 AddVal(element.id, EClass.rndHalf(element.ValueWithoutLink / 2), allowStack: true, (int v) => v / 5 + 1);
348 }
349 void AddBody()
350 {
351 if (body == 0)
352 {
353 BodySlot bodySlot = null;
354 for (int j = 0; j < 100; j++)
355 {
356 BodySlot bodySlot2 = model.body.slots.RandomItem();
357 if (bodySlot2 != null && bodySlot2.elementId != 40)
358 {
359 bodySlot = bodySlot2;
360 break;
361 }
362 }
363 if (bodySlot != null)
364 {
365 AddVal(bodySlot.elementId, 1, allowStack: false, (int v) => 20);
366 body++;
367 }
368 }
369 }
370 void AddFeat()
371 {
372 if (listFeat.Count != 0)
373 {
374 feat++;
375 Element e = listFeat.RandomItem();
376 if (maxSlot <= 1 || e.source.geneSlot <= 1)
377 {
378 if (e.source.geneSlot > maxSlot)
379 {
380 maxSlot = e.source.geneSlot;
381 }
382 AddVal(e.id, 1, allowStack: false, (int v) => e.source.cost[0] * 5);
383 }
384 }
385 }
386 void AddRandom(int n)
387 {
388 for (int l = 0; l < n; l++)
389 {
390 if (EClass.debug.enable && EClass.rnd(2) == 0)
391 {
392 AddSpecial();
393 }
394 else if (EClass.rnd(2) == 0)
395 {
396 AddSkill();
397 }
398 else
399 {
400 AddAttribute();
401 }
402 }
403 }
404 void AddSkill()
405 {
406 Element element2 = listSkill[Mathf.Clamp(EClass.rnd(6), 0, listSkill.Count - 1)];
407 AddVal(element2.id, EClass.rndHalf(element2.ValueWithoutLink / 2), allowStack: true, (int v) => v / 5 + 1);
408 }
409 void AddSpecial()
410 {
411 if (EClass.rnd(3) == 0)
412 {
413 AddAction();
414 }
415 else if (EClass.rnd(5) == 0)
416 {
417 AddBody();
418 }
419 else if (listFeat.Count > 0)
420 {
421 AddFeat();
422 }
423 else if (EClass.rnd(2) == 0)
424 {
425 AddSkill();
426 }
427 else
428 {
429 AddAttribute();
430 }
431 }
432 void AddVal(int id, int v, bool allowStack, Func<int, int> funcCost)
433 {
434 bool flag = false;
435 int num = EClass.curve(v, 20, 10, 90);
436 v = EClass.curve(v, 20, 10, 80);
437 for (int k = 0; k < vals.Count; k += 2)
438 {
439 if (vals[k] == id)
440 {
441 if (allowStack)
442 {
443 v /= 2;
444 num /= 2;
445 vals[k + 1] += v;
446 Debug.Log(vals[k + 1] + ": " + v + "/" + num);
447 flag = true;
448 break;
449 }
450 return;
451 }
452 }
453 if (v != 0)
454 {
455 if (!flag)
456 {
457 vals.Add(id);
458 vals.Add(v);
459 }
460 cost += Mathf.Max(0, funcCost(num));
461 }
462 }
463 }
int chance
Definition: ActList.cs:9
bool pt
Definition: ActList.cs:11
Act act
Definition: ActList.cs:7
List< Item > items
Definition: ActList.cs:14
int elementId
Definition: BodySlot.cs:6
Card SetLv(int a)
Definition: Card.cs:2735
int LV
Definition: Card.cs:370
ActList list
Definition: CharaAbility.cs:12
List< BodySlot > slots
Definition: CharaBody.cs:8
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
List< Element > ListAvailabeFeats(bool pet=false, bool showAll=false)
Definition: Chara.cs:8949
bool enable
Definition: CoreDebug.cs:285
int seed
Definition: DNA.cs:65
void CalcSlot()
Definition: DNA.cs:473
void CalcCost()
Definition: DNA.cs:465
int lv
Definition: DNA.cs:53
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:55
static int rnd(int a)
Definition: EClass.cs:50
static int rndHalf(int a)
Definition: EClass.cs:74
static CoreDebug debug
Definition: EClass.cs:48
List< Element > ListBestSkills()
List< Element > ListBestAttributes()
List< Element > ListGeneFeats()
int ValueWithoutLink
Definition: ELEMENT.cs:284
int id
Definition: ELEMENT.cs:240
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37

References ActList.Item.act, CalcCost(), CalcSlot(), ActList.Item.chance, cost, CharaGen.Create(), EClass.curve(), EClass.debug, Debug, BodySlot.elementId, CoreDebug.enable, Element.id, lv, ActList.Item.pt, EClass.rnd(), EClass.rndHalf(), seed, Card.SetLv(), Rand.SetSeed(), slot, Element.source, type, vals, and Element.ValueWithoutLink.

Referenced by GenerateWithGene(), and ActEffect.Proc().

◆ GenerateGene() [1/2]

static Thing DNA.GenerateGene ( CardRow  r,
Type type = null,
int  lv = -1,
int  seed = -1 
)
inlinestatic

Definition at line 117 of file DNA.cs.

118 {
119 Thing thing = ThingGen.Create((type == Type.Brain) ? "gene_brain" : "gene");
120 DNA dNA = new DNA();
121 thing.MakeRefFrom(r.id);
122 dNA.id = r.id;
123 dNA.lv = ((lv == -1) ? r.LV : lv);
124 dNA.seed = ((seed == -1) ? EClass.rnd(20000) : seed);
125 thing.c_DNA = dNA;
126 dNA.GenerateWithGene(type ?? dNA.GetRandomType(), thing);
127 return thing;
128 }
string id
Definition: CardRow.cs:7
void MakeRefFrom(string id)
Definition: Card.cs:5094
Definition: DNA.cs:8
void GenerateWithGene(Type _type, Card gene, Chara model=null)
Definition: DNA.cs:247
Type GetRandomType()
Definition: DNA.cs:521
int LV
Definition: RenderRow.cs:22
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8

References ThingGen.Create(), GenerateWithGene(), GetRandomType(), CardRow.id, lv, RenderRow.LV, Card.MakeRefFrom(), EClass.rnd(), seed, and type.

◆ GenerateGene() [2/2]

static Thing DNA.GenerateGene ( Chara  c,
Type type = null 
)
inlinestatic

Definition at line 104 of file DNA.cs.

105 {
106 Thing thing = ThingGen.Create((type == Type.Brain) ? "gene_brain" : "gene");
107 DNA dNA = new DNA();
108 thing.MakeRefFrom(c);
109 dNA.id = c.id;
110 dNA.lv = c.LV;
111 dNA.seed = EClass.rnd(20000);
112 thing.c_DNA = dNA;
113 dNA.GenerateWithGene(type ?? dNA.GetRandomType(), thing, c);
114 return thing;
115 }
string id
Definition: Card.cs:31

References ThingGen.Create(), GenerateWithGene(), GetRandomType(), Card.id, Card.LV, Card.MakeRefFrom(), EClass.rnd(), and type.

Referenced by Trait.CreateStock(), GenerateManiGene(), GenerateRandomGene(), Chara.MakeBraineCell(), and Chara.MakeGene().

◆ GenerateManiGene()

static Thing DNA.GenerateManiGene ( Card  owner)
inlinestatic

Definition at line 150 of file DNA.cs.

151 {
152 owner.things.DestroyAll();
153 Debug.Log("Mani:" + owner.c_seed);
154 Rand.SetSeed(owner.c_seed);
155 CardRow r = SpawnList.Get("chara").Select(100);
156 Rand.SetSeed(owner.c_seed);
157 Thing thing = GenerateGene(r, Type.Superior, owner.LV, owner.c_seed);
158 thing.c_DNA.cost = thing.c_DNA.cost / 2;
159 thing.MakeRefFrom("mani");
160 Rand.SetSeed();
161 owner.c_seed++;
162 return thing;
163 }
int c_seed
Definition: Card.cs:1241
ThingContainer things
Definition: Card.cs:34
static Thing GenerateGene(Chara c, Type? type=null)
Definition: DNA.cs:104
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
Definition: SpawnList.cs:18
CardRow Select(int lv=-1, int levelRange=-1)
Definition: SpawnList.cs:139
void DestroyAll(Func< Thing, bool > funcExclude=null)

References Card.c_seed, Debug, ThingContainer.DestroyAll(), GenerateGene(), SpawnList.Get(), Card.LV, Card.MakeRefFrom(), SpawnList.Select(), Rand.SetSeed(), and Card.things.

Referenced by TraitGodStatue._OnUse(), and TraitGodStatue.OnChangeMaterial().

◆ GenerateRandomGene()

static Thing DNA.GenerateRandomGene ( int  lv = -1,
int  seed = -1 
)
inlinestatic

Definition at line 138 of file DNA.cs.

139 {
140 if (lv == -1)
141 {
143 }
145 CardRow r = SpawnList.Get("chara").Select(100);
146 Rand.SetSeed();
147 return GenerateGene(r, Type.Superior, lv, seed);
148 }
static Zone _zone
Definition: EClass.cs:20
override int ContentLv
Definition: Zone.cs:95

References EClass._zone, Zone.ContentLv, GenerateGene(), SpawnList.Get(), lv, seed, SpawnList.Select(), and Rand.SetSeed().

Referenced by Card.TryMakeRandomItem().

◆ GenerateWithGene()

void DNA.GenerateWithGene ( Type  _type,
Card  gene,
Chara  model = null 
)
inline

Definition at line 247 of file DNA.cs.

248 {
249 Generate(_type, model);
251 gene.elements.SetTo(10, 0);
252 }
string GetMaterialId(Type type)
Definition: DNA.cs:505
void Generate(Type _type, Chara model=null)
Definition: DNA.cs:254
void SetTo(int id, int v)

References Card.ChangeMaterial(), Card.elements, Generate(), GetMaterialId(), ElementContainer.SetTo(), and type.

Referenced by TraitCrafter.Craft(), and GenerateGene().

◆ GetDurationHour()

int DNA.GetDurationHour ( )
inline

Definition at line 516 of file DNA.cs.

517 {
518 return cost * cost / 2;
519 }

References cost.

Referenced by InvOwnerGene._OnProcess(), and TraitGene.WriteNote().

◆ GetInvalidAction()

Element DNA.GetInvalidAction ( Chara  c)
inline

Definition at line 617 of file DNA.cs.

618 {
619 for (int i = 0; i < vals.Count; i += 2)
620 {
621 Element element = Element.Create(vals[i], vals[i + 1]);
622 if (!(element.source.category == "ability"))
623 {
624 continue;
625 }
626 foreach (ActList.Item item in c.ability.list.items)
627 {
628 if (item.act.source.id == element.id)
629 {
630 return element;
631 }
632 }
633 }
634 return null;
635 }

References Chara.ability, Element.Create(), Element.id, item, ActList.items, CharaAbility.list, Element.source, and vals.

Referenced by InvOwnerGene._OnProcess().

◆ GetInvalidFeat()

Element DNA.GetInvalidFeat ( Chara  c)
inline

Definition at line 604 of file DNA.cs.

605 {
606 for (int i = 0; i < vals.Count; i += 2)
607 {
608 Element element = Element.Create(vals[i], vals[i + 1]);
609 if (element.source.category == "feat" && c.Evalue(element.id) >= element.source.max)
610 {
611 return element;
612 }
613 }
614 return null;
615 }
int Evalue(int ele)
Definition: Card.cs:2431

References Element.Create(), Card.Evalue(), Element.id, Element.source, and vals.

Referenced by InvOwnerGene._OnProcess().

◆ GetMaterialId()

string DNA.GetMaterialId ( Type  type)
inline

Definition at line 505 of file DNA.cs.

506 {
507 return type switch
508 {
509 Type.Default => "jelly",
510 Type.Superior => "gold",
511 Type.Brain => "amethyst",
512 _ => "process",
513 };
514 }

References type.

Referenced by GenerateWithGene().

◆ GetRandomType()

Type DNA.GetRandomType ( )
inline

Definition at line 521 of file DNA.cs.

522 {
523 if (EClass.rnd(5) == 0)
524 {
525 return Type.Superior;
526 }
527 if (EClass.rnd(10) == 0)
528 {
529 return Type.Inferior;
530 }
531 return Type.Default;
532 }

References EClass.rnd().

Referenced by GenerateGene().

◆ GetText()

string DNA.GetText ( )
inline

Definition at line 534 of file DNA.cs.

535 {
536 return "gene".lang((EClass.sources.cards.map.TryGetValue(id)?.GetName() ?? "???").ToTitleCase(), cost.ToString() ?? "");
537 }
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
SourceCard cards

References SourceManager.cards, cost, SourceCard.map, and EClass.sources.

Referenced by WindowCharaMini.Refresh().

◆ GetType()

static Type DNA.GetType ( string  idMat)
inlinestatic

Definition at line 494 of file DNA.cs.

495 {
496 return idMat switch
497 {
498 "jelly" => Type.Default,
499 "gold" => Type.Superior,
500 "amethyst" => Type.Brain,
501 _ => Type.Inferior,
502 };
503 }

Referenced by ActEffect.Proc().

◆ WriteNote()

void DNA.WriteNote ( UINote  n)
inline

Definition at line 539 of file DNA.cs.

540 {
541 if (slot >= 1)
542 {
543 n.AddText("isGeneReqSlots".lang(slot.ToString() ?? ""), FontColor.Warning);
544 }
545 if (!CanRemove())
546 {
547 n.AddText("isPermaGene".lang(), FontColor.Warning);
548 }
549 n.Space(4);
550 if (type == Type.Brain)
551 {
552 SourceChara.Row row = EClass.sources.charas.map.TryGetValue(id);
553 if (row != null)
554 {
555 string key = row.tactics.IsEmpty(EClass.sources.tactics.map.TryGetValue(row.id)?.id ?? EClass.sources.tactics.map.TryGetValue(row.job)?.id ?? "predator");
556 n.AddText("gene_info".lang(EClass.sources.tactics.map[key].GetName().ToTitleCase(), ""), FontColor.ButtonGeneral);
557 }
558 for (int i = 0; i < vals.Count; i += 2)
559 {
560 int num = vals[i];
561 int num2 = vals[i + 1];
562 FontColor color = ((num2 >= 0) ? FontColor.Good : FontColor.Bad);
563 string @ref = (num + 1).ToString() ?? "";
564 string text = "";
565 num2 = Mathf.Abs(num2 / 20) + 1;
566 text = text + "[" + "*".Repeat(Mathf.Clamp(num2, 1, 5)) + ((num2 > 5) ? "+" : "") + "]";
567 n.AddText("gene_info_brain".lang(@ref, text), color);
568 }
569 return;
570 }
571 for (int j = 0; j < vals.Count; j += 2)
572 {
573 Element element = Element.Create(vals[j], vals[j + 1]);
574 string text2 = "";
575 int num3 = element.Value / 10;
576 FontColor color2 = FontColor.Good;
577 switch (element.source.category)
578 {
579 case "slot":
580 color2 = FontColor.Myth;
581 num3 = -1;
582 break;
583 case "feat":
584 color2 = FontColor.FoodMisc;
585 num3 = -1;
586 break;
587 case "ability":
588 color2 = FontColor.Topic2;
589 num3 = -1;
590 break;
591 }
592 if (num3 >= 0)
593 {
594 text2 = text2 + "[" + "*".Repeat(Mathf.Clamp(num3, 1, 5)) + ((num3 > 5) ? "+" : "") + "]";
595 }
597 {
598 text2 = text2 + " " + element.Value;
599 }
600 n.AddText("gene_info".lang(element.Name.ToTitleCase(wholeText: true), text2), color2);
601 }
602 }
FontColor
Definition: FontColor.cs:2
bool showExtra
Definition: CoreDebug.cs:167
bool CanRemove()
Definition: DNA.cs:234
int Value
Definition: ELEMENT.cs:282
virtual string Name
Definition: ELEMENT.cs:294
SourceChara charas
SourceTactics tactics
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62

References UINote.AddText(), CanRemove(), SourceManager.charas, Element.Create(), EClass.debug, CardRow.id, SourceChara.Row.job, Element.Name, CoreDebug.showExtra, slot, Element.source, EClass.sources, UINote.Space(), SourceChara.Row.tactics, SourceManager.tactics, type, vals, and Element.Value.

Referenced by WindowCharaMini.Refresh(), and TraitGene.WriteNote().

Member Data Documentation

◆ bits

BitArray32 DNA.bits

Definition at line 26 of file DNA.cs.

Referenced by _OnSerializing().

◆ id

string DNA.id

Definition at line 18 of file DNA.cs.

◆ ints

int [] DNA.ints = new int[6]

Definition at line 21 of file DNA.cs.

Referenced by _OnDeserialized(), and _OnSerializing().

◆ vals

List<int> DNA.vals = new List<int>()

Property Documentation

◆ cost

int DNA.cost
getset

Definition at line 40 of file DNA.cs.

41 {
42 get
43 {
44 return ints[1];
45 }
46 set
47 {
48 ints[1] = value;
49 }
50 }

Referenced by Apply(), CalcCost(), Generate(), GetDurationHour(), GetText(), TraitGene.GetValue(), InvOwnerGene.OnWriteNote(), InvOwnerGene.ShouldShowGuide(), and TraitGene.WriteNote().

◆ lv

int DNA.lv
getset

Definition at line 52 of file DNA.cs.

53 {
54 get
55 {
56 return ints[2];
57 }
58 set
59 {
60 ints[2] = value;
61 }
62 }

Referenced by Generate(), GenerateGene(), and GenerateRandomGene().

◆ seed

int DNA.seed
getset

Definition at line 64 of file DNA.cs.

65 {
66 get
67 {
68 return ints[3];
69 }
70 set
71 {
72 ints[3] = value;
73 }
74 }

Referenced by Generate(), GenerateGene(), and GenerateRandomGene().

◆ slot

int DNA.slot
getset

Definition at line 76 of file DNA.cs.

77 {
78 get
79 {
80 return ints[5];
81 }
82 set
83 {
84 ints[5] = value;
85 }
86 }

Referenced by _OnDeserialized(), InvOwnerGene._OnProcess(), CalcSlot(), Generate(), InvOwnerGene.OnWriteNote(), and WriteNote().

◆ type

Type DNA.type
getset

Definition at line 28 of file DNA.cs.

29 {
30 get
31 {
32 return ints[0].ToEnum<Type>();
33 }
34 set
35 {
36 ints[0] = (int)value;
37 }
38 }

Referenced by InvOwnerGene._OnProcess(), Apply(), Generate(), GenerateGene(), GenerateWithGene(), GetMaterialId(), TraitGene.GetName(), Thing.MatchEncSearch(), and WriteNote().


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