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];
231 c.
SetFeat(num, num3, !reverse);
232 if (reverse && num == 1423 && c.
GetInt(134) > 0)
251 c.
ability.
Add(num, Mathf.Abs(num2), num2 < 0);
276 for (
int i = 0; i <
vals.Count; i += 2)
283 if (num == 1228 || num == 1414)
317 if (
type ==
Type.Inferior || model ==
null)
331 List<Element> listAttb = model.elements.ListBestAttributes();
332 List<Element> listSkill = model.elements.ListBestSkills();
333 List<Element> listFeat = model.elements.ListGeneFeats();
335 if (listFeat.Count == 0)
337 listFeat = model.ListAvailabeFeats(pet:
true);
360 for (
int i = 0; i < 10; i++)
381 if (model.ability.list.items.Count != 0)
386 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);
401 for (
int j = 0; j < 100; j++)
403 BodySlot bodySlot2 = model.body.slots.RandomItem();
406 bodySlot = bodySlot2;
410 if (bodySlot !=
null)
412 AddVal(bodySlot.
elementId, 1, allowStack:
false, (
int v) => 20, allowNegative:
false);
419 if (listFeat.Count != 0)
422 Element e = listFeat.RandomItem();
423 if (maxSlot <= 1 || e.
source.geneSlot <= 1)
425 if (e.
source.geneSlot > maxSlot)
427 maxSlot = e.
source.geneSlot;
429 AddVal(e.
id, 1, allowStack:
false, (
int v) => e.
source.cost[0] * 5, allowNegative:
false);
433 void AddRandom(
int n)
435 for (
int j = 0; j < n; j++)
453 Element element = listSkill[Mathf.Clamp(
EClass.
rnd(6), 0, listSkill.Count - 1)];
466 else if (listFeat.Count > 0)
479 void AddVal(
int id,
int v,
bool allowStack, Func<int, int> funcCost,
bool allowNegative)
481 if (v >= 0 || allowNegative)
487 num =
EClass.
curve(Mathf.Abs(v + 100), 20, 10, 90);
490 for (
int j = 0; j <
vals.Count; j += 2)
499 Debug.Log(
vals[j + 1] +
": " + v +
"/" + num);
513 cost += Mathf.Max(0, funcCost(num));
530 for (
int i = 0; i <
vals.Count; i += 2)
533 if (element.
source.geneSlot < 0)
552 "jelly" =>
Type.Default,
553 "gold" =>
Type.Superior,
554 "amethyst" =>
Type.Brain,
563 Type.Default =>
"jelly",
564 Type.Superior =>
"gold",
565 Type.Brain =>
"amethyst",
572 return Mathf.Min(
cost, 5000) * Mathf.Min(
cost, 5000) / 2;
579 return Type.Superior;
583 return Type.Inferior;
595 return "gene".lang(text.ToTitleCase(), (
cost == 0) ?
"" : (
cost.ToString() ??
""));
600 if (
slot >= 1 && (owner ==
null || !(owner.category.id ==
"relic")))
617 for (
int i = 0; i <
vals.Count; i += 2)
620 int num2 =
vals[i + 1];
622 string @ref = (num + 1).ToString() ??
"";
624 num2 = Mathf.Abs(num2 / 20) + 1;
625 text = text +
"[" +
"*".Repeat(Mathf.Clamp(num2, 1, 5)) + ((num2 > 5) ?
"+" :
"") +
"]";
626 n.
AddText(
"NoteText_enc",
"gene_info_brain".lang(@ref, text), color);
630 for (
int j = 0; j <
vals.Count; j += 2)
634 int num3 = element.Value / 10;
637 switch (element.
source.category)
657 text2 = text2 +
"[" +
"*".Repeat(Mathf.Clamp(num3, 1, 5)) + ((num3 > 5) ?
"+" :
"") +
"]";
661 text2 = text2 +
" (" + element.Value +
")";
663 if ((
bool)LayerCraft.Instance && (element.source.category ==
"slot" || element.
HasTag(
"noRelic") || element.
HasTag(
"permaGene")))
667 n.
AddText(
"NoteText_enc",
"gene_info".lang(element.
Name.ToTitleCase(wholeText:
true), text2), color2);
673 n.
AddHeader(
"HeaderAdditionalTrait",
"gene_hint");
681 int num3 = num2 - num;
683 n.
AddText(
"gene_hint_slot".lang(num2.ToString() ??
"", num3.ToString() ??
"", maxGeneSlot.ToString() ??
""), (num3 >= 0) ?
FontColor.Good :
FontColor.Bad);
684 int num4 =
cost * tg.GeneCostMTP / 100;
685 int num5 = tg.feat - num4;
691 for (
int i = 0; i <
vals.Count; i += 2)
698 if (!(element.
source.category ==
"feat"))
705 if (orCreateElement !=
null && orCreateElement.
vLink == 0)
717 for (
int i = 0; i <
vals.Count; i += 2)
720 if (!(element.
source.category ==
"ability"))
726 if (
item.act.source.id == element.
id)
737 for (
int i = 0; i <
vals.Count; i += 2)
740 if (element.
source.category ==
"slot")
750 for (
int i = 0; i <
vals.Count; i += 2)
761 int num = c.
Evalue(6608) + 10;
762 for (
int i = 0; i <
vals.Count; i += 2)
765 if ((element.
source.category ==
"attribute" || element.
source.category ==
"skill") &&
vals[i + 1] > num)
775 for (
int i = 0; i <
vals.Count; i += 2)
778 if (element.
source.category ==
"slot" || element.
HasTag(
"noRelic") || element.
HasTag(
"permaGene"))
780 vals.RemoveRange(i, 2);
ElementContainerCard elements
SourceMaterial.Row material
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
void SetInt(string id, int value=0)
Card MakeRefFrom(string id)
int GetInt(string id, int? defaultInt=null)
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 WriteNote(UINote n, Thing owner=null, 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)
void WriteNoteExtra(UINote n, Thing owner, Chara tg)
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)