Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TraitGamble.cs
Go to the documentation of this file.
1public class TraitGamble : TraitItem
2{
3 public virtual string idMsg => null;
4
5 public virtual string idSound => idMsg;
6
7 public virtual string idTalk => null;
8
9 public override bool IdleUse(Chara c, int dist)
10 {
11 if (dist > 1)
12 {
13 return false;
14 }
15 if (!CanUse(c))
16 {
17 return false;
18 }
19 if (!idSound.IsEmpty())
20 {
22 }
23 if (!idTalk.IsEmpty())
24 {
25 EClass.player.forceTalk = true;
26 c.Talk(idTalk);
27 }
28 if (!idMsg.IsEmpty())
29 {
30 c.Say(idMsg, c, owner);
31 }
32 bool flag = EClass.rnd(2) == 0;
33 if (!c.IsPC)
34 {
35 int a = (1 + EClass.rnd(10)) * (flag ? 1 : (-1));
37 if (flag && EClass.rnd(20) == 0)
38 {
39 owner.ModCurrency(1, "casino_coin");
40 }
41 }
42 if (flag)
43 {
44 owner.ShowEmo(Emo.happy);
45 }
46 return true;
47 }
48
49 public override bool CanUse(Chara c)
50 {
52 {
53 if (Electricity <= 0)
54 {
55 return true;
56 }
57 return owner.isOn;
58 }
59 return false;
60 }
61
62 public override bool OnUse(Chara c)
63 {
64 return IdleUse(c, 0);
65 }
66}
Emo
Definition: Emo.cs:2
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:5949
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:5372
void ModCurrency(int a, string id="money")
Definition: Card.cs:3638
bool IsInstalled
Definition: Card.cs:2241
bool isOn
Definition: Card.cs:514
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Definition: Chara.cs:10
override bool IsPC
Definition: Chara.cs:597
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
virtual string idTalk
Definition: TraitGamble.cs:7
virtual string idMsg
Definition: TraitGamble.cs:3
override bool OnUse(Chara c)
Definition: TraitGamble.cs:62
override bool IdleUse(Chara c, int dist)
Definition: TraitGamble.cs:9
virtual string idSound
Definition: TraitGamble.cs:5
override bool CanUse(Chara c)
Definition: TraitGamble.cs:49
virtual int Electricity
Definition: Trait.cs:97
Card owner
Definition: Trait.cs:26