Core/Spells: Fixed deaths at stat auras removal when at low health (less than 1 percent)
This commit is contained in:
@@ -4906,9 +4906,9 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8
|
||||
return;
|
||||
}
|
||||
|
||||
//save current and max HP before applying aura
|
||||
uint32 curHPValue = target->GetHealth();
|
||||
uint32 maxHPValue = target->GetMaxHealth();
|
||||
// save current health state
|
||||
float healthPct = target->GetHealthPct();
|
||||
bool alive = target->isAlive();
|
||||
|
||||
for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
|
||||
{
|
||||
@@ -4916,16 +4916,13 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8
|
||||
{
|
||||
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
|
||||
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
|
||||
target->ApplyStatPercentBuffMod(Stats(i), (float)GetAmount(), apply);
|
||||
target->ApplyStatPercentBuffMod(Stats(i), float(GetAmount()), apply);
|
||||
}
|
||||
}
|
||||
|
||||
//recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
|
||||
if ((GetMiscValue() == STAT_STAMINA) && (maxHPValue > 0) && (m_spellProto->Attributes & SPELL_ATTR0_UNK4))
|
||||
{
|
||||
uint32 newHPValue = target->CountPctFromMaxHealth(int32(100.0f * curHPValue / maxHPValue));
|
||||
target->SetHealth(newHPValue);
|
||||
}
|
||||
if (GetMiscValue() == STAT_STAMINA && (m_spellProto->Attributes & SPELL_ATTR0_UNK4))
|
||||
target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool /*apply*/) const
|
||||
@@ -5931,7 +5928,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
{
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
return;
|
||||
|
||||
|
||||
if (target->GetMap()->IsBattleground())
|
||||
target->ToPlayer()->LeaveBattleground();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user