mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(Core/SmartScripts): SMART_ACTION_SET_HEALTH_PCT
This commit is contained in:
committed by
GitHub
parent
86f1b87fe6
commit
e28bdf9bde
@@ -3311,6 +3311,25 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
}
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_HEALTH_PCT:
|
||||
{
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto const& target : *targets)
|
||||
{
|
||||
if (Unit* targetUnit = target->ToUnit())
|
||||
{
|
||||
targetUnit->SetHealth(targetUnit->CountPctFromMaxHealth(e.action.setHealthPct.percent));
|
||||
}
|
||||
}
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user