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
|
|
@ -14,8 +14,13 @@ public abstract partial class BaseStrengthPotion : BasePotion
|
|||
public abstract int StrOffset { get; }
|
||||
public abstract TimeSpan Duration { get; }
|
||||
|
||||
public bool DoStrength(Mobile from)
|
||||
public bool CanDrink(Mobile from)
|
||||
{
|
||||
if (!base.CanDrink(from))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Verify scaled; is it offset, duration, or both?
|
||||
if (SpellHelper.AddStatOffset(from, StatType.Str, Scale(from, StrOffset), Duration))
|
||||
{
|
||||
|
|
@ -30,9 +35,6 @@ public abstract partial class BaseStrengthPotion : BasePotion
|
|||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (DoStrength(from))
|
||||
{
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue