Core/Misc: Added helper function Unit::SetFullPower

* Also renamed Unit::getPowerType and Unit::setPowerType to follow style guidelines

Ref #20981
This commit is contained in:
Mihapro
2018-01-03 16:39:00 +01:00
committed by joschiwald
parent c2aead1da5
commit 8199eef81c
37 changed files with 108 additions and 126 deletions

View File

@@ -3134,7 +3134,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
{
if (!me || !me->IsInCombat() || !me->GetMaxPower(POWER_MANA))
return;
uint32 perc = uint32(100.0f * me->GetPower(POWER_MANA) / me->GetMaxPower(POWER_MANA));
uint32 perc = uint32(me->GetPowerPct(POWER_MANA));
if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax);
@@ -3144,7 +3144,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
{
if (!me || !me->IsInCombat() || !me->GetVictim() || !me->EnsureVictim()->GetMaxPower(POWER_MANA))
return;
uint32 perc = uint32(100.0f * me->EnsureVictim()->GetPower(POWER_MANA) / me->EnsureVictim()->GetMaxPower(POWER_MANA));
uint32 perc = uint32(me->EnsureVictim()->GetPowerPct(POWER_MANA));
if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim());