Core/Players: Improved alcohol handling, weeeeeeeeeeeeeeeee

Closes #7293
This commit is contained in:
Shauren
2012-08-07 17:45:10 +02:00
parent 429130522e
commit f8cd39b2ed
6 changed files with 49 additions and 53 deletions

View File

@@ -4772,16 +4772,18 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)unitTarget;
uint16 currentDrunk = player->GetDrunkValue();
uint16 drunkMod = damage * 256;
if (currentDrunk + drunkMod > 0xFFFF)
Player* player = unitTarget->ToPlayer();
uint8 currentDrunk = player->GetDrunkValue();
uint8 drunkMod = damage;
if (currentDrunk + drunkMod > 100)
{
currentDrunk = 0xFFFF;
player->CastSpell(player, 67468, false);
currentDrunk = 100;
if (rand_chance() < 25.0f)
player->CastSpell(player, 67468, false); // Drunken Vomit
}
else
currentDrunk += drunkMod;
player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
}