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);
259 for (
int i = 0; i <
vals.Count; i += 2)
300 if (
type ==
Type.Inferior || model ==
null)
314 List<Element> listAttb = model.elements.ListBestAttributes();
315 List<Element> listSkill = model.elements.ListBestSkills();
316 List<Element> listFeat = model.elements.ListGeneFeats();
318 if (listFeat.Count == 0)
320 listFeat = model.ListAvailabeFeats(pet:
true);
343 for (
int i = 0; i < 10; i++)
364 if (model.ability.list.items.Count != 0)
369 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);
384 for (
int j = 0; j < 100; j++)
386 BodySlot bodySlot2 = model.body.slots.RandomItem();
389 bodySlot = bodySlot2;
393 if (bodySlot !=
null)
395 AddVal(bodySlot.
elementId, 1, allowStack:
false, (
int v) => 20, allowNegative:
false);
402 if (listFeat.Count != 0)
405 Element e = listFeat.RandomItem();
406 if (maxSlot <= 1 || e.
source.geneSlot <= 1)
408 if (e.
source.geneSlot > maxSlot)
410 maxSlot = e.
source.geneSlot;
412 AddVal(e.
id, 1, allowStack:
false, (
int v) => e.
source.cost[0] * 5, allowNegative:
false);
416 void AddRandom(
int n)
418 for (
int l = 0; l < n; l++)
436 Element element2 = listSkill[Mathf.Clamp(
EClass.
rnd(6), 0, listSkill.Count - 1)];
449 else if (listFeat.Count > 0)
462 void AddVal(
int id,
int v,
bool allowStack, Func<int, int> funcCost,
bool allowNegative)
464 if (v >= 0 || allowNegative)
470 num =
EClass.
curve(Mathf.Abs(v + 100), 20, 10, 90);
473 for (
int k = 0; k <
vals.Count; k += 2)
482 Debug.Log(
vals[k + 1] +
": " + v +
"/" + num);
496 cost += Mathf.Max(0, funcCost(num));
513 for (
int i = 0; i <
vals.Count; i += 2)
516 if (element.
source.geneSlot < 0)
535 "jelly" =>
Type.Default,
536 "gold" =>
Type.Superior,
537 "amethyst" =>
Type.Brain,
546 Type.Default =>
"jelly",
547 Type.Superior =>
"gold",
548 Type.Brain =>
"amethyst",
555 return Mathf.Min(
cost, 5000) * Mathf.Min(
cost, 5000) / 2;
562 return Type.Superior;
566 return Type.Inferior;
578 return "gene".lang(text.ToTitleCase(), (
cost == 0) ?
"" : (
cost.ToString() ??
""));
600 for (
int i = 0; i <
vals.Count; i += 2)
603 int num2 =
vals[i + 1];
605 string @ref = (num + 1).ToString() ??
"";
607 num2 = Mathf.Abs(num2 / 20) + 1;
608 text = text +
"[" +
"*".Repeat(Mathf.Clamp(num2, 1, 5)) + ((num2 > 5) ?
"+" :
"") +
"]";
609 n.
AddText(
"NoteText_enc",
"gene_info_brain".lang(@ref, text), color);
613 for (
int j = 0; j <
vals.Count; j += 2)
617 int num3 = element.Value / 10;
620 switch (element.
source.category)
640 text2 = text2 +
"[" +
"*".Repeat(Mathf.Clamp(num3, 1, 5)) + ((num3 > 5) ?
"+" :
"") +
"]";
644 text2 = text2 +
" (" + element.Value +
")";
646 n.
AddText(
"NoteText_enc",
"gene_info".lang(element.
Name.ToTitleCase(wholeText:
true), text2), color2);
652 n.
AddHeader(
"HeaderAdditionalTrait",
"gene_hint");
660 int num3 = num2 - num;
662 n.
AddText(
"gene_hint_slot".lang(num2.ToString() ??
"", num3.ToString() ??
"", maxGeneSlot.ToString() ??
""), (num3 >= 0) ?
FontColor.Good :
FontColor.Bad);
663 int num4 =
cost * tg.GeneCostMTP / 100;
664 int num5 = tg.feat - num4;
670 for (
int i = 0; i <
vals.Count; i += 2)
677 if (!(element.
source.category ==
"feat"))
684 if (orCreateElement !=
null && orCreateElement.
vLink == 0)
696 for (
int i = 0; i <
vals.Count; i += 2)
699 if (!(element.
source.category ==
"ability"))
705 if (
item.act.source.id == element.
id)
716 for (
int i = 0; i <
vals.Count; i += 2)
719 if (element.
source.category ==
"slot")
729 for (
int i = 0; i <
vals.Count; i += 2)
740 int num = c.
Evalue(6608) + 10;
741 for (
int i = 0; i <
vals.Count; i += 2)
744 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 Refresh(bool calledRecursive=false)
void SetFeat(int id, int value=1, bool msg=false)
void RefreshFaithElement()
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)
void ReplaceBodySlot(int slot)
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)