diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index a7acbee429..55ce5860ed 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -440,6 +440,7 @@ ElunaRegister UnitMethods[] = { "DealDamage", &LuaUnit::DealDamage }, { "DealHeal", &LuaUnit::DealHeal }, { "AddThreat", &LuaUnit::AddThreat }, + { "ModifyThreatPct", &LuaUnit::ModifyThreatPct }, { NULL, NULL } }; diff --git a/UnitMethods.h b/UnitMethods.h index cc85a0a23f..d417b37f81 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -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(L, 2); + int32 threatPct = Eluna::CHECKVAL(L, 3, true); + +#ifdef AZEROTHCORE + unit->getThreatMgr().modifyThreatPercent(victim, threatPct); +#endif + return 0; + } + /*int RestoreDisplayId(lua_State* L, Unit* unit) { unit->RestoreDisplayId();