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
|
|
@ -10,21 +10,30 @@ public partial class NightSightPotion : BasePotion
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CanDrink(Mobile from)
|
||||
{
|
||||
if (!base.CanDrink(from))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!from.BeginAction<LightCycle>())
|
||||
{
|
||||
from.SendMessage("You already have night sight.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.BeginAction<LightCycle>())
|
||||
{
|
||||
new LightCycle.NightSightTimer(from).Start();
|
||||
from.LightLevel = LightCycle.DungeonLevel / 2;
|
||||
new LightCycle.NightSightTimer(from).Start();
|
||||
from.LightLevel = LightCycle.DungeonLevel / 2;
|
||||
|
||||
from.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
|
||||
from.PlaySound(0x1E3);
|
||||
from.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
|
||||
from.PlaySound(0x1E3);
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You already have nightsight.");
|
||||
}
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue