Skip to content

Commit

Permalink
feat: add ModifyThreatPct(creature,target)
Browse files Browse the repository at this point in the history
  • Loading branch information
55Honey authored Mar 19, 2022
2 parents 47a4534 + da16c3c commit 07540df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions LuaFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ ElunaRegister<Unit> UnitMethods[] =
{ "DealDamage", &LuaUnit::DealDamage },
{ "DealHeal", &LuaUnit::DealHeal },
{ "AddThreat", &LuaUnit::AddThreat },
{ "ModifyThreatPct", &LuaUnit::ModifyThreatPct },

{ NULL, NULL }
};
Expand Down
17 changes: 17 additions & 0 deletions UnitMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 07540df

Please sign in to comment.