<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Prism.Mods;
using Prism.Mods.Hooks;
using Prism.Util;
using Terraria;

namespace Prism.API.Audio
{
    public static class Bgm
    {
        const float fade_delta = 0.005f;

        internal static Dictionary<string, BgmEntry> VanillaDicts = new Dictionary<string, BgmEntry>();
        internal static Dictionary<ModInfo, Dictionary<string, BgmEntry>> ByMod = new Dictionary<ModInfo, Dictionary<string, BgmEntry>>();

        static BgmEntry current;

        static IEnumerable<KeyValuePair<string, BgmEntry>> GetEntries()
        {
            return VanillaDicts.Concat(ByMod.Select(kvp => kvp.Value).Flatten());
        }
        static float GetMoonLordSpawnFade(BgmEntry current)
        {
            float ret = 1f;
            if (NPC.MoonLordCountdown > 0)
            {
                ret = NPC.MoonLordCountdown / 3600f;
                ret *= ret; // fade out exponentially

                if (NPC.MoonLordCountdown > 720)
                    ret = MathHelper.Lerp(0f, 1f, ret);
                else // mute completely for the last 3 minutes
                {
                    ret = 0f;
                    current = null;
                }

                // just spawned -> fade back in<commit_msg>Where the actual fuck did you get 3 minutes from, Poro?<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Prism.Mods;
using Prism.Mods.Hooks;
using Prism.Util;
using Terraria;

namespace Prism.API.Audio
{
    public static class Bgm
    {
        const float fade_delta = 0.005f;

        internal static Dictionary<string, BgmEntry> VanillaDicts = new Dictionary<string, BgmEntry>();
        internal static Dictionary<ModInfo, Dictionary<string, BgmEntry>> ByMod = new Dictionary<ModInfo, Dictionary<string, BgmEntry>>();

        static BgmEntry current;

        static IEnumerable<KeyValuePair<string, BgmEntry>> GetEntries()
        {
            return VanillaDicts.Concat(ByMod.Select(kvp => kvp.Value).Flatten());
        }
        static float GetMoonLordSpawnFade(BgmEntry current)
        {
            float ret = 1f;
            if (NPC.MoonLordCountdown > 0)
            {
                ret = NPC.MoonLordCountdown / 3600f;
                ret *= ret; // fade out exponentially

                if (NPC.MoonLordCountdown > 720)
                    ret = MathHelper.Lerp(0f, 1f, ret);
                else // mute completely for the last 12 seconds
                {
                    ret = 0f;
                    current = null;
                }

                // just spawned -> fade back in
{'fraction_non_alphanumeric': 0.08866642831605291, 'fraction_numerical': 0.012870933142652842, 'mean_word_length': 2.0118406889128093, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '475313', 'n_tokens_mistral': 862, 'n_tokens_neox': 765, 'n_words': 205}