2using System.Collections.Generic;
3using System.Runtime.Serialization;
21 public int[]
ints =
new int[6];
24 public List<int>
vals =
new List<int>();
99 Array.Resize(ref
ints, 6);
123 dNA.lv = ((
lv == -1) ? r.
LV :
lv);
132 to.c_DNA = from.
c_DNA;
158 thing.c_DNA.cost = thing.c_DNA.cost / 2;
178 Apply(c, reverse:
false);
179 c_genes.
items.Add(
this);
189 for (
int i = 0; i <
vals.Count; i += 2)
192 int num2 =
vals[i + 1];
217 c.
ability.
Add(num, Mathf.Abs(num2), num2 < 0);
236 for (
int i = 0; i <
vals.Count; i += 2)
239 if (num == 1237 || num == 1415)
270 if (
type ==
Type.Inferior || model ==
null)
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)
290 listFeat = model.ListAvailabeFeats(pet:
true);
313 for (
int i = 0; i < 10; i++)
334 if (model.ability.list.items.Count != 0)
337 if (!(a.
act.
source.category !=
"ability"))
354 for (
int j = 0; j < 100; j++)
356 BodySlot bodySlot2 = model.body.slots.RandomItem();
357 if (bodySlot2 !=
null && bodySlot2.
elementId != 40)
359 bodySlot = bodySlot2;
363 if (bodySlot !=
null)
365 AddVal(bodySlot.
elementId, 1, allowStack:
false, (
int v) => 20);
372 if (listFeat.Count != 0)
375 Element e = listFeat.RandomItem();
376 if (maxSlot <= 1 || e.
source.geneSlot <= 1)
378 if (e.
source.geneSlot > maxSlot)
380 maxSlot = e.
source.geneSlot;
382 AddVal(e.
id, 1, allowStack:
false, (
int v) => e.
source.cost[0] * 5);
386 void AddRandom(
int n)
388 for (
int l = 0; l < n; l++)
406 Element element2 = listSkill[Mathf.Clamp(
EClass.
rnd(6), 0, listSkill.Count - 1)];
419 else if (listFeat.Count > 0)
432 void AddVal(
int id,
int v,
bool allowStack, Func<int, int> funcCost)
437 for (
int k = 0; k <
vals.Count; k += 2)
446 Debug.Log(
vals[k + 1] +
": " + v +
"/" + num);
460 cost += Mathf.Max(0, funcCost(num));
476 for (
int i = 0; i <
vals.Count; i += 2)
479 if (element.
source.geneSlot < 0)
498 "jelly" =>
Type.Default,
499 "gold" =>
Type.Superior,
500 "amethyst" =>
Type.Brain,
509 Type.Default =>
"jelly",
510 Type.Superior =>
"gold",
511 Type.Brain =>
"amethyst",
525 return Type.Superior;
529 return Type.Inferior;
558 for (
int i = 0; i <
vals.Count; i += 2)
561 int num2 =
vals[i + 1];
563 string @ref = (num + 1).ToString() ??
"";
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);
571 for (
int j = 0; j <
vals.Count; j += 2)
575 int num3 = element.Value / 10;
577 switch (element.
source.category)
594 text2 = text2 +
"[" +
"*".Repeat(Mathf.Clamp(num3, 1, 5)) + ((num3 > 5) ?
"+" :
"") +
"]";
598 text2 = text2 +
" " + element.
Value;
600 n.
AddText(
"gene_info".lang(element.
Name.ToTitleCase(wholeText:
true), text2), color2);
606 for (
int i = 0; i <
vals.Count; i += 2)
619 for (
int i = 0; i <
vals.Count; i += 2)
622 if (!(element.
source.category ==
"ability"))
628 if (
item.act.source.id == element.
id)
void MakeRefFrom(string id)
ElementContainerCard elements
SourceMaterial.Row material
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
void Add(int id, int chance, bool pt)
void AddBodyPart(int ele, Thing thing=null)
void RemoveBodyPart(int ele)
static Chara Create(string id, int lv=-1)
void SetFeat(int id, int value=1, bool msg=false)
void Apply(Chara c, bool reverse)
void GenerateWithGene(Type _type, Card gene, Chara model=null)
void _OnDeserialized(StreamingContext context)
Element GetInvalidFeat(Chara c)
static Thing GenerateGene(CardRow r, Type? type=null, int lv=-1, int seed=-1)
void _OnSerializing(StreamingContext context)
static Thing CopyDNA(Thing from, Thing to)
static Thing GenerateRandomGene(int lv=-1, int seed=-1)
static Type GetType(string idMat)
static Thing GenerateManiGene(Card owner)
string GetMaterialId(Type type)
void Generate(Type _type, Chara model=null)
static Thing GenerateGene(Chara c, Type? type=null)
Element GetInvalidAction(Chara c)
static int curve(int a, int start, int step, int rate=75)
static SourceManager sources
static int rndHalf(int a)
void Learn(int ele, int v=1)
int ValueWithoutLink(int ele)
Element ModBase(int ele, int v)
void SetTo(int id, int v)
static Element Create(int id, int v=0)
static void SetSeed(int a=-1)
Dictionary< string, CardRow > map
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
CardRow Select(int lv=-1, int levelRange=-1)
void DestroyAll(Func< Thing, bool > funcExclude=null)
static Thing Create(string id, int idMat=-1, int lv=-1)
UIItem AddText(string text, FontColor color=FontColor.DontChange)
void Space(int sizeY=0, int sizeX=1)