Elin Decompiled Documentation EA 23.102 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 bool CanRead(Chara c)
13 {
14 return !c.isBlind;
15 }
16
17 public override int GetActDuration(Chara c)
18 {
19 return 5;
20 }
21
22 public override void OnCreate(int lv)
23 {
24 IEnumerable<SourceElement.Row> ie = EClass.sources.elements.rows.Where(delegate(SourceElement.Row a)
25 {
26 if (a.chance == 0)
27 {
28 return false;
29 }
30 if (a.tag.Contains("hidden") || a.tag.Contains("unused"))
31 {
32 return false;
33 }
34 if (IsPlan)
35 {
36 if (a.category != "policy" && a.category != "tech")
37 {
38 return false;
39 }
40 if (a.cost.Length == 0 || (a.category == "tech" && a.cost[0] == 0))
41 {
42 return false;
43 }
44 }
45 else if (a.category != "skill")
46 {
47 return false;
48 }
49 return true;
50 });
51 owner.refVal = ie.RandomItem().id;
52 }
53
54 public override void SetName(ref string s)
55 {
56 if (idEle != 0)
57 {
58 string text = "";
59 if ((EClass.sources.elements.map.TryGetValue(idEle) ?? EClass.sources.elements.map[0]).category == "policy")
60 {
61 text = " (" + "policy".lang() + ")";
62 }
63 s = "_of".lang((source.GetName() + text).Bracket(1), s);
64 if (IsPlan && EClass.pc.homeBranch != null && EClass.pc.homeBranch.elements.HasBase(idEle))
65 {
66 s = s + " " + "alreadyLearned".lang();
67 }
68 }
69 }
70
71 public override void OnRead(Chara c)
72 {
73 if (IsPlan && !c.IsPC)
74 {
75 return;
76 }
77 if (IsPlan && !EClass._zone.IsPCFaction)
78 {
79 owner.Say("skillbook_invalidZone");
80 return;
81 }
82 if (IsPlan && EClass.Branch.elements.HasBase(idEle))
83 {
84 owner.Say("skillbook_knownSkill", c, source.GetName());
85 return;
86 }
87 owner.Say(IsPlan ? "skillbook_learnPlan" : "skillbook_learn", c, source.GetName());
88 if (IsPlan)
89 {
91 if (source.category == "policy" && !EClass.Branch.policies.HasPolicy(idEle))
92 {
94 }
95 foreach (FactionBranch child in EClass.pc.faction.GetChildren())
96 {
98 }
99 }
100 else if (!c.elements.HasBase(idEle))
101 {
102 c.elements.Learn(idEle);
103 }
104 else
105 {
106 c.elements.ModExp(idEle, owner.IsBlessed ? 1500 : (owner.IsCursed ? 500 : 1000));
107 }
108 c.Say("spellbookCrumble", owner.Duplicate(1));
109 owner.ModNum(-1);
110 }
111
112 public override int GetValue()
113 {
114 return owner.sourceCard.value;
115 }
116
117 public override void WriteNote(UINote n, bool identified)
118 {
119 base.WriteNote(n, identified);
120 if (IsPlan)
121 {
122 return;
123 }
124 n.Space();
125 foreach (Chara member in EClass.pc.party.members)
126 {
127 bool flag = member.elements.HasBase(idEle);
128 n.AddText("_bullet".lang() + member.Name + " " + (flag ? "alreadyLearned" : "notLearned").lang(), flag ? FontColor.Good : FontColor.Warning);
129 }
130 }
131}
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:2013
int refVal
Definition: Card.cs:190
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Definition: Chara.cs:10
Faction faction
Definition: Chara.cs:412
override bool IsPC
Definition: Chara.cs:597
Party party
Definition: Chara.cs:43
bool isBlind
Definition: Chara.cs:125
FactionBranch homeBranch
Definition: Chara.cs:889
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 int GetValue()
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