Elin Modding Docs Doc
Loading...
Searching...
No Matches
Check.cs
1using System;
2using UnityEngine;
3
4// Token: 0x02000061 RID: 97
5public class Check : EClass
6{
7 // Token: 0x0600028B RID: 651 RVA: 0x00013CE4 File Offset: 0x00011EE4
8 public static Check Get(string id, float dcMod = 1f)
9 {
10 return new Check
11 {
12 id = id,
13 dcMod = dcMod
14 };
15 }
16
17 // Token: 0x1700007C RID: 124
18 // (get) Token: 0x0600028C RID: 652 RVA: 0x00013CFC File Offset: 0x00011EFC
19 public SourceCheck.Row source
20 {
21 get
22 {
23 SourceCheck.Row result;
24 if ((result = this._source) == null)
25 {
26 result = (this._source = EClass.sources.checks.map[this.id]);
27 }
28 return result;
29 }
30 }
31
32 // Token: 0x1700007D RID: 125
33 // (get) Token: 0x0600028D RID: 653 RVA: 0x00013D36 File Offset: 0x00011F36
34 public string mainElementName
35 {
36 get
37 {
38 return EClass.sources.elements.map[this.source.element].GetName();
39 }
40 }
41
42 // Token: 0x1700007E RID: 126
43 // (get) Token: 0x0600028E RID: 654 RVA: 0x00013D5C File Offset: 0x00011F5C
44 public int baseDC
45 {
46 get
47 {
48 return this.source.baseDC;
49 }
50 }
51
52 // Token: 0x0600028F RID: 655 RVA: 0x00013D6C File Offset: 0x00011F6C
53 public string GetText(Chara p, Card tg, bool inDialog = false)
54 {
55 string text = "";
56 int finalDC = this.GetFinalDC(p, tg);
57 string text2 = (finalDC > 20) ? "絶望的" : ((finalDC > 17) ? "ほぼ絶望的" : ((finalDC > 14) ? "とても難しい" : ((finalDC > 11) ? "難しい" : ((finalDC > 8) ? "普通" : ((finalDC > 5) ? "簡単" : ((finalDC > 2) ? "とても簡単" : "とても余裕"))))));
58 if (finalDC > 20 || finalDC > 15 || finalDC <= 10)
59 {
60 }
61 text = string.Concat(new string[]
62 {
63 text,
64 "DC ",
65 this.GetDC(tg).ToString(),
66 " ",
67 this.mainElementName,
68 " ",
69 text2
70 });
71 return string.Concat(new string[]
72 {
73 text,
74 " ",
75 this.source.element.ToString(),
76 "/",
77 EClass.sources.elements.map[this.source.element].alias
78 });
79 }
80
81 // Token: 0x06000290 RID: 656 RVA: 0x00013E94 File Offset: 0x00012094
82 public int GetDC(Card tg = null)
83 {
84 float num = (float)this.baseDC * this.dcMod;
85 if (tg == null)
86 {
87 return (int)num;
88 }
89 num += this.source.lvMod * (float)tg.LV;
90 if (this.source.targetElement != 0)
91 {
92 Element element = tg.elements.GetElement(this.source.element);
93 if (element != null)
94 {
95 num += (float)element.Value;
96 if (this.source.targetSubFactor > 0f && !element.source.aliasParent.IsEmpty())
97 {
98 Element element2 = tg.elements.GetElement(element.source.aliasParent);
99 if (element2 != null)
100 {
101 num += this.source.targetSubFactor * (float)element2.Value;
102 }
103 }
104 }
105 }
106 return (int)num;
107 }
108
109 // Token: 0x06000291 RID: 657 RVA: 0x00013F54 File Offset: 0x00012154
110 public int GetFinalDC(Chara p, Card tg = null)
111 {
112 int num = this.GetDC(tg);
113 if (this.source.element != 0)
114 {
115 Element element = p.elements.GetElement(this.source.element);
116 if (element != null)
117 {
118 num -= element.Value;
119 if (this.source.subFactor > 0f && !element.source.aliasParent.IsEmpty())
120 {
121 Element element2 = p.elements.GetElement(element.source.aliasParent);
122 if (element2 != null)
123 {
124 num -= (int)(this.source.subFactor * (float)element2.Value);
125 }
126 }
127 }
128 }
129 if (num > 14)
130 {
131 num = 14 + (int)Mathf.Sqrt((float)(num - 14));
132 }
133 else if (num < 6)
134 {
135 num = 6 - (int)Mathf.Sqrt((float)(6 - num));
136 }
137 return num;
138 }
139
140 // Token: 0x06000292 RID: 658 RVA: 0x00014018 File Offset: 0x00012218
141 public Check.Result Perform(Chara p, Card tg = null)
142 {
143 int finalDC = this.GetFinalDC(p, tg);
144 int num = Dice.Roll(1, 20, 0, null);
145 if (EClass.debug.logDice)
146 {
147 string text = string.Concat(new string[]
148 {
149 "Check:",
150 this.source.id,
151 " dc=",
152 finalDC.ToString(),
153 " roll=",
154 num.ToString(),
155 " "
156 });
157 if (num == 20)
158 {
159 text += "CriticalPass";
160 }
161 else if (num == 1)
162 {
163 text += "CriticalFail";
164 }
165 else if (num >= finalDC)
166 {
167 text += "Pass";
168 }
169 else
170 {
171 text += "Fail";
172 }
173 Debug.Log(text);
174 }
175 if (num == 20)
176 {
177 return Check.Result.CriticalPass;
178 }
179 if (num == 1)
180 {
181 return Check.Result.CriticalFail;
182 }
183 if (num >= finalDC)
184 {
185 return Check.Result.Pass;
186 }
187 return Check.Result.Fail;
188 }
189
190 // Token: 0x06000293 RID: 659 RVA: 0x000140F4 File Offset: 0x000122F4
191 public Check.Result Perform(Chara p, Card tg, Action<Check.Result> action)
192 {
193 Check.Result result = this.Perform(p, tg);
194 if (action != null)
195 {
196 action(result);
197 }
198 return result;
199 }
200
201 // Token: 0x0400051E RID: 1310
202 public SourceCheck.Row _source;
203
204 // Token: 0x0400051F RID: 1311
205 public string id;
206
207 // Token: 0x04000520 RID: 1312
208 public float dcMod;
209
210 // Token: 0x020007D5 RID: 2005
211 public enum Result
212 {
213 // Token: 0x040021FC RID: 8700
214 CriticalPass,
215 // Token: 0x040021FD RID: 8701
216 Pass,
217 // Token: 0x040021FE RID: 8702
218 Fail,
219 // Token: 0x040021FF RID: 8703
220 CriticalFail
221 }
222
223 // Token: 0x020007D6 RID: 2006
224 public enum Output
225 {
226 // Token: 0x04002201 RID: 8705
227 None,
228 // Token: 0x04002202 RID: 8706
229 Default
230 }
231}
Definition Card.cs:13
Definition Chara.cs:12
Definition Check.cs:6
Definition Dice.cs:7