Elin Modding Docs Doc
Loading...
Searching...
No Matches
TraitBookSkill.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4
5// Token: 0x0200035C RID: 860
7{
8 // Token: 0x06001AAA RID: 6826 RVA: 0x000A5B78 File Offset: 0x000A3D78
9 public override bool CanRead(Chara c)
10 {
11 return !c.isBlind;
12 }
13
14 // Token: 0x170007CD RID: 1997
15 // (get) Token: 0x06001AAB RID: 6827 RVA: 0x000A5B83 File Offset: 0x000A3D83
16 public int idEle
17 {
18 get
19 {
20 return this.owner.refVal;
21 }
22 }
23
24 // Token: 0x170007CE RID: 1998
25 // (get) Token: 0x06001AAC RID: 6828 RVA: 0x000A5B90 File Offset: 0x000A3D90
26 public override SourceElement.Row source
27 {
28 get
29 {
30 return EClass.sources.elements.map[this.idEle];
31 }
32 }
33
34 // Token: 0x06001AAD RID: 6829 RVA: 0x000A5BAC File Offset: 0x000A3DAC
35 public override int GetActDuration(Chara c)
36 {
37 return 5;
38 }
39
40 // Token: 0x170007CF RID: 1999
41 // (get) Token: 0x06001AAE RID: 6830 RVA: 0x000A5BAF File Offset: 0x000A3DAF
42 public virtual bool IsPlan
43 {
44 get
45 {
46 return false;
47 }
48 }
49
50 // Token: 0x06001AAF RID: 6831 RVA: 0x000A5BB4 File Offset: 0x000A3DB4
51 public override void OnCreate(int lv)
52 {
53 IEnumerable<SourceElement.Row> ie = EClass.sources.elements.rows.Where(delegate(SourceElement.Row a)
54 {
55 if (a.chance == 0)
56 {
57 return false;
58 }
59 if (a.tag.Contains("hidden") || a.tag.Contains("unused"))
60 {
61 return false;
62 }
63 if (this.IsPlan)
64 {
65 if (a.category != "policy" && a.category != "tech")
66 {
67 return false;
68 }
69 if (a.cost.Length == 0 || (a.category == "tech" && a.cost[0] == 0))
70 {
71 return false;
72 }
73 }
74 else if (a.category != "skill")
75 {
76 return false;
77 }
78 return true;
79 });
80 this.owner.refVal = ie.RandomItem<SourceElement.Row>().id;
81 }
82
83 // Token: 0x06001AB0 RID: 6832 RVA: 0x000A5BF8 File Offset: 0x000A3DF8
84 public override void SetName(ref string s)
85 {
86 if (this.idEle == 0)
87 {
88 return;
89 }
90 s = "_of".lang(this.source.GetName().Bracket(1), s, null, null, null);
91 if (this.IsPlan && EClass.pc.homeBranch != null && EClass.pc.homeBranch.elements.HasBase(this.idEle))
92 {
93 s += "alreadyLearned".lang();
94 }
95 }
96
97 // Token: 0x06001AB1 RID: 6833 RVA: 0x000A5C74 File Offset: 0x000A3E74
98 public override void OnRead(Chara c)
99 {
100 if (this.IsPlan && !c.IsPC)
101 {
102 return;
103 }
104 if (this.IsPlan && !EClass._zone.IsPCFaction)
105 {
106 this.owner.Say("skillbook_invalidZone", null, null);
107 return;
108 }
109 if (this.IsPlan && EClass.Branch.elements.HasBase(this.idEle))
110 {
111 this.owner.Say("skillbook_knownSkill", c, this.source.GetName(), null);
112 return;
113 }
114 this.owner.Say(this.IsPlan ? "skillbook_learnPlan" : "skillbook_learn", c, this.source.GetName(), null);
115 if (this.IsPlan)
116 {
117 EClass.Branch.elements.Learn(this.idEle, 1);
118 if (this.source.category == "policy" && !EClass.Branch.policies.HasPolicy(this.idEle))
119 {
120 EClass.Branch.policies.AddPolicy(this.idEle, true);
121 }
122 using (List<FactionBranch>.Enumerator enumerator = EClass.pc.faction.GetChildren().GetEnumerator())
123 {
124 while (enumerator.MoveNext())
125 {
126 FactionBranch factionBranch = enumerator.Current;
127 factionBranch.ValidateUpgradePolicies();
128 }
129 goto IL_1A9;
130 }
131 }
132 if (!c.elements.HasBase(this.idEle))
133 {
134 c.elements.Learn(this.idEle, 1);
135 }
136 else
137 {
138 c.elements.ModExp(this.idEle, this.owner.IsBlessed ? 1500 : (this.owner.IsCursed ? 500 : 1000), false);
139 }
140 IL_1A9:
141 c.Say("spellbookCrumble", this.owner.Duplicate(1), null, null);
142 this.owner.ModNum(-1, true);
143 }
144
145 // Token: 0x06001AB2 RID: 6834 RVA: 0x000A5E60 File Offset: 0x000A4060
146 public override int GetValue()
147 {
148 return this.owner.sourceCard.value;
149 }
150
151 // Token: 0x06001AB3 RID: 6835 RVA: 0x000A5E74 File Offset: 0x000A4074
152 public override void WriteNote(UINote n, bool identified)
153 {
154 base.WriteNote(n, identified);
155 if (!this.IsPlan)
156 {
157 n.Space(0, 1);
158 foreach (Chara chara in EClass.pc.party.members)
159 {
160 bool flag = chara.elements.HasBase(this.idEle);
161 n.AddText("_bullet".lang() + chara.Name + (flag ? "alreadyLearned" : "notLearned").lang(), flag ? FontColor.Good : FontColor.Warning);
162 }
163 }
164 }
165}
Definition Chara.cs:12