Elin Decompiled Documentation EA 23.287 Stable
Loading...
Searching...
No Matches
InvOwnerGene.cs
Go to the documentation of this file.
2{
3 public Chara tg;
4
5 public override ProcessType processType => ProcessType.None;
6
7 public override string langTransfer => "invGene";
8
9 public InvOwnerGene(Card owner = null, Chara _tg = null)
10 : base(owner, null, CurrencyType.None)
11 {
12 tg = _tg;
13 count = 1;
14 }
15
16 public override bool ShouldShowGuide(Thing t)
17 {
18 if (t.c_DNA != null)
19 {
20 return tg.feat >= t.c_DNA.cost;
21 }
22 return false;
23 }
24
25 public override void _OnProcess(Thing t)
26 {
27 DNA.Type type = t.c_DNA.type;
28 if (type != 0 && tg.c_genes != null)
29 {
30 int num = t.c_DNA.slot;
31 if (num > 1 && tg.HasElement(1237))
32 {
33 num--;
34 }
35 if (tg.CurrentGeneSlot + num > tg.MaxGeneSlot)
36 {
37 SE.Beep();
38 Msg.Say("tooManyGene", tg);
39 return;
40 }
41 }
42 if (type == DNA.Type.Brain)
43 {
44 if (tg.c_genes != null)
45 {
46 foreach (DNA item in tg.c_genes.items)
47 {
48 if (item.type == DNA.Type.Brain)
49 {
50 SE.Beep();
51 Msg.Say("invalidGeneBrain", tg);
52 return;
53 }
54 }
55 }
56 }
57 else
58 {
59 Element invalidFeat = t.c_DNA.GetInvalidFeat(tg);
60 if (invalidFeat != null)
61 {
62 SE.Beep();
63 Msg.Say("invalidGeneFeat", tg, invalidFeat.Name.ToTitleCase());
64 return;
65 }
66 Element invalidAction = t.c_DNA.GetInvalidAction(tg);
67 if (invalidAction != null)
68 {
69 SE.Beep();
70 Msg.Say("invalidGeneAction", tg, invalidAction.Name.ToTitleCase());
71 return;
72 }
73 }
74 SE.Play("mutation");
75 tg.PlayEffect("identify");
76 Msg.Say("gene_modify", tg, t);
77 tg.AddCard(t);
78 ConSuspend condition = tg.GetCondition<ConSuspend>();
79 condition.gene = t;
80 condition.duration = t.c_DNA.GetDurationHour();
81 condition.dateFinish = EClass.world.date.GetRaw(condition.duration);
82 }
83
84 public override void OnWriteNote(Thing t, UINote n)
85 {
86 if (ShouldShowGuide(t))
87 {
89 }
90 }
91}
CurrencyType
Definition: CurrencyType.cs:2
Definition: Card.cs:11
Card AddCard(Card c)
Definition: Card.cs:3166
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:6409
CharaGenes c_genes
Definition: Card.cs:1883
DNA c_DNA
Definition: Card.cs:1919
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6122
List< DNA > items
Definition: CharaGenes.cs:7
Definition: Chara.cs:10
int MaxGeneSlot
Definition: Chara.cs:1082
int CurrentGeneSlot
Definition: Chara.cs:1097
int duration
Definition: ConSuspend.cs:9
Definition: DNA.cs:8
void WriteNoteExtra(UINote n, Chara tg)
Definition: DNA.cs:644
Type type
Definition: DNA.cs:29
int cost
Definition: DNA.cs:41
Element GetInvalidFeat(Chara c)
Definition: DNA.cs:662
Type
Definition: DNA.cs:10
int slot
Definition: DNA.cs:77
int GetDurationHour()
Definition: DNA.cs:547
Element GetInvalidAction(Chara c)
Definition: DNA.cs:688
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
Definition: EClass.cs:6
static World world
Definition: EClass.cs:41
virtual string Name
Definition: ELEMENT.cs:309
override string langTransfer
Definition: InvOwnerGene.cs:7
override ProcessType processType
Definition: InvOwnerGene.cs:5
override void OnWriteNote(Thing t, UINote n)
Definition: InvOwnerGene.cs:84
InvOwnerGene(Card owner=null, Chara _tg=null)
Definition: InvOwnerGene.cs:9
override void _OnProcess(Thing t)
Definition: InvOwnerGene.cs:25
override bool ShouldShowGuide(Thing t)
Definition: InvOwnerGene.cs:16
Card owner
Definition: InvOwner.cs:533
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: Thing.cs:8
Definition: UINote.cs:6
GameDate date
Definition: World.cs:6