~ruther/NosSmooth

ref: ed3cc81862dc539872cc6bafee351b9c688ff21e NosSmooth/Core/NosSmooth.Game/Extensions/LivingEntityExtensions.cs -rw-r--r-- 760 bytes
ed3cc818 — František Boháček feat(game): respond to rest, raidfhp, tp, throw, mapclear, die, char_sc packets 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//
//  LivingEntityExtensions.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using NosSmooth.Game.Data.Entities;

namespace NosSmooth.Game.Extensions;

/// <summary>
/// An extension methods for <see cref="ILivingEntity"/>.
/// </summary>
public static class LivingEntityExtensions
{
    /// <summary>
    /// Checks whether the entity is alive.
    /// </summary>
    /// <param name="entity">The entity to check.</param>
    /// <returns>Whether the entity is alive.</returns>
    public static bool IsAlive(ILivingEntity entity)
    {
        return entity.Hp is null || entity.Hp.Amount != 0 || entity.Hp.Percentage != 0;
    }
}
Do not follow this link