Core/Spells: fixed an underflow in SPELL_EFFECT_INEBRIATE when using drinks that sober the character up (such as Starfire Espresso)
Port From (https://github.com/TrinityCore/TrinityCore/commit/45333fcc8fd8fbd58b6168098a8445b36b9c5248)
This commit is contained in:
@@ -3101,22 +3101,18 @@ namespace Game.Spells
|
||||
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
|
||||
return;
|
||||
|
||||
if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Player))
|
||||
if (unitTarget == null || !unitTarget.IsPlayer())
|
||||
return;
|
||||
|
||||
Player player = unitTarget.ToPlayer();
|
||||
byte currentDrunk = player.GetDrunkValue();
|
||||
int drunkMod = damage;
|
||||
if (currentDrunk + drunkMod > 100)
|
||||
{
|
||||
currentDrunk = 100;
|
||||
if (RandomHelper.randChance() < 25.0f)
|
||||
player.CastSpell(player, 67468, new CastSpellExtraArgs().SetTriggeringSpell(this)); // Drunken Vomit
|
||||
}
|
||||
else
|
||||
currentDrunk += (byte)drunkMod;
|
||||
|
||||
player.SetDrunkValue(currentDrunk, m_CastItem != null ? m_CastItem.GetEntry() : 0);
|
||||
byte currentDrunkValue = player.GetDrunkValue();
|
||||
byte drunkValue = (byte)Math.Clamp(damage + currentDrunkValue, 0, 100);
|
||||
if (currentDrunkValue == 100 && currentDrunkValue == drunkValue)
|
||||
if (RandomHelper.randChance(25.0f))
|
||||
player.CastSpell(player, 67468, new CastSpellExtraArgs().SetTriggeringSpell(this)); // Drunken Vomit
|
||||
|
||||
player.SetDrunkValue(drunkValue, m_CastItem != null ? m_CastItem.GetEntry() : 0);
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.FeedPet)]
|
||||
|
||||
Reference in New Issue
Block a user