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;
190 c.feat -=
cost * c.GeneCostMTP / 100;
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];
234 c.
ability.
Add(num, Mathf.Abs(num2), num2 < 0);
253 for (
int i = 0; i <
vals.Count; i += 2)
294 if (
type ==
Type.Inferior || model ==
null)
308 List<Element> listAttb = model.elements.ListBestAttributes();
309 List<Element> listSkill = model.elements.ListBestSkills();
310 List<Element> listFeat = model.elements.ListGeneFeats();
312 if (listFeat.Count == 0)
314 listFeat = model.ListAvailabeFeats(pet:
true);
337 for (
int i = 0; i < 10; i++)
358 if (model.ability.list.items.Count != 0)
363 AddVal(a.
act.
source.id, a.
chance * ((!a.
pt) ? 1 : (-1)), allowStack:
false, (
int v) => 8 + a.
act.
source.cost[0] / 10 * 2, allowNegative:
true);
378 for (
int j = 0; j < 100; j++)
380 BodySlot bodySlot2 = model.body.slots.RandomItem();
383 bodySlot = bodySlot2;
387 if (bodySlot !=
null)
389 AddVal(bodySlot.
elementId, 1, allowStack:
false, (
int v) => 20, allowNegative:
false);
396 if (listFeat.Count != 0)
399 Element e = listFeat.RandomItem();
400 if (maxSlot <= 1 || e.
source.geneSlot <= 1)
402 if (e.
source.geneSlot > maxSlot)
404 maxSlot = e.
source.geneSlot;
406 AddVal(e.
id, 1, allowStack:
false, (
int v) => e.
source.cost[0] * 5, allowNegative:
false);
410 void AddRandom(
int n)
412 for (
int l = 0; l < n; l++)
430 Element element2 = listSkill[Mathf.Clamp(
EClass.
rnd(6), 0, listSkill.Count - 1)];
443 else if (listFeat.Count > 0)
456 void AddVal(
int id,
int v,
bool allowStack, Func<int, int> funcCost,
bool allowNegative)
458 if (v >= 0 || allowNegative)
464 num =
EClass.
curve(Mathf.Abs(v + 100), 20, 10, 90);
467 for (
int k = 0; k <
vals.Count; k += 2)
476 Debug.Log(
vals[k + 1] +
": " + v +
"/" + num);
490 cost += Mathf.Max(0, funcCost(num));
507 for (
int i = 0; i <
vals.Count; i += 2)
510 if (element.
source.geneSlot < 0)
529 "jelly" =>
Type.Default,
530 "gold" =>
Type.Superior,
531 "amethyst" =>
Type.Brain,
540 Type.Default =>
"jelly",
541 Type.Superior =>
"gold",
542 Type.Brain =>
"amethyst",
549 return Mathf.Min(
cost, 5000) * Mathf.Min(
cost, 5000) / 2;
556 return Type.Superior;
560 return Type.Inferior;
572 return "gene".lang(text.ToTitleCase(), (
cost == 0) ?
"" : (
cost.ToString() ??
""));
594 for (
int i = 0; i <
vals.Count; i += 2)
597 int num2 =
vals[i + 1];
599 string @ref = (num + 1).ToString() ??
"";
601 num2 = Mathf.Abs(num2 / 20) + 1;
602 text = text +
"[" +
"*".Repeat(Mathf.Clamp(num2, 1, 5)) + ((num2 > 5) ?
"+" :
"") +
"]";
603 n.
AddText(
"NoteText_enc",
"gene_info_brain".lang(@ref, text), color);
607 for (
int j = 0; j <
vals.Count; j += 2)
611 int num3 = element.Value / 10;
614 switch (element.
source.category)
634 text2 = text2 +
"[" +
"*".Repeat(Mathf.Clamp(num3, 1, 5)) + ((num3 > 5) ?
"+" :
"") +
"]";
638 text2 = text2 +
" (" + element.Value +
")";
640 n.
AddText(
"NoteText_enc",
"gene_info".lang(element.
Name.ToTitleCase(wholeText:
true), text2), color2);
646 n.
AddHeader(
"HeaderAdditionalTrait",
"gene_hint");
654 int num3 = num2 - num;
656 n.
AddText(
"gene_hint_slot".lang(num2.ToString() ??
"", num3.ToString() ??
"", maxGeneSlot.ToString() ??
""), (num3 >= 0) ?
FontColor.Good :
FontColor.Bad);
657 int num4 =
cost * tg.GeneCostMTP / 100;
658 int num5 = tg.feat - num4;
664 for (
int i = 0; i <
vals.Count; i += 2)
671 if (!(element.
source.category ==
"feat"))
678 if (orCreateElement !=
null && orCreateElement.
vLink == 0)
690 for (
int i = 0; i <
vals.Count; i += 2)
693 if (!(element.
source.category ==
"ability"))
699 if (
item.act.source.id == element.
id)
710 int num = c.
Evalue(6608) + 10;
711 for (
int i = 0; i <
vals.Count; i += 2)
714 if ((element.
source.category ==
"attribute" || element.
source.category ==
"skill") &&
vals[i + 1] > num)
ElementContainerCard elements
SourceMaterial.Row material
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Card MakeRefFrom(string id)
bool HasElement(int ele, bool includeNagative=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 WriteNoteExtra(UINote n, Chara tg)
void WriteNote(UINote n, Chara tg=null)
void MakeSlimeFood(Chara c)
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(long _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)
Element GetOrCreateElement(Element ele)
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 AddHeader(string text, Sprite sprite=null)
UIItem AddText(string text, FontColor color=FontColor.DontChange)
void Space(int sizeY=0, int sizeX=1)