Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CMangos/UnitMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ namespace LuaUnit
int SetRooted(Eluna* E, Unit* unit)
{
bool apply = Eluna::CHECKVAL<bool>(E->L, 2, true);

unit->SetImmobilizedState(apply);
return 0;
}
Expand Down Expand Up @@ -2447,7 +2447,7 @@ namespace LuaUnit
#endif
return 0;
}

ElunaRegister<Unit> UnitMethods[] =
{
// Getters
Expand Down Expand Up @@ -2644,6 +2644,7 @@ namespace LuaUnit
{ "RemoveCharmAuras", nullptr, METHOD_REG_NONE }, // not implemented
{ "DisableMelee", nullptr, METHOD_REG_NONE }, // not implemented
{ "SummonGuardian", nullptr, METHOD_REG_NONE }, // not implemented
{ "SetImmuneTo", nullptr }, // not implemented

{ NULL, NULL, METHOD_REG_NONE }
};
Expand Down
3 changes: 2 additions & 1 deletion Mangos/UnitMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -3112,7 +3112,7 @@ namespace LuaUnit
E->Push(summon);
return 1;
}*/

ElunaRegister<Unit> UnitMethods[] =
{
// Getters
Expand Down Expand Up @@ -3298,6 +3298,7 @@ namespace LuaUnit
{ "RemoveCharmAuras", nullptr }, // not implemented
{ "DisableMelee", nullptr }, // not implemented
{ "SummonGuardian", nullptr }, // not implemented
{ "SetImmuneTo", nullptr }, // not implemented

{ NULL, NULL }
};
Expand Down
52 changes: 51 additions & 1 deletion TrinityCore/UnitMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,55 @@
*/
namespace LuaUnit
{
/**
* Sets a mechanic immunity for the [Unit].
*
* <pre>
* MECHANIC_NONE = 0,
* MECHANIC_CHARM = 1,
* MECHANIC_DISORIENTED = 2,
* MECHANIC_DISARM = 3,
* MECHANIC_DISTRACT = 4,
* MECHANIC_FEAR = 5,
* MECHANIC_GRIP = 6,
* MECHANIC_ROOT = 7,
* MECHANIC_SLOW_ATTACK = 8,
* MECHANIC_SILENCE = 9,
* MECHANIC_SLEEP = 10,
* MECHANIC_SNARE = 11,
* MECHANIC_STUN = 12,
* MECHANIC_FREEZE = 13,
* MECHANIC_KNOCKOUT = 14,
* MECHANIC_BLEED = 15,
* MECHANIC_BANDAGE = 16,
* MECHANIC_POLYMORPH = 17,
* MECHANIC_BANISH = 18,
* MECHANIC_SHIELD = 19,
* MECHANIC_SHACKLE = 20,
* MECHANIC_MOUNT = 21,
* MECHANIC_INFECTED = 22,
* MECHANIC_TURN = 23,
* MECHANIC_HORROR = 24,
* MECHANIC_INVULNERABILITY = 25,
* MECHANIC_INTERRUPT = 26,
* MECHANIC_DAZE = 27,
* MECHANIC_DISCOVERY = 28,
* MECHANIC_IMMUNE_SHIELD = 29, // Divine (Blessing) Shield/Protection and Ice Block
* MECHANIC_SAPPED = 30,
* MECHANIC_ENRAGED = 31
* </pre>
*
* @param int32 immunity : new value for the immunity mask
* @param bool apply = true : if true, the immunity is applied, otherwise it is removed
*/
int SetImmuneTo(Eluna* E, Unit* unit)
{
int32 immunity = Eluna::CHECKVAL<int32>(E->L, 2);
bool apply = Eluna::CHECKVAL<bool>(E->L, 3, true);

unit->ApplySpellImmune(0, 5, immunity, apply);
return 0;
}
/**
* The [Unit] tries to attack a given target
*
Expand Down Expand Up @@ -2500,7 +2549,7 @@ namespace LuaUnit
E->Push(summon);
return 1;
}*/

ElunaRegister<Unit> UnitMethods[] =
{
// Getters
Expand Down Expand Up @@ -2580,6 +2629,7 @@ namespace LuaUnit
{ "SetStandState", &LuaUnit::SetStandState },
{ "SetInCombatWith", &LuaUnit::SetInCombatWith },
{ "ModifyPower", &LuaUnit::ModifyPower },
{ "SetImmuneTo", &LuaUnit::SetImmuneTo },

// Boolean
{ "IsAlive", &LuaUnit::IsAlive },
Expand Down
3 changes: 2 additions & 1 deletion VMangos/UnitMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -2972,7 +2972,7 @@ namespace LuaUnit
Eluna::Push(L, summon);
return 1;
}*/

ElunaRegister<Unit> UnitMethods[] =
{
// Getters
Expand Down Expand Up @@ -3158,6 +3158,7 @@ namespace LuaUnit
{ "RemoveCharmAuras", nullptr }, // not implemented
{ "DisableMelee", nullptr }, // not implemented
{ "SummonGuardian", nullptr }, // not implemented
{ "SetImmuneTo", nullptr }, // not implemented

{ NULL, NULL }
};
Expand Down