Beispiel #1
0
    private static bool AddictionMatchesType(Addiction addiction, Effect.DelayLength length)
    {
        var info = addiction.GetWithdrawInfo;

        if (!info.nowInWithdraw)
        {
            return(addiction.WithdrawDelayLength == length);
        }
        else
        {
            return(addiction.WithdrawLength == length);
        }
    }
Beispiel #2
0
    private void UpdateAddictions(Effect.DelayLength length)
    {
        for (var i = 0; i < _activeAddictions.Count; i++)
        {
            var addiction  = _activeAddictions[i];
            var passedTime = addiction.TryPassTime(-1, length, out var withdrawInfo);
            if (!passedTime || !withdrawInfo.nowInWithdraw)
            {
                continue;
            }

            if (!withdrawInfo.wasInWithdraw)
            {
                ApplyEffect(addiction.Effects);
            }
            else if (withdrawInfo.withdrawEnding)
            {
                ApplyInvertedEffects(addiction.Effects);
                _activeAddictions.Remove(addiction);
                i--;
            }
        }
    }