2using System.Collections.Generic;
3using System.Runtime.Serialization;
21 public int[]
ints =
new int[6];
24 public List<int>
vals =
new List<int>();
111 Array.Resize(ref
ints, 6);
135 dNA.lv = ((
lv == -1) ? r.
LV :
lv);
144 to.c_DNA = from.
c_DNA;
170 thing.c_DNA.cost = thing.c_DNA.cost / 2;
171 thing.c_DNA.isManiGene =
true;
191 Apply(c, reverse:
false);
192 c_genes.
items.Add(
this);
202 for (
int i = 0; i <
vals.Count; i += 2)
205 int num2 =
vals[i + 1];
230 c.
ability.
Add(num, Mathf.Abs(num2), num2 < 0);
249 for (
int i = 0; i <
vals.Count; i += 2)
252 if (num == 1237 || num == 1415)
283 if (
type ==
Type.Inferior || model ==
null)
297 List<Element> listAttb = model.elements.ListBestAttributes();
298 List<Element> listSkill = model.elements.ListBestSkills();
299 List<Element> listFeat = model.elements.ListGeneFeats();
301 if (listFeat.Count == 0)
303 listFeat = model.ListAvailabeFeats(pet:
true);
326 for (
int i = 0; i < 10; i++)
347 if (model.ability.list.items.Count != 0)
350 if (!(a.
act.
source.category !=
"ability"))
367 for (
int j = 0; j < 100; j++)
369 BodySlot bodySlot2 = model.body.slots.RandomItem();
372 bodySlot = bodySlot2;
376 if (bodySlot !=
null)
378 AddVal(bodySlot.
elementId, 1, allowStack:
false, (
int v) => 20);
385 if (listFeat.Count != 0)
388 Element e = listFeat.RandomItem();
389 if (maxSlot <= 1 || e.
source.geneSlot <= 1)
391 if (e.
source.geneSlot > maxSlot)
393 maxSlot = e.
source.geneSlot;
395 AddVal(e.
id, 1, allowStack:
false, (
int v) => e.
source.cost[0] * 5);
399 void AddRandom(
int n)
401 for (
int l = 0; l < n; l++)
419 Element element2 = listSkill[Mathf.Clamp(
EClass.
rnd(6), 0, listSkill.Count - 1)];
432 else if (listFeat.Count > 0)
445 void AddVal(
int id,
int v,
bool allowStack, Func<int, int> funcCost)
451 num =
EClass.
curve(Mathf.Abs(v + 100), 20, 10, 90);
454 for (
int k = 0; k <
vals.Count; k += 2)
463 Debug.Log(
vals[k + 1] +
": " + v +
"/" + num);
477 cost += Mathf.Max(0, funcCost(num));
493 for (
int i = 0; i <
vals.Count; i += 2)
496 if (element.
source.geneSlot < 0)
515 "jelly" =>
Type.Default,
516 "gold" =>
Type.Superior,
517 "amethyst" =>
Type.Brain,
526 Type.Default =>
"jelly",
527 Type.Superior =>
"gold",
528 Type.Brain =>
"amethyst",
535 return Mathf.Min(
cost, 5000) * Mathf.Min(
cost, 5000) / 2;
542 return Type.Superior;
546 return Type.Inferior;
558 return "gene".lang(text.ToTitleCase(),
cost.ToString() ??
"");
580 for (
int i = 0; i <
vals.Count; i += 2)
583 int num2 =
vals[i + 1];
585 string @ref = (num + 1).ToString() ??
"";
587 num2 = Mathf.Abs(num2 / 20) + 1;
588 text = text +
"[" +
"*".Repeat(Mathf.Clamp(num2, 1, 5)) + ((num2 > 5) ?
"+" :
"") +
"]";
589 n.
AddText(
"gene_info_brain".lang(@ref, text), color);
593 for (
int j = 0; j <
vals.Count; j += 2)
597 int num3 = element.Value / 10;
600 switch (element.
source.category)
620 text2 = text2 +
"[" +
"*".Repeat(Mathf.Clamp(num3, 1, 5)) + ((num3 > 5) ?
"+" :
"") +
"]";
624 text2 = text2 +
" (" + element.Value +
")";
626 n.
AddText(
"gene_info".lang(element.
Name.ToTitleCase(wholeText:
true), text2), color2);
632 for (
int i = 0; i <
vals.Count; i += 2)
645 for (
int i = 0; i <
vals.Count; i += 2)
648 if (!(element.
source.category ==
"ability"))
654 if (
item.act.source.id == element.
id)
ElementContainerCard elements
SourceMaterial.Row material
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Card MakeRefFrom(string id)
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)