diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index cf634ff9cb..0ded630edb 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -126,6 +126,14 @@ class TC_GAME_API Creature : public Unit, public GridObject, 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; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f53e024ee6..78434cdd6d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -853,6 +853,10 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons duel_hasEnded = true; } + else if (victim->IsCreature() && damage >= health && victim->ToCreature()->HasStaticFlag(CREATURE_STATIC_FLAG_UNKILLABLE)) + { + damage = health - 1; + } else if (victim->IsVehicle() && damage >= (health-1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER) { Player* victimRider = victim->GetCharmer()->ToPlayer();