ModernUO/Projects/UOContent/Items/Skill Items/Magical/Potions/Refresh Potions/BaseRefreshPotion.cs
Kamron Batman 38731d98b6
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.
2024-07-06 16:39:47 -07:00

36 lines
797 B
C#

using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public abstract partial class BaseRefreshPotion : BasePotion
{
public BaseRefreshPotion(PotionEffect effect) : base(0xF0B, effect)
{
}
public abstract double Refresh { get; }
public override bool CanDrink(Mobile from)
{
if (!base.CanDrink(from))
{
return false;
}
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);
}
}