Core/Creatures: Implemented unkillable flag (prevent health from going below 1)
Port From (https://github.com/TrinityCore/TrinityCore/commit/7ea438ebdca93874776e02e9985db1da0a53f2fb)
This commit is contained in:
@@ -3187,6 +3187,14 @@ namespace Game.Entities
|
||||
public override void SetImmuneToPC(bool apply) { SetImmuneToPC(apply, HasReactState(ReactStates.Passive)); }
|
||||
public override void SetImmuneToNPC(bool apply) { SetImmuneToNPC(apply, HasReactState(ReactStates.Passive)); }
|
||||
|
||||
void SetUnkillable(bool unkillable)
|
||||
{
|
||||
if (unkillable)
|
||||
_staticFlags |= CreatureStaticFlags.Unkillable;
|
||||
else
|
||||
_staticFlags &= ~CreatureStaticFlags.Unkillable;
|
||||
}
|
||||
|
||||
public bool IsInEvadeMode() { return HasUnitState(UnitState.Evade); }
|
||||
public bool IsEvadingAttacks() { return IsInEvadeMode() || CanNotReachTarget(); }
|
||||
|
||||
|
||||
@@ -2591,6 +2591,10 @@ namespace Game.Entities
|
||||
|
||||
duel_hasEnded = true;
|
||||
}
|
||||
else if (victim.IsCreature() && damageTaken >= health && victim.ToCreature().HasFlag(CreatureStaticFlags.Unkillable))
|
||||
{
|
||||
damageTaken = health - 1;
|
||||
}
|
||||
else if (victim.IsVehicle() && damageTaken >= (health - 1) && victim.GetCharmer() != null && victim.GetCharmer().IsTypeId(TypeId.Player))
|
||||
{
|
||||
Player victimRider = victim.GetCharmer().ToPlayer();
|
||||
|
||||
Reference in New Issue
Block a user