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:
Kamron Batman 2024-07-06 16:39:47 -07:00 • committed by GitHub
parent e6bfc45228
commit 38731d98b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 169 additions and 99 deletions

View file

@ -51,22 +51,26 @@ public abstract partial class BaseExplosionPotion : BasePotion
return this;
}
public override void Drink(Mobile from)
public override bool CanDrink(Mobile from)
{
if (!base.CanDrink(from))
{
return false;
}
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed.
return;
return false;
}
var targ = from.Target as ThrowTarget;
return (from.Target as ThrowTarget)?.Potion != this;
}
public override void Drink(Mobile from)
{
Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.
if (targ?.Potion == this)
{
return;
}
from.RevealingAction();
_users ??= [];