Elin Modding Docs Doc
Loading...
Searching...
No Matches
AI_OpenGambleChest.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x02000204 RID: 516
7{
8 // Token: 0x170003C6 RID: 966
9 // (get) Token: 0x06000EB8 RID: 3768 RVA: 0x0006DBF6 File Offset: 0x0006BDF6
10 public override CursorInfo CursorIcon
11 {
12 get
13 {
14 return CursorSystem.Container;
15 }
16 }
17
18 // Token: 0x06000EB9 RID: 3769 RVA: 0x0006DC00 File Offset: 0x0006BE00
19 public bool IsValid()
20 {
21 return this.owner != null && !this.owner.isDead && !this.target.isDestroyed && (this.target.IsChildOf(this.owner) || this.owner.Dist(this.target) <= 1);
22 }
23
24 // Token: 0x06000EBA RID: 3770 RVA: 0x0006DC5D File Offset: 0x0006BE5D
25 public override IEnumerable<AIAct.Status> Run()
26 {
27 this.owner.Say("lockpick_start", this.owner, this.target, null, null);
28 this.owner.PlaySound("lock_pick", 1f, true);
29 while (this.target.Num > 0 && this.IsValid())
30 {
31 this.owner.PlaySound("lock_open_small", 1f, true);
32 this.owner.LookAt(this.target);
33 this.target.renderer.PlayAnime(AnimeID.Shiver, default(Vector3), false);
34 yield return base.KeepRunning();
35 EClass.player.stats.gambleChest++;
36 Rand.SetSeed(EClass.game.seed + EClass.player.stats.gambleChest);
37 bool flag = this.owner.Evalue(280) + 5 >= EClass.rnd(this.target.c_lockLv + 10);
38 if (EClass.rnd(20) == 0)
39 {
40 flag = true;
41 }
42 if (EClass.rnd(20) == 0)
43 {
44 flag = false;
45 }
46 int num = 20 + this.target.c_lockLv / 3;
47 if (flag)
48 {
49 num *= 3;
50 EClass.player.stats.gambleChestOpen++;
51 Rand.SetSeed(EClass.game.seed + EClass.player.stats.gambleChestOpen);
52 bool flag2 = 100 + this.owner.LUC > EClass.rnd(10000);
53 if (EClass.debug.enable && EClass.rnd(2) == 0)
54 {
55 flag2 = true;
56 }
57 if (flag2)
58 {
59 this.owner.PlaySound("money", 1f, true);
60 this.owner.PlayAnime(AnimeID.Jump, false);
61 Thing thing = ThingGen.Create("money", -1, -1).SetNum(EClass.rndHalf(50 * (100 + this.target.c_lockLv * 10)));
62 this.owner.Pick(thing, false, true);
63 this.owner.Say("gambleChest_win", thing, null, null);
64 }
65 else
66 {
67 this.owner.Say("gambleChest_loss", null, null);
68 }
69 Rand.SetSeed(-1);
70 }
71 else
72 {
73 this.owner.Say("gambleChest_broke", this.target.GetName(NameStyle.Full, 1), null);
74 this.owner.PlaySound("rock_dead", 1f, true);
75 }
76 this.target.ModNum(-1, true);
77 this.owner.ModExp(280, num);
78 if (EClass.rnd(2) == 0)
79 {
80 this.owner.stamina.Mod(-1);
81 }
82 }
83 yield break;
84 }
85
86 // Token: 0x06000EBB RID: 3771 RVA: 0x0006DC70 File Offset: 0x0006BE70
87 public static Thing MakeReward()
88 {
89 int num = 1;
90 string text = "";
91 if (text.IsEmpty())
92 {
93 text = "money";
94 }
95 return ThingGen.Create(text, -1, -1).SetNum(num);
96 }
97
98 // Token: 0x04000D5F RID: 3423
99 public Thing target;
100}
Definition AIAct.cs:7
Definition Thing.cs:10