fix: Fixes splitting potions before error (#1862)
### Summary Most potions have various checks, such as a cooldown. This fixes an edge case where potions get split from their stack before erroring.
This commit is contained in:
parent
e6bfc45228
commit
38731d98b6
12 changed files with 169 additions and 99 deletions
|
|
@ -11,17 +11,26 @@ public abstract partial class BaseRefreshPotion : BasePotion
|
|||
|
||||
public abstract double Refresh { get; }
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
public override bool CanDrink(Mobile from)
|
||||
{
|
||||
if (from.Stam < from.StamMax)
|
||||
if (!base.CanDrink(from))
|
||||
{
|
||||
from.Stam += Scale(from, (int)(Refresh * from.StamMax));
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
if (from.Stam >= from.StamMax)
|
||||
{
|
||||
from.SendMessage("You decide against drinking this potion, as you are already at full stamina.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
from.Stam += Scale(from, (int)(Refresh * from.StamMax));
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue