/// <summary>Heals this unit and returns the points healed, or -1 if the unit died before it could be healed.</summary>
        public virtual int ReceiveHeal(Unit caster, uint healAmount, float healHatredScale = 1.0f)
        {
            uint oldHealth;
            uint resultantHealth;

            if (IsDead || PendingDisposal)
            {
                return(-1);
            }

            lock (DamageApplicationLock)
            {
                if (IsDead)
                {
                    return(-1);
                }
                oldHealth       = _health;
                _health         = Math.Min(MaxHealth, _health + healAmount);
                resultantHealth = _health;

                if (_health == MaxHealth && oldHealth < MaxHealth)
                {
                    DamageSources.Clear();
                }
            }

            if (caster != null)
            {
                CbtInterface.OnTakeHeal(caster);
                caster.CbtInterface.OnDealHeal(this, resultantHealth - oldHealth);
            }

            LastHealOid = caster?.Oid ?? Oid;

            return((int)(resultantHealth - oldHealth));
        }