Elin Decompiled Documentation EA 23.286 Nightly
Loading...
Searching...
No Matches
AI_OpenGambleChest.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
5{
6 public Thing target;
7
9
10 public bool IsValid()
11 {
12 if (owner == null || owner.isDead || target.isDestroyed)
13 {
14 return false;
15 }
17 {
18 return owner.Dist(target) <= 1;
19 }
20 return true;
21 }
22
23 public override IEnumerable<Status> Run()
24 {
25 owner.Say("lockpick_start", owner, target);
26 owner.PlaySound("lock_pick");
27 while (target.Num > 0 && IsValid())
28 {
29 owner.PlaySound("lock_open_small");
32 yield return KeepRunning();
35 bool flag = owner.Evalue(280) + 5 >= EClass.rnd(target.c_lockLv + 10);
36 if (EClass.rnd(20) == 0)
37 {
38 flag = true;
39 }
40 if (EClass.rnd(20) == 0)
41 {
42 flag = false;
43 }
44 int num = 20 + target.c_lockLv / 3;
45 if (flag)
46 {
47 num *= 3;
50 bool flag2 = 100 + owner.LUC > EClass.rnd(10000);
51 if (EClass.debug.enable && EClass.rnd(2) == 0)
52 {
53 flag2 = true;
54 }
55 if (flag2)
56 {
57 owner.PlaySound("money");
59 Thing thing = ThingGen.Create("money").SetNum(EClass.rndHalf(50 * (100 + Mathf.Min(target.c_lockLv * 10, 10000000))));
60 owner.Pick(thing, msg: false);
61 owner.Say("gambleChest_win", thing);
62 }
63 else
64 {
65 owner.Say("gambleChest_loss");
66 }
67 Rand.SetSeed();
68 }
69 else
70 {
71 owner.Say("gambleChest_broke", target.GetName(NameStyle.Full, 1));
72 owner.PlaySound("rock_dead");
73 }
74 target.ModNum(-1);
75 owner.ModExp(280, num);
76 if (EClass.rnd(2) == 0)
77 {
78 owner.stamina.Mod(-1);
79 }
80 }
81 }
82
83 public static Thing MakeReward()
84 {
85 int num = 1;
86 string str = "";
87 if (str.IsEmpty())
88 {
89 str = "money";
90 }
91 return ThingGen.Create(str).SetNum(num);
92 }
93}
AnimeID
Definition: AnimeID.cs:2
NameStyle
Definition: NameStyle.cs:2
Definition: AIAct.cs:6
new Chara owner
Definition: AIAct.cs:14
Status KeepRunning()
Definition: AIAct.cs:335
override IEnumerable< Status > Run()
override CursorInfo CursorIcon
static Thing MakeReward()
void PlayAnime(AnimeID id, bool force)
bool isDestroyed
Definition: Card.cs:76
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6375
int c_lockLv
Definition: Card.cs:977
Thing SetNum(int a)
Definition: Card.cs:3577
bool IsChildOf(Card c)
Definition: Card.cs:2716
int Evalue(int ele)
Definition: Card.cs:2611
int Dist(Card c)
Definition: Card.cs:7901
void ModExp(string alias, int a)
Definition: Card.cs:2688
int Num
Definition: Card.cs:159
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:6394
void ModNum(int a, bool notify=true)
Definition: Card.cs:3597
CardRenderer renderer
Definition: Card.cs:62
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7052
Stats stamina
Definition: Chara.cs:1172
bool isDead
Definition: Chara.cs:391
override void LookAt(Card c)
Definition: Chara.cs:3597
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4381
bool enable
Definition: CoreDebug.cs:286
static CursorInfo Container
Definition: CursorSystem.cs:82
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static int rnd(long a)
Definition: EClass.cs:59
static int rndHalf(int a)
Definition: EClass.cs:97
static Player player
Definition: EClass.cs:13
static CoreDebug debug
Definition: EClass.cs:49
int seed
Definition: Game.cs:201
int gambleChestOpen
Definition: Player.cs:123
int gambleChest
Definition: Player.cs:120
Stats stats
Definition: Player.cs:1059
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:44
virtual void Mod(int a)
Definition: Stats.cs:135
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:535