feat: add ModifyThreatPct(creature,target)

This commit is contained in:
55Honey
2022-03-19 17:28:18 +01:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

View File

@@ -440,6 +440,7 @@ ElunaRegister<Unit> UnitMethods[] =
{ "DealDamage", &LuaUnit::DealDamage },
{ "DealHeal", &LuaUnit::DealHeal },
{ "AddThreat", &LuaUnit::AddThreat },
{ "ModifyThreatPct", &LuaUnit::ModifyThreatPct },
{ NULL, NULL }
};

View File

@@ -2982,6 +2982,23 @@ namespace LuaUnit
return 0;
}
/**
* Modifies threat in pct to the [Unit] from the victim
*
* @param [Unit] victim : [Unit] that caused the threat
* @param int32 percent : threat amount in pct
*/
int ModifyThreatPct(lua_State* L, Unit* unit)
{
Unit* victim = Eluna::CHECKOBJ<Unit>(L, 2);
int32 threatPct = Eluna::CHECKVAL<int32>(L, 3, true);
#ifdef AZEROTHCORE
unit->getThreatMgr().modifyThreatPercent(victim, threatPct);
#endif
return 0;
}
/*int RestoreDisplayId(lua_State* L, Unit* unit)
{
unit->RestoreDisplayId();