From da16c3cd5aef92766397015db30cc3259fe79279 Mon Sep 17 00:00:00 2001 From: 55Honey <71938210+55Honey@users.noreply.github.com> Date: Wed, 16 Mar 2022 22:37:14 +0100 Subject: [PATCH] feat: add ModifyThreatPct(creature,target) --- LuaFunctions.cpp | 1 + UnitMethods.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) 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();