Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
TraitFoodEggFertilized.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
5 public override int DecaySpeed => 1;
6
7 public static Chara Incubate(Thing egg, Point pos, Card incubator = null)
8 {
9 egg.SetSale(sale: false);
10 string str = "";
11 CardRow refCard = egg.refCard;
12 if (refCard != null)
13 {
14 str = refCard.id;
15 if (refCard.id == "chara" || refCard.quality == 4)
16 {
17 str = "";
18 }
19 }
20 if (egg.IsDecayed)
21 {
22 str = "zombie";
23 }
24 Chara chara = CharaGen.Create(str.IsEmpty("chicken"));
25 EClass._zone.AddCard(chara, pos.GetNearestPoint(allowBlock: false, allowChara: false) ?? EClass.pc.pos);
26 chara.SetLv(1);
27 chara.SetMainElement(egg.c_idMainElement, 10, elemental: true);
28 chara.things.DestroyAll();
29 MakeBaby(chara, (incubator == null) ? 2 : 3);
30 if (chara.Evalue(1644) > 0)
31 {
32 for (int i = 0; i < chara.Evalue(1644); i++)
33 {
34 chara.RemoveLastBodyPart();
35 Debug.Log(i + "/" + chara.body.slots.Count);
36 }
37 chara.elements.SetBase(1644, 0);
38 }
39 foreach (Element value in chara.elements.dict.Values)
40 {
41 if ((!(value.source.category != "attribute") || !(value.source.category != "skill")) && (!(value.source.category == "attribute") || value.source.tag.Contains("primary")) && value.ValueWithoutLink != 0)
42 {
43 value.vTempPotential = value.vTempPotential * 2 + 100;
44 value.vPotential += 30;
45 }
46 }
47 if (!egg.isNPCProperty)
48 {
49 FactionBranch factionBranch = EClass.Branch ?? EClass.pc.homeBranch;
50 if (factionBranch != null)
51 {
52 factionBranch.AddMemeber(chara);
53 factionBranch.ChangeMemberType(chara, EClass._zone.IsPCFaction ? FactionMemberType.Livestock : FactionMemberType.Default);
55 {
57 }
58 }
59 }
60 Msg.Say("incubate", chara);
61 return chara;
62 }
63
64 public static void MakeBaby(Chara c, int baby)
65 {
66 c.SetFeat(1232, baby, msg: true);
67 switch (c.id)
68 {
69 case "putty_snow":
70 if (c.idSkin <= 3)
71 {
72 c.idSkin = 4 + c.idSkin * 2 + EClass.rnd(2);
73 }
74 break;
75 case "putty_snow_gold":
76 if (c.idSkin == 0)
77 {
78 c.idSkin = 1 + EClass.rnd(2);
79 }
80 break;
81 case "shamo":
82 case "chicken":
83 case "duck":
84 c.idSkin = 1;
85 break;
86 }
87 }
88
89 public override bool CanStackTo(Thing to)
90 {
92 {
93 return false;
94 }
95 return base.CanStackTo(to);
96 }
97}
FactionMemberType
int quality
Definition: CardRow.cs:19
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
int c_idMainElement
Definition: Card.cs:1337
ElementContainerCard elements
Definition: Card.cs:37
string id
Definition: Card.cs:31
Card SetLv(int a)
Definition: Card.cs:2735
Point pos
Definition: Card.cs:55
ThingContainer things
Definition: Card.cs:34
int Evalue(int ele)
Definition: Card.cs:2431
int idSkin
Definition: Card.cs:346
List< BodySlot > slots
Definition: CharaBody.cs:8
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Definition: Chara.cs:10
CharaBody body
Definition: Chara.cs:91
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:8964
Party party
Definition: Chara.cs:43
void SetMainElement(string id, int v=0, bool elemental=false)
Definition: Chara.cs:1804
void RemoveLastBodyPart(bool msg=false)
Definition: Chara.cs:1931
FactionBranch homeBranch
Definition: Chara.cs:889
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
static Zone _zone
Definition: EClass.cs:20
static Chara pc
Definition: EClass.cs:14
Element SetBase(string alias, int v, int potential=0)
int ValueWithoutLink
Definition: ELEMENT.cs:284
SourceElement.Row source
Definition: ELEMENT.cs:263
void ChangeMemberType(Chara c, FactionMemberType type)
void AddMemeber(Chara c)
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
void AddMemeber(Chara c, bool showMsg=false)
Definition: Party.cs:51
Definition: Point.cs:9
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
Definition: Point.cs:595
void DestroyAll(Func< Thing, bool > funcExclude=null)
Definition: Thing.cs:8
static Chara Incubate(Thing egg, Point pos, Card incubator=null)
override bool CanStackTo(Thing to)
static void MakeBaby(Chara c, int baby)
Card owner
Definition: Trait.cs:26
bool IsPCFaction
Definition: Zone.cs:464
Card AddCard(Card t, Point point)
Definition: Zone.cs:1893