Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TraitPotionEmpty.cs
Go to the documentation of this file.
2{
3 public override ThrowType ThrowType => ThrowType.Vase;
4
5 public override bool CanDrink(Chara c)
6 {
7 return false;
8 }
9
10 public override bool CanUse(Chara c, Point p)
11 {
12 if (GetWell(p) == null)
13 {
15 }
16 return true;
17 }
18
19 public override bool OnUse(Chara c, Point p)
20 {
21 TraitWell well = GetWell(p);
22 if (well != null && well.Charges <= 0)
23 {
24 c.Say("drinkWell_empty", c, well.owner);
25 return false;
26 }
27 SE.Play("water_farm");
28 owner.ModNum(-1);
29 Thing thing = null;
30 if (well != null && well.IsHoly)
31 {
32 thing = ThingGen.Create((owner.id == "bucket_empty") ? "bucket" : "water");
33 thing.SetBlessedState(BlessedState.Blessed);
34 }
35 else
36 {
37 thing = ThingGen.Create("potion", -1, 10);
38 }
39 c.Say("drawWater", owner.Duplicate(1), thing);
40 c.Pick(thing);
41 well?.ModCharges(-1);
42 return true;
43 }
44
45 public override void OnDrink(Chara c)
46 {
47 }
48
50 {
51 foreach (Card item in p.ListCards())
52 {
53 if (item.trait is TraitWell result)
54 {
55 return result;
56 }
57 }
58 return null;
59 }
60}
BlessedState
Definition: BlessedState.cs:2
ThrowType
Definition: ThrowType.cs:2
Definition: Card.cs:11
string id
Definition: Card.cs:31
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3572
Thing Duplicate(int num)
Definition: Card.cs:3191
void ModNum(int a, bool notify=true)
Definition: Card.cs:3262
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712
Definition: Chara.cs:10
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:3920
Definition: Point.cs:9
Cell cell
Definition: Point.cs:51
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override void OnDrink(Chara c)
override bool CanDrink(Chara c)
override bool OnUse(Chara c, Point p)
TraitWell GetWell(Point p)
override bool CanUse(Chara c, Point p)
bool IsHoly
Definition: TraitWell.cs:3
int Charges
Definition: TraitWell.cs:14
void ModCharges(int a)
Definition: TraitWell.cs:134
Card owner
Definition: Trait.cs:26