mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Creatures: Implemented unkillable flag (prevent health from going below 1)
This commit is contained in:
@@ -146,6 +146,14 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
using Unit::SetImmuneToNPC;
|
||||
void SetImmuneToNPC(bool apply) override { Unit::SetImmuneToNPC(apply, HasReactState(REACT_PASSIVE)); }
|
||||
|
||||
void SetUnkillable(bool unkillable)
|
||||
{
|
||||
if (unkillable)
|
||||
_staticFlags |= CREATURE_STATIC_FLAG_UNKILLABLE;
|
||||
else
|
||||
_staticFlags &= ~CREATURE_STATIC_FLAG_UNKILLABLE;
|
||||
}
|
||||
|
||||
/// @todo Rename these properly
|
||||
bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
|
||||
bool CanResetTalents(Player* player) const;
|
||||
|
||||
@@ -857,6 +857,10 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
|
||||
|
||||
duel_hasEnded = true;
|
||||
}
|
||||
else if (victim->IsCreature() && damageTaken >= health && victim->ToCreature()->HasFlag(CREATURE_STATIC_FLAG_UNKILLABLE))
|
||||
{
|
||||
damageTaken = health - 1;
|
||||
}
|
||||
else if (victim->IsVehicle() && damageTaken >= (health-1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* victimRider = victim->GetCharmer()->ToPlayer();
|
||||
|
||||
Reference in New Issue
Block a user