/// <summary>
        /// When overridden in the derived class, tries to add an <see cref="IStatusEffect{StatType, StatusEffectType}"/> to
        /// this collection.
        /// </summary>
        /// <param name="statusEffect">The status effect to add.</param>
        /// <param name="power">The power of the status effect.</param>
        /// <returns>True if the <paramref name="statusEffect"/> of the given <paramref name="power"/> was added
        /// to this collection; otherwise false.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="statusEffect" /> is <c>null</c>.</exception>
        public override bool TryAdd(IStatusEffect<StatType, StatusEffectType> statusEffect, ushort power)
        {
            if (statusEffect == null)
                throw new ArgumentNullException("statusEffect");

            ActiveStatusEffect existingStatusEffect;
            var alreadyExists = TryGetStatusEffect(statusEffect.StatusEffectType, out existingStatusEffect);

            var time = GetTime();
            var disableTime = (TickCount)(time + statusEffect.GetEffectTime(power));

            if (alreadyExists)
            {
                var changed = existingStatusEffect.MergeWith(time, power, disableTime);
                if (changed)
                    RecalculateStatBonuses();
                return changed;
            }
            else
            {
                var ase = new ActiveStatusEffect(statusEffect, power, disableTime);
                _statusEffects.Add(ase);
                OnAdded(ase);
                return true;
            }
        }
        /// <summary>
        /// When overridden in the derived class, tries to add an <see cref="IStatusEffect{StatType, StatusEffectType}"/> to
        /// this collection.
        /// </summary>
        /// <param name="statusEffect">The status effect to add.</param>
        /// <param name="power">The power of the status effect.</param>
        /// <returns>True if the <paramref name="statusEffect"/> of the given <paramref name="power"/> was added
        /// to this collection; otherwise false.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="statusEffect" /> is <c>null</c>.</exception>
        public override bool TryAdd(IStatusEffect <StatType, StatusEffectType> statusEffect, ushort power)
        {
            if (statusEffect == null)
            {
                throw new ArgumentNullException("statusEffect");
            }

            ActiveStatusEffect existingStatusEffect;
            var alreadyExists = TryGetStatusEffect(statusEffect.StatusEffectType, out existingStatusEffect);

            var time        = GetTime();
            var disableTime = (TickCount)(time + statusEffect.GetEffectTime(power));

            if (alreadyExists)
            {
                var changed = existingStatusEffect.MergeWith(time, power, disableTime);
                if (changed)
                {
                    RecalculateStatBonuses();
                }
                return(changed);
            }
            else
            {
                var ase = new ActiveStatusEffect(statusEffect, power, disableTime);
                _statusEffects.Add(ase);
                OnAdded(ase);
                return(true);
            }
        }
        /// <summary>
        /// When overridden in the derived class, tries to add an <see cref="IStatusEffect{StatType, StatusEffectType}"/> to
        /// this collection.
        /// </summary>
        /// <param name="statusEffect">The status effect to add.</param>
        /// <param name="power">The power of the status effect.</param>
        /// <returns>True if the <paramref name="statusEffect"/> of the given <paramref name="power"/> was added
        /// to this collection; otherwise false.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="statusEffect" /> is <c>null</c>.</exception>
        public override bool TryAdd(IStatusEffect <StatType, StatusEffectType> statusEffect, ushort power)
        {
            if (statusEffect == null)
            {
                throw new ArgumentNullException("statusEffect");
            }

            ASEWithID existingStatusEffect;
            var       alreadyExists = TryGetStatusEffect(statusEffect.StatusEffectType, out existingStatusEffect);

            var time        = GetTime();
            var disableTime = (TickCount)(time + statusEffect.GetEffectTime(power));

            if (alreadyExists)
            {
                // Status effect already exists - merge with it
                var changed = existingStatusEffect.Value.MergeWith(time, power, disableTime);
                if (changed)
                {
                    RecalculateStatBonuses();
                    UpdateInDatabase(existingStatusEffect);
                }
                return(changed);
            }
            else
            {
                // Status effect doesn't exist - create new instance
                var ase = new ActiveStatusEffect(statusEffect, power, disableTime);

                var id = InsertInDatabase(ase);

                var aseWithID = new ASEWithID(id, ase);
                _statusEffects.Add(aseWithID);

                OnAdded(aseWithID.Value);

                return(true);
            }
        }
        /// <summary>
        /// When overridden in the derived class, tries to add an <see cref="IStatusEffect{StatType, StatusEffectType}"/> to
        /// this collection.
        /// </summary>
        /// <param name="statusEffect">The status effect to add.</param>
        /// <param name="power">The power of the status effect.</param>
        /// <returns>True if the <paramref name="statusEffect"/> of the given <paramref name="power"/> was added
        /// to this collection; otherwise false.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="statusEffect" /> is <c>null</c>.</exception>
        public override bool TryAdd(IStatusEffect<StatType, StatusEffectType> statusEffect, ushort power)
        {
            if (statusEffect == null)
                throw new ArgumentNullException("statusEffect");

            ASEWithID existingStatusEffect;
            var alreadyExists = TryGetStatusEffect(statusEffect.StatusEffectType, out existingStatusEffect);

            var time = GetTime();
            var disableTime = (TickCount)(time + statusEffect.GetEffectTime(power));

            if (alreadyExists)
            {
                // Status effect already exists - merge with it
                var changed = existingStatusEffect.Value.MergeWith(time, power, disableTime);
                if (changed)
                {
                    RecalculateStatBonuses();
                    UpdateInDatabase(existingStatusEffect);
                }
                return changed;
            }
            else
            {
                // Status effect doesn't exist - create new instance
                var ase = new ActiveStatusEffect(statusEffect, power, disableTime);

                var id = InsertInDatabase(ase);

                var aseWithID = new ASEWithID(id, ase);
                _statusEffects.Add(aseWithID);

                OnAdded(aseWithID.Value);

                return true;
            }
        }