Elin Decompiled Documentation EA 23.357 Nightly
Loading...
Searching...
No Matches
TraitFoodEggFertilized.cs
Go to the documentation of this file.
2{
3 public override int DecaySpeed => 1;
4
5 public static Chara Incubate(Thing egg, Point pos, Card incubator = null)
6 {
7 egg.SetSale(sale: false);
8 string str = "";
9 CardRow refCard = egg.refCard;
10 if (refCard != null)
11 {
12 str = refCard.id;
13 if (refCard.id == "chara" || refCard.quality == 4)
14 {
15 str = "";
16 }
17 }
18 if (egg.IsDecayed)
19 {
20 str = "zombie";
21 }
22 Chara chara = CharaGen.Create(str.IsEmpty("chicken"));
23 EClass._zone.AddCard(chara, pos.GetNearestPoint(allowBlock: false, allowChara: false) ?? EClass.pc.pos);
24 chara.SetLv(1);
25 chara.SetMainElement(egg.c_idMainElement, 10, elemental: true);
26 chara.things.DestroyAll();
27 MakeBaby(chara, (incubator == null) ? 2 : 3);
28 if (chara.Evalue(1644) > 0)
29 {
30 for (int i = 0; i < chara.Evalue(1644); i++)
31 {
32 chara.RemoveLastBodyPart();
33 }
34 chara.elements.SetBase(1644, 0);
35 }
36 foreach (Element value in chara.elements.dict.Values)
37 {
38 if ((!(value.source.category != "attribute") || !(value.source.category != "skill")) && (!(value.source.category == "attribute") || value.source.tag.Contains("primary")) && value.ValueWithoutLink != 0)
39 {
40 value.vTempPotential = value.vTempPotential * 2 + 100;
41 value.vPotential += 30;
42 }
43 }
44 if (!egg.isNPCProperty)
45 {
46 FactionBranch factionBranch = EClass.Branch ?? EClass.pc.homeBranch;
47 if (factionBranch != null)
48 {
49 factionBranch.AddMemeber(chara);
50 factionBranch.ChangeMemberType(chara, EClass._zone.IsPCFaction ? FactionMemberType.Livestock : FactionMemberType.Default);
52 {
54 }
55 }
56 }
57 Msg.Say("incubate", chara);
59 return chara;
60 }
61
62 public static void MakeBaby(Chara c, int baby)
63 {
64 c.SetFeat(1232, baby, msg: true);
65 c.isScaled = true;
66 switch (c.id)
67 {
68 case "putty_snow":
69 if (c.idSkin <= 3)
70 {
71 c.idSkin = 4 + c.idSkin * 2 + EClass.rnd(2);
72 }
73 break;
74 case "putty_snow_gold":
75 if (c.idSkin == 0)
76 {
77 c.idSkin = 1 + EClass.rnd(2);
78 }
79 break;
80 case "shamo":
81 case "chicken":
82 case "duck":
83 case "penguin":
84 case "penguin_emperor":
85 c.idSkin = 1;
86 break;
87 }
88 c.bio.birthDay = EClass.world.date.day;
89 c.bio.birthMonth = EClass.world.date.month;
90 c.bio.SetAge(c, 0);
91 }
92
93 public override bool CanStackTo(Thing to)
94 {
96 {
97 return false;
98 }
99 return base.CanStackTo(to);
100 }
101}
FactionMemberType
void SetAge(Chara c, int a)
Definition: Biography.cs:297
int quality
Definition: CardRow.cs:19
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
int c_idMainElement
Definition: Card.cs:1453
ElementContainerCard elements
Definition: Card.cs:42
string id
Definition: Card.cs:36
Biography bio
Definition: Card.cs:45
Card SetLv(int a)
Definition: Card.cs:3070
Point pos
Definition: Card.cs:60
ThingContainer things
Definition: Card.cs:39
int Evalue(int ele)
Definition: Card.cs:2704
int idSkin
Definition: Card.cs:365
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Definition: Chara.cs:10
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:10560
Party party
Definition: Chara.cs:45
void SetMainElement(string id, int v=0, bool elemental=false)
Definition: Chara.cs:2302
void RemoveLastBodyPart(bool msg=false)
Definition: Chara.cs:2429
FactionBranch homeBranch
Definition: Chara.cs:1115
int month
Definition: Date.cs:50
int day
Definition: Date.cs:62
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static int rnd(long a)
Definition: EClass.cs:59
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
Element SetBase(string alias, int v, int potential=0)
int ValueWithoutLink
Definition: ELEMENT.cs:303
SourceElement.Row source
Definition: ELEMENT.cs:282
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:71
long eggHatched
Definition: Player.cs:201
Stats stats
Definition: Player.cs:1095
Definition: Point.cs:9
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:620
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:28
GameDate date
Definition: World.cs:6
bool IsPCFaction
Definition: Zone.cs:480
Card AddCard(Card t, Point point)
Definition: Zone.cs:2159