Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TraitGachaBall.cs
Go to the documentation of this file.
2{
3 public override string LangUse => "actContainer";
4
5 public override bool OnUse(Chara c)
6 {
8 SpawnList spawnList = refVal switch
9 {
10 TraitGacha.GachaType.Furniture => SpawnListThing.Get("gacha_furniture", (SourceThing.Row a) => a.value < 5000 && a.Category.IsChildOf("furniture")),
11 TraitGacha.GachaType.Plant => SpawnListThing.Get("gacha_plant", (SourceThing.Row a) => a.Category.id == "plantpot"),
12 _ => SpawnListThing.Get("gacha_junk", (SourceThing.Row a) => a.Category.id == "junk"),
13 };
14 Rand.SetSeed(owner.uid + owner.Num * 100 + EClass.world.date.day / 5 * 1000);
15 Thing thing = ThingGen.Create(spawnList.Select().id);
16 if (refVal != TraitGacha.GachaType.Plant)
17 {
18 thing.ChangeMaterial(EClass.sources.materials.rows.RandomItemWeighted((SourceMaterial.Row m) => m.chance));
19 }
20 Rand.SetSeed();
22 owner.ModNum(-1);
23 return true;
24 }
25}
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2838
int uid
Definition: Card.cs:118
int refVal
Definition: Card.cs:190
int Num
Definition: Card.cs:154
void ModNum(int a, bool notify=true)
Definition: Card.cs:3262
Definition: Chara.cs:10
int day
Definition: Date.cs:62
Definition: EClass.cs:5
static World world
Definition: EClass.cs:40
static SourceManager sources
Definition: EClass.cs:42
static Player player
Definition: EClass.cs:12
Thing DropReward(Thing t, bool silent=false)
Definition: Player.cs:2320
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37
SourceMaterial materials
static SpawnList Get(string id, Func< SourceThing.Row, bool > func)
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override bool OnUse(Chara c)
override string LangUse
Card owner
Definition: Trait.cs:26
GameDate date
Definition: World.cs:6