Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TraitGacha.cs
Go to the documentation of this file.
1public class TraitGacha : Trait
2{
3 public enum GachaType
4 {
5 Junk,
6 Plant,
8 }
9
10 public GachaType type => GetParam(1).ToEnum<GachaType>();
11
12 public virtual string suffixCoin => "";
13
14 public virtual int refVal => 0;
15
16 public string GetIdCoin()
17 {
18 string text = "gacha_coin";
19 switch (type)
20 {
21 case GachaType.Furniture:
22 text += "_gold";
23 break;
24 case GachaType.Plant:
25 text += "_silver";
26 break;
27 }
28 return text;
29 }
30
31 public override void TrySetAct(ActPlan p)
32 {
33 if (owner.isOn)
34 {
35 p.TrySetAct("gacha", delegate
36 {
38 return false;
39 }, owner);
40 }
41 }
42
43 public void PlayGacha(int num)
44 {
45 Thing thing = ThingGen.Create("gachaBall").SetNum(num);
46 thing.refVal = (int)type;
47 EClass.player.DropReward(thing, silent: true);
48 }
49}
bool TrySetAct(string lang, Func< bool > onPerform, Card tc, CursorInfo cursor=null, int dist=1, bool isHostileAct=false, bool localAct=true, bool canRepeat=false)
Definition: ActPlan.cs:344
Thing SetNum(int a)
Definition: Card.cs:3242
bool isOn
Definition: Card.cs:514
Definition: EClass.cs:5
static Player player
Definition: EClass.cs:12
static LayerDragGrid CreateGacha(TraitGacha gacha)
Thing DropReward(Thing t, bool silent=false)
Definition: Player.cs:2320
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override void TrySetAct(ActPlan p)
Definition: TraitGacha.cs:31
string GetIdCoin()
Definition: TraitGacha.cs:16
virtual string suffixCoin
Definition: TraitGacha.cs:12
GachaType type
Definition: TraitGacha.cs:10
void PlayGacha(int num)
Definition: TraitGacha.cs:43
virtual int refVal
Definition: TraitGacha.cs:14
Definition: Trait.cs:7
string GetParam(int i, string def=null)
Definition: Trait.cs:515
Card owner
Definition: Trait.cs:26