Elin Modding Docs Doc
Loading...
Searching...
No Matches
TraitAltar.cs
1using System;
2using UnityEngine;
3
4// Token: 0x020003B8 RID: 952
5public class TraitAltar : Trait
6{
7 // Token: 0x1700086A RID: 2154
8 // (get) Token: 0x06001C1E RID: 7198 RVA: 0x000A9039 File Offset: 0x000A7239
9 public override bool CanStack
10 {
11 get
12 {
13 return false;
14 }
15 }
16
17 // Token: 0x1700086B RID: 2155
18 // (get) Token: 0x06001C1F RID: 7199 RVA: 0x000A903C File Offset: 0x000A723C
19 public override bool IsAltar
20 {
21 get
22 {
23 return true;
24 }
25 }
26
27 // Token: 0x1700086C RID: 2156
28 // (get) Token: 0x06001C20 RID: 7200 RVA: 0x000A903F File Offset: 0x000A723F
29 public bool IsBranchAltar
30 {
31 get
32 {
33 return this is TraitAltarAncient;
34 }
35 }
36
37 // Token: 0x1700086D RID: 2157
38 // (get) Token: 0x06001C21 RID: 7201 RVA: 0x000A904A File Offset: 0x000A724A
39 public override bool CanOnlyCarry
40 {
41 get
42 {
43 return this.IsBranchAltar;
44 }
45 }
46
47 // Token: 0x1700086E RID: 2158
48 // (get) Token: 0x06001C22 RID: 7202 RVA: 0x000A9052 File Offset: 0x000A7252
49 public virtual string idDeity
50 {
51 get
52 {
53 return this.owner.c_idDeity.IsEmpty("eyth");
54 }
55 }
56
57 // Token: 0x1700086F RID: 2159
58 // (get) Token: 0x06001C23 RID: 7203 RVA: 0x000A9069 File Offset: 0x000A7269
59 public virtual Religion Deity
60 {
61 get
62 {
63 return EClass.game.religions.Find(this.idDeity) ?? EClass.game.religions.Eyth;
64 }
65 }
66
67 // Token: 0x17000870 RID: 2160
68 // (get) Token: 0x06001C24 RID: 7204 RVA: 0x000A9093 File Offset: 0x000A7293
69 public string StrDeity
70 {
71 get
72 {
73 return this.Deity.NameDomain;
74 }
75 }
76
77 // Token: 0x17000871 RID: 2161
78 // (get) Token: 0x06001C25 RID: 7205 RVA: 0x000A90A0 File Offset: 0x000A72A0
79 public bool IsEyth
80 {
81 get
82 {
83 return this.idDeity == "eyth";
84 }
85 }
86
87 // Token: 0x06001C26 RID: 7206 RVA: 0x000A90B2 File Offset: 0x000A72B2
88 public override void OnCreate(int lv)
89 {
90 this.SetDeity(base.GetParam(1, null) ?? EClass.game.religions.GetRandomReligion(true, false).id);
91 }
92
93 // Token: 0x06001C27 RID: 7207 RVA: 0x000A90DC File Offset: 0x000A72DC
94 public override void OnImportMap()
95 {
96 if (this.owner.c_idDeity.IsEmpty())
97 {
98 this.SetDeity(base.GetParam(1, null) ?? EClass.game.religions.GetRandomReligion(true, false).id);
99 }
100 }
101
102 // Token: 0x06001C28 RID: 7208 RVA: 0x000A9118 File Offset: 0x000A7318
103 public void SetDeity(string id)
104 {
105 this.owner.c_idDeity = id;
106 if (this.owner.id == "altar")
107 {
108 this.owner.ChangeMaterial(this.Deity.source.idMaterial);
109 }
110 }
111
112 // Token: 0x06001C29 RID: 7209 RVA: 0x000A9164 File Offset: 0x000A7364
113 public override void SetName(ref string s)
114 {
115 if (!this.owner.c_idDeity.IsEmpty())
116 {
117 s = "_of".lang(this.StrDeity, s, null, null, null);
118 }
119 }
120
121 // Token: 0x06001C2A RID: 7210 RVA: 0x000A9190 File Offset: 0x000A7390
122 public override void TrySetAct(ActPlan p)
123 {
124 if (this.IsBranchAltar)
125 {
126 return;
127 }
128 if ((this.IsBranchAltar && EClass.Branch.rank != 0) || !this.IsBranchAltar)
129 {
130 p.TrySetAct("actOffer", delegate()
131 {
132 LayerDragGrid.CreateOffering(this);
133 return false;
134 }, this.owner, null, 1, false, true, false);
135 }
136 if (!this.IsBranchAltar && this.Deity != EClass.pc.faith && this.Deity.CanJoin)
137 {
138 p.TrySetAct("actWorship", delegate()
139 {
140 LayerDrama.currentReligion = this.Deity;
141 LayerDrama.Activate("_adv", "god", "worship", null, null, "");
142 return false;
143 }, this.owner, null, 1, false, true, false);
144 }
145 }
146
147 // Token: 0x06001C2B RID: 7211 RVA: 0x000A9230 File Offset: 0x000A7430
148 public override bool CanOffer(Card c)
149 {
150 return (c != null && c.HasTag(CTAG.godArtifact) && c.c_idDeity == this.Deity.id) || (base.CanOffer(c) && (EClass.pc.faith.GetOfferingValue(c as Thing, -1) > 0 || c.id == "water") && !c.isCopy);
151 }
152
153 // Token: 0x06001C2C RID: 7212 RVA: 0x000A92A4 File Offset: 0x000A74A4
154 public void OnOffer(Chara c, Thing t)
155 {
156 if (t == null)
157 {
158 return;
159 }
160 if (t.id == "water")
161 {
162 if (this.Deity != EClass.pc.faith)
163 {
164 if (t.blessedState == BlessedState.Cursed)
165 {
166 Msg.SayNothingHappen();
167 return;
168 }
169 Msg.Say("waterCurse", t, null, null, null);
170 EClass.pc.PlayEffect("curse", true, 0f, default(Vector3));
171 EClass.pc.PlaySound("curse3", 1f, true);
172 t.SetBlessedState(BlessedState.Cursed);
173 return;
174 }
175 else
176 {
177 if (t.blessedState == BlessedState.Blessed)
178 {
179 Msg.SayNothingHappen();
180 return;
181 }
182 Msg.Say("waterBless", t, null, null, null);
183 EClass.pc.PlayEffect("revive", true, 0f, default(Vector3));
184 EClass.pc.PlaySound("revive", 1f, true);
185 t.SetBlessedState(BlessedState.Blessed);
186 return;
187 }
188 }
189 else
190 {
191 if (!this.IsBranchAltar && EClass.pc.IsEyth)
192 {
193 EClass.pc.Say("god_offerEyth", this.owner, t, null, null);
194 return;
195 }
196 EClass.pc.Say("god_offer", this.owner, t, this.Deity.Name, null);
197 if (!this.CanOffer(t))
198 {
199 EClass.pc.Say("nothingHappens", this.owner, t, null, null);
200 return;
201 }
202 Effect.Get("debuff").Play(this.owner.pos, 0f, null, null);
203 EClass.pc.PlaySound("offering", 1f, true);
204 if (this.IsBranchAltar)
205 {
206 Msg.Say("nothingHappens");
207 }
208 else if (this.IsEyth)
209 {
210 if (EClass.pc.IsEyth)
211 {
212 Msg.Say("nothingHappens");
213 }
214 else
215 {
216 Msg.Say("takeover_empty", EClass.pc.faith.Name, null, null, null);
217 this.TakeOver();
218 this._OnOffer(c, t, 2);
219 }
220 }
221 else
222 {
223 if (t.HasTag(CTAG.godArtifact) && t.c_idDeity == this.Deity.id)
224 {
225 t.Destroy();
226 this.Deity.Reforge(t.id, null, true);
227 return;
228 }
229 if (EClass.pc.IsEyth)
230 {
231 Msg.Say("nothingHappens");
232 return;
233 }
234 if (this.Deity != EClass.pc.faith)
235 {
236 bool flag = EClass.rnd(EClass.pc.faith.GetOfferingValue(t, t.Num)) > EClass.rnd(200);
237 if (base.GetParam(1, null) != null)
238 {
239 Msg.Say("nothingHappens");
240 return;
241 }
242 Msg.Say("takeover_versus", EClass.pc.faith.Name, this.Deity.Name, null, null);
243 if (flag)
244 {
245 Msg.Say("takeover_success", EClass.pc.faith.TextGodGender, null, null, null);
246 Msg.Say("takeover_success2", EClass.pc.faith.Name, null, null, null);
247 this.TakeOver();
248 this._OnOffer(c, t, 5);
249 }
250 else
251 {
252 Msg.Say("takeover_fail", this.Deity.Name, null, null, null);
253 this.Deity.PunishTakeOver(EClass.pc);
254 }
255 }
256 else
257 {
258 this._OnOffer(c, t, 0);
259 }
260 }
261 t.Destroy();
262 return;
263 }
264 }
265
266 // Token: 0x06001C2D RID: 7213 RVA: 0x000A9600 File Offset: 0x000A7800
267 public void _OnOffer(Chara c, Thing t, int takeoverMod = 0)
268 {
269 bool @bool = t.GetBool(115);
270 int num = this.Deity.GetOfferingValue(t, t.Num);
271 num = num * (c.HasElement(1228, 1) ? 130 : 100) / 100;
272 if (takeoverMod == 0)
273 {
274 if (num >= 200)
275 {
276 Msg.Say("god_offer1", t, null, null, null);
277 EClass.pc.faith.Talk("offer", null, null);
278 }
279 else if (num >= 100)
280 {
281 Msg.Say("god_offer2", t, null, null, null);
282 }
283 else if (num >= 50)
284 {
285 Msg.Say("god_offer3", t, null, null, null);
286 }
287 else
288 {
289 Msg.Say("god_offer4", t, null, null, null);
290 }
291 }
292 else
293 {
294 Msg.Say("god_offer1", t, null, null, null);
295 num += this.Deity.GetOfferingValue(t, 1) * takeoverMod;
296 }
297 int num2 = Mathf.Max(c.Evalue(306), 1);
298 Element orCreateElement = c.elements.GetOrCreateElement(85);
299 int value = orCreateElement.Value;
300 c.elements.ModExp(orCreateElement.id, num * 2 / 3, false);
301 int num3 = 4;
302 if (orCreateElement.vBase >= num2)
303 {
304 c.elements.SetBase(orCreateElement.id, num2, 0);
305 }
306 else
307 {
308 num3 = Mathf.Clamp(orCreateElement.vBase * 100 / num2 / 25, 0, 3);
309 }
310 if (num3 == 4 || orCreateElement.Value != value)
311 {
312 Msg.Say("piety" + num3.ToString(), c, c.faith.TextGodGender, null, null);
313 }
314 Debug.Log(string.Concat(new string[]
315 {
316 num.ToString(),
317 "/",
318 orCreateElement.Value.ToString(),
319 "/",
320 orCreateElement.vExp.ToString()
321 }));
322 if (orCreateElement.Value > num2 * 8 / 10)
323 {
324 c.elements.ModExp(306, num / 5, false);
325 }
326 c.RefreshFaithElement();
327 if (@bool)
328 {
329 EClass.player.ModKarma(-1);
330 }
331 }
332
333 // Token: 0x06001C2E RID: 7214 RVA: 0x000A9804 File Offset: 0x000A7A04
334 public void TakeOver()
335 {
336 this.SetDeity(EClass.pc.faith.id);
337 EClass.pc.faith.Talk("takeover", null, null);
338 EClass.pc.PlayEffect("revive", true, 0f, default(Vector3));
339 this.owner.PlayEffect("aura_heaven", true, 0f, default(Vector3));
340 }
341}
Definition Card.cs:13
Definition Chara.cs:12
Definition Msg.cs:7
Definition Thing.cs:10
Definition Trait.cs:9