Elin Decompiled Documentation EA 23.130 Nightly
Loading...
Searching...
No Matches
TraitBookSkill.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Linq;
3
5{
6 public int idEle => owner.refVal;
7
9
10 public virtual bool IsPlan => false;
11
12 public override string IdNoRestock => owner.id + "_" + source?.id;
13
14 public override bool IsOnlyUsableByPc
15 {
16 get
17 {
18 if (source != null)
19 {
20 return source.category == "ability";
21 }
22 return false;
23 }
24 }
25
26 public override bool CanRead(Chara c)
27 {
28 return !c.isBlind;
29 }
30
31 public override int GetActDuration(Chara c)
32 {
33 return 5;
34 }
35
36 public override void OnCreate(int lv)
37 {
38 IEnumerable<SourceElement.Row> ie = EClass.sources.elements.rows.Where(delegate(SourceElement.Row a)
39 {
40 if (a.chance == 0)
41 {
42 return false;
43 }
44 if (a.tag.Contains("hidden") || a.tag.Contains("unused"))
45 {
46 return false;
47 }
48 if (IsPlan)
49 {
50 if (a.category != "policy" && a.category != "tech")
51 {
52 return false;
53 }
54 if (a.cost.Length == 0 || (a.category == "tech" && a.cost[0] == 0))
55 {
56 return false;
57 }
58 }
59 else if (a.category != "skill")
60 {
61 return false;
62 }
63 return true;
64 });
65 owner.refVal = ie.RandomItem().id;
66 }
67
68 public override void SetName(ref string s)
69 {
70 if (idEle != 0)
71 {
72 string text = "";
73 if ((EClass.sources.elements.map.TryGetValue(idEle) ?? EClass.sources.elements.map[0]).category == "policy")
74 {
75 text = " (" + "policy".lang() + ")";
76 }
77 s = "_of".lang((source.GetName() + text).Bracket(1), s);
78 if (IsPlan && EClass.pc.homeBranch != null && EClass.pc.homeBranch.elements.HasBase(idEle))
79 {
80 s = s + " " + "alreadyLearned".lang();
81 }
82 }
83 }
84
85 public override void OnRead(Chara c)
86 {
87 if (IsPlan && !c.IsPC)
88 {
89 return;
90 }
91 if (IsPlan && !EClass._zone.IsPCFaction)
92 {
93 owner.Say("skillbook_invalidZone");
94 return;
95 }
96 if (IsPlan && EClass.Branch.elements.HasBase(idEle))
97 {
98 owner.Say("skillbook_knownSkill", c, source.GetName());
99 return;
100 }
101 if (IsOnlyUsableByPc && !c.IsPC)
102 {
103 owner.SayNothingHappans();
104 return;
105 }
106 owner.Say(IsPlan ? "skillbook_learnPlan" : "skillbook_learn", c, source.GetName());
107 if (IsPlan)
108 {
110 if (source.category == "policy" && !EClass.Branch.policies.HasPolicy(idEle))
111 {
113 }
114 foreach (FactionBranch child in EClass.pc.faction.GetChildren())
115 {
117 }
118 }
119 else if (!c.elements.HasBase(idEle))
120 {
121 c.elements.Learn(idEle);
122 }
123 else
124 {
125 c.elements.ModExp(idEle, owner.IsBlessed ? 1500 : (owner.IsCursed ? 500 : 1000));
126 }
127 c.Say("spellbookCrumble", owner.Duplicate(1));
128 owner.ModNum(-1);
129 }
130
131 public override int GetValue()
132 {
133 return owner.sourceCard.value;
134 }
135
136 public override void WriteNote(UINote n, bool identified)
137 {
138 base.WriteNote(n, identified);
139 if (IsPlan)
140 {
141 return;
142 }
143 n.Space();
144 foreach (Chara member in EClass.pc.party.members)
145 {
146 bool flag = member.elements.HasBase(idEle);
147 n.AddText("_bullet".lang() + member.Name + " " + (flag ? "alreadyLearned" : "notLearned").lang(), flag ? FontColor.Good : FontColor.Warning);
148 }
149 }
150}
FontColor
Definition: FontColor.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
ElementContainerCard elements
Definition: Card.cs:37
string Name
Definition: Card.cs:2037
int refVal
Definition: Card.cs:190
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6232
Definition: Chara.cs:10
Faction faction
Definition: Chara.cs:417
override bool IsPC
Definition: Chara.cs:602
Party party
Definition: Chara.cs:43
bool isBlind
Definition: Chara.cs:128
FactionBranch homeBranch
Definition: Chara.cs:894
Definition: EClass.cs:5
static Zone _zone
Definition: EClass.cs:20
static SourceManager sources
Definition: EClass.cs:42
static FactionBranch Branch
Definition: EClass.cs:22
static Chara pc
Definition: EClass.cs:14
void Learn(int ele, int v=1)
void ModExp(int ele, int a, bool chain=false)
bool HasBase(int ele)
PolicyManager policies
ElementContainerZone elements
void ValidateUpgradePolicies()
List< FactionBranch > GetChildren()
Definition: FACTION.cs:200
List< Chara > members
Definition: Party.cs:18
void AddPolicy(string id)
bool HasPolicy(int id)
override string GetName()
SourceElement elements
override void SetName(ref string s)
override void WriteNote(UINote n, bool identified)
override bool CanRead(Chara c)
override SourceElement.Row source
override void OnCreate(int lv)
override void OnRead(Chara c)
override string IdNoRestock
override int GetValue()
override bool IsOnlyUsableByPc
virtual bool IsPlan
override int GetActDuration(Chara c)
Card owner
Definition: Trait.cs:26
Definition: UINote.cs:6
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
bool IsPCFaction
Definition: Zone.cs:464