Пример #1
0
        protected override IEnumerable <TaikoHitObject> ConvertHitObject(HitObject obj, IBeatmap beatmap)
        {
            // Old osu! used hit sounding to determine various hit type information
            IList <HitSampleInfo> samples = obj.Samples;

            bool strong = samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH);

            switch (obj)
            {
            case IHasDistance distanceData:
            {
                // Number of spans of the object - one for the initial length and for each repeat
                int spans = (obj as IHasRepeats)?.SpanCount() ?? 1;

                TimingControlPoint     timingPoint     = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime);
                DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(obj.StartTime);

                double speedAdjustment         = difficultyPoint.SpeedMultiplier;
                double speedAdjustedBeatLength = timingPoint.BeatLength / speedAdjustment;

                // The true distance, accounting for any repeats. This ends up being the drum roll distance later
                double distance = distanceData.Distance * spans * LEGACY_VELOCITY_MULTIPLIER;

                // The velocity of the taiko hit object - calculated as the velocity of a drum roll
                double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier / speedAdjustedBeatLength;
                // The duration of the taiko hit object
                double taikoDuration = distance / taikoVelocity;

                // The velocity of the osu! hit object - calculated as the velocity of a slider
                double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier / speedAdjustedBeatLength;
                // The duration of the osu! hit object
                double osuDuration = distance / osuVelocity;

                // osu-stable always uses the speed-adjusted beatlength to determine the velocities, but
                // only uses it for tick rate if beatmap version < 8
                if (beatmap.BeatmapInfo.BeatmapVersion >= 8)
                {
                    speedAdjustedBeatLength *= speedAdjustment;
                }

                // If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat
                double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate, taikoDuration / spans);

                if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength)
                {
                    List <IList <HitSampleInfo> > allSamples = obj is IHasCurve curveData ? curveData.NodeSamples : new List <IList <HitSampleInfo> >(new[] { samples });

                    int i = 0;

                    for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing)
                    {
                        IList <HitSampleInfo> currentSamples = allSamples[i];
                        bool isRim = currentSamples.Any(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE);
                        strong = currentSamples.Any(s => s.Name == HitSampleInfo.HIT_FINISH);

                        yield return(new Hit
                            {
                                StartTime = j,
                                Type = isRim ? HitType.Rim : HitType.Centre,
                                Samples = currentSamples,
                                IsStrong = strong
                            });

                        i = (i + 1) % allSamples.Count;
                    }
                }
                else
                {
                    yield return(new DrumRoll
                        {
                            StartTime = obj.StartTime,
                            Samples = obj.Samples,
                            IsStrong = strong,
                            Duration = taikoDuration,
                            TickRate = beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate == 3 ? 3 : 4
                        });
                }

                break;
            }

            case IHasEndTime endTimeData:
            {
                double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier;

                yield return(new Swell
                    {
                        StartTime = obj.StartTime,
                        Samples = obj.Samples,
                        Duration = endTimeData.Duration,
                        RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier)
                    });

                break;
            }

            default:
            {
                bool isRim = samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE);

                yield return(new Hit
                    {
                        StartTime = obj.StartTime,
                        Type = isRim ? HitType.Rim : HitType.Centre,
                        Samples = obj.Samples,
                        IsStrong = strong
                    });

                break;
            }
            }
        }
Пример #2
0
        public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
        {
            base.ApplyDefaults(controlPointInfo, difficulty);

            Scale = 1.0f - 0.7f * (difficulty.CircleSize - 5) / 5;
        }
Пример #3
0
 /// <summary>
 /// Transfer initial settings from the beatmap to settings.
 /// </summary>
 /// <param name="difficulty">The beatmap's initial values.</param>
 protected virtual void TransferSettings(BeatmapDifficulty difficulty)
 {
     TransferSetting(DrainRate, difficulty.DrainRate);
     TransferSetting(OverallDifficulty, difficulty.OverallDifficulty);
 }
        private void songDetail_didPressPlayButtonEvent(IBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty)
        {
            _lastPlayedBeatmapLevel   = level;
            _lastPlayedCharacteristic = characteristic;
            _lastPlayedDifficulty     = difficulty;

            var playerData     = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First().playerData;
            var playerSettings = playerData.playerSpecificSettings;

            //Override defaults if we have forced options enabled
            if (_currentParameters.PlayerSettings.Options != PlayerOptions.None)
            {
                playerSettings = new PlayerSpecificSettings(
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.LeftHanded),
                    _currentParameters.PlayerSettings.PlayerHeight,
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AutoPlayerHeight),
                    _currentParameters.PlayerSettings.SfxVolume,
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.ReduceDebris),
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.NoHud),
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.NoFailEffects),
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AdvancedHud),
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AutoRestart),
                    _currentParameters.PlayerSettings.SaberTrailIntensity,
                    _currentParameters.PlayerSettings.NoteJumpStartBeatOffset,
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.HideNoteSpawnEffect),
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AdaptiveSfx),
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.StaticLights) ? EnvironmentEffectsFilterPreset.NoEffects : EnvironmentEffectsFilterPreset.AllEffects,
                    _currentParameters.PlayerSettings.Options.HasFlag(PlayerOptions.StaticLights) ? EnvironmentEffectsFilterPreset.NoEffects : EnvironmentEffectsFilterPreset.AllEffects
                    );
            }

            var songSpeed = GameplayModifiers.SongSpeed.Normal;

            if (_currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.SlowSong))
            {
                songSpeed = GameplayModifiers.SongSpeed.Slower;
            }
            if (_currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.FastSong))
            {
                songSpeed = GameplayModifiers.SongSpeed.Faster;
            }
            if (_currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.SuperFastSong))
            {
                songSpeed = GameplayModifiers.SongSpeed.SuperFast;
            }

            var gameplayModifiers = new GameplayModifiers(
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.DemoNoFail),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.DemoNoObstacles),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.BatteryEnergy) ? GameplayModifiers.EnergyType.Battery : GameplayModifiers.EnergyType.Bar,
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoFail),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.InstaFail),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.FailOnClash),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoObstacles) ? GameplayModifiers.EnabledObstacleType.NoObstacles : GameplayModifiers.EnabledObstacleType.All,
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoBombs),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.FastNotes),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.StrictAngles),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.DisappearingArrows),
                songSpeed,
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoArrows),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.GhostNotes),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.ProMode),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.ZenMode),
                _currentParameters.GameplayModifiers.Options.HasFlag(GameOptions.SmallCubes)
                );

            var colorScheme = playerData.colorSchemesSettings.overrideDefaultColors ? playerData.colorSchemesSettings.GetSelectedColorScheme() : null;

            //Disable scores if we need to
            if (((QualifierEvent.EventSettings)Event.Flags).HasFlag(QualifierEvent.EventSettings.DisableScoresaberSubmission))
            {
                BS_Utils.Gameplay.ScoreSubmission.DisableSubmission(SharedConstructs.Name);
            }

            SongUtils.PlaySong(level, characteristic, difficulty, playerData.overrideEnvironmentSettings, colorScheme, gameplayModifiers, playerSettings, SongFinished);
        }
        public PreviewBeatmapPacket Init(string levelId, string songName, string songSubName, string songAuthorName, string levelAuthorName, string characteristic, BeatmapDifficulty difficulty)
        {
            this.levelId         = levelId;
            this.songName        = songName;
            this.songSubName     = songSubName;
            this.songAuthorName  = songAuthorName;
            this.levelAuthorName = levelAuthorName;
            this.characteristic  = characteristic;
            this.difficulty      = difficulty;

            return(this);
        }
Пример #6
0
 /// <summary>
 /// Apply all custom settings to the provided beatmap.
 /// </summary>
 /// <param name="difficulty">The beatmap to have settings applied.</param>
 protected virtual void ApplySettings(BeatmapDifficulty difficulty)
 {
     ApplySetting(DrainRate, dr => difficulty.DrainRate = dr);
     ApplySetting(OverallDifficulty, od => difficulty.OverallDifficulty = od);
 }
Пример #7
0
        protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
        {
            base.ApplyDefaultsToSelf(controlPointInfo, difficulty);

            TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);

            tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate;
        }
Пример #8
0
 public AiReportDifficultyOneObject(BeatmapDifficulty difficulty, string condition, HitObjectBase h1, GameMode Mode = GameMode.All)
     : base(h1, null, Severity.Info, difficulty + " criteria: " + condition,0)
 {
 }
Пример #9
0
 /// <summary>
 /// Apply all custom settings to the provided beatmap.
 /// </summary>
 /// <param name="difficulty">The beatmap to have settings applied.</param>
 protected virtual void ApplySettings(BeatmapDifficulty difficulty)
 {
     difficulty.DrainRate         = DrainRate.Value;
     difficulty.OverallDifficulty = OverallDifficulty.Value;
 }
Пример #10
0
 public CatchPlayfield(BeatmapDifficulty difficulty)
 {
     this.difficulty = difficulty;
 }
Пример #11
0
 /// <summary>
 /// Transfer initial settings from the beatmap to settings.
 /// </summary>
 /// <param name="difficulty">The beatmap's initial values.</param>
 protected virtual void TransferSettings(BeatmapDifficulty difficulty)
 {
     DrainRate.Value         = DrainRate.Default = difficulty.DrainRate;
     OverallDifficulty.Value = OverallDifficulty.Default = difficulty.OverallDifficulty;
 }
Пример #12
0
 public void ReadFromDifficulty(BeatmapDifficulty difficulty)
 {
 }
Пример #13
0
        protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate)
        {
            var hitObjects = beatmap.HitObjects as List <OsuHitObject>;

            double mapLength = 0;

            if (beatmap.HitObjects.Count > 0)
            {
                mapLength = (beatmap.HitObjects.Last().StartTime - beatmap.HitObjects.First().StartTime) / 1000 / clockRate;
            }

            double preemptNoClockRate = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450);
            var    noteDensities      = NoteDensity.CalculateNoteDensities(hitObjects, preemptNoClockRate);

            // Tap
            var tapAttributes = Tap.CalculateTapAttributes(hitObjects, clockRate);

            // Finger Control
            double fingerControlDiff = FingerControl.CalculateFingerControlDiff(hitObjects, clockRate);

            // Aim
            var aimAttributes = Aim.CalculateAimAttributes(hitObjects, clockRate, tapAttributes.StrainHistory, noteDensities);

            double tapSr           = tap_multiplier * Math.Pow(tapAttributes.TapDifficulty, sr_exponent);
            double aimSr           = aim_multiplier * Math.Pow(aimAttributes.FcProbabilityThroughput, sr_exponent);
            double fingerControlSr = finger_control_multiplier * Math.Pow(fingerControlDiff, sr_exponent);
            double sr = Mean.PowerMean(new[] { tapSr, aimSr, fingerControlSr }, 7) * 1.131;

            HitWindows hitWindows = new OsuHitWindows();

            hitWindows.SetDifficulty(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);

            // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future
            double hitWindowGreat = (int)(hitWindows.WindowFor(HitResult.Great)) / clockRate;
            double preempt        = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate;

            int maxCombo = beatmap.HitObjects.Count;

            // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above)
            maxCombo += beatmap.HitObjects.OfType <Slider>().Sum(s => s.NestedHitObjects.Count - 1);

            return(new OsuDifficultyAttributes
            {
                StarRating = sr,
                Mods = mods,
                Length = mapLength,

                TapSr = tapSr,
                TapDiff = tapAttributes.TapDifficulty,
                StreamNoteCount = tapAttributes.StreamNoteCount,
                MashTapDiff = tapAttributes.MashedTapDifficulty,

                FingerControlSr = fingerControlSr,
                FingerControlDiff = fingerControlDiff,

                AimSr = aimSr,
                AimDiff = aimAttributes.FcProbabilityThroughput,
                AimHiddenFactor = aimAttributes.HiddenFactor,
                ComboTps = aimAttributes.ComboThroughputs,
                MissTps = aimAttributes.MissThroughputs,
                MissCounts = aimAttributes.MissCounts,
                CheeseNoteCount = aimAttributes.CheeseNoteCount,
                CheeseLevels = aimAttributes.CheeseLevels,
                CheeseFactors = aimAttributes.CheeseFactors,

                ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5,
                OverallDifficulty = (80 - hitWindowGreat) / 6,
                MaxCombo = maxCombo
            });
        }
Пример #14
0
        protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate)
        {
            if (!beatmap.HitObjects.Any())
            {
                return(new OsuDifficultyAttributes(mods, 0));
            }

            OsuDifficultyBeatmap difficultyBeatmap = new OsuDifficultyBeatmap(beatmap.HitObjects.Cast <OsuHitObject>().ToList(), timeRate);

            Skill[] skills =
            {
                new Aim(),
                new Speed()
            };

            double sectionLength = section_length * timeRate;

            // The first object doesn't generate a strain, so we begin with an incremented section end
            double currentSectionEnd = 2 * sectionLength;

            foreach (OsuDifficultyHitObject h in difficultyBeatmap)
            {
                while (h.BaseObject.StartTime > currentSectionEnd)
                {
                    foreach (Skill s in skills)
                    {
                        s.SaveCurrentPeak();
                        s.StartNewSectionFrom(currentSectionEnd);
                    }

                    currentSectionEnd += sectionLength;
                }

                foreach (Skill s in skills)
                {
                    s.Process(h);
                }
            }

            double aimRating   = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
            double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
            double starRating  = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2;

            // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future
            double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate;
            double preempt        = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate;

            int maxCombo = beatmap.HitObjects.Count();

            // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above)
            maxCombo += beatmap.HitObjects.OfType <Slider>().Sum(s => s.NestedHitObjects.Count - 1);

            return(new OsuDifficultyAttributes(mods, starRating)
            {
                AimStrain = aimRating,
                SpeedStrain = speedRating,
                ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5,
                OverallDifficulty = (80 - hitWindowGreat) / 6,
                MaxCombo = maxCombo
            });
        }
Пример #15
0
 public DrawableCatchRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
     : base(ruleset, beatmap)
 {
     Direction.Value = ScrollingDirection.Down;
     TimeRange.Value = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450);
 }
Пример #16
0
 public AiReportDifficultyOneObject(BeatmapDifficulty difficulty, string condition, HitObjectBase h1)
     : base(h1,h1.StartTime, null, Severity.Info, difficulty + " criteria: " + condition,0)
 {
 }
Пример #17
0
 public void ApplyToDifficulty(BeatmapDifficulty difficulty)
 {
     // Decrease AR to increase preempt time
     difficulty.ApproachRate *= 0.5f;
 }
Пример #18
0
        protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
        {
            base.ApplyDefaultsToSelf(controlPointInfo, difficulty);

            double offset;

            if (SpanIndex > 0)
            {
                // Adding 200 to include the offset stable used.
                // This is so on repeats ticks don't appear too late to be visually processed by the player.
                offset = 200;
            }
            else
            {
                offset = TimeFadeIn * 0.66f;
            }

            TimePreempt = (StartTime - SpanStartTime) / 2 + offset;
        }
Пример #19
0
        public void StartLevel(IPreviewBeatmapLevel song, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, GameplayModifiers modifiers)
        {
            if (connected && networkClient != null)
            {
#if DEBUG
                Plugin.log.Info("Starting level...");
#endif
                NetOutgoingMessage outMsg = networkClient.CreateMessage();
                outMsg.Write((byte)CommandType.StartLevel);

                new LevelOptionsInfo(difficulty, modifiers, characteristic.serializedName).AddToMessage(outMsg);
                SongInfo selectedSong = new SongInfo(song);
                selectedSong.songDuration = selectedSong.songDuration / modifiers.songSpeedMul;
                selectedSong.AddToMessage(outMsg);

                networkClient.SendMessage(outMsg, NetDeliveryMethod.ReliableOrdered, 0);
            }
        }
        public PreviewBeatmapPacket FromPreview(PreviewBeatmapStub preview, string characteristic, BeatmapDifficulty difficulty)
        {
            this.levelId         = preview.levelID;
            this.songName        = preview.songName;
            this.songSubName     = preview.songSubName;
            this.songAuthorName  = preview.songAuthorName;
            this.levelAuthorName = preview.levelAuthorName;
            this.characteristic  = characteristic;
            this.difficulty      = difficulty;

            return(this);
        }
Пример #21
0
        //Returns the next-highest difficulty to the one provided
        private static IDifficultyBeatmap GetHigherDifficulty(IDifficultyBeatmap[] availableMaps, BeatmapDifficulty difficulty, BeatmapCharacteristicSO characteristic)
        {
            var ret = availableMaps.SkipWhile(x => x.difficulty < difficulty).FirstOrDefault();

            if (ret is CustomLevel.CustomDifficultyBeatmap)
            {
                var extras       = Collections.RetrieveExtraSongData(ret.level.levelID);
                var requirements = extras?.difficulties.First(x => x.difficulty == ret.difficulty).additionalDifficultyData.requirements;
                Logger.Debug($"{ret.level.songName} is a custom level, checking for requirements on {ret.difficulty}...");
                if (
                    (requirements?.Count() > 0) &&
                    (!requirements?.ToList().All(x => Collections.capabilities.Contains(x)) ?? false)
                    )
                {
                    ret = null;
                }
                Logger.Debug((ret == null ? "Requirement not met." : "Requirement met!"));
            }
            return(ret);
        }
Пример #22
0
 public void ApplyToDifficulty(BeatmapDifficulty difficulty) => ApplySettings(difficulty);
Пример #23
0
 private void assertOk(List <HitObject> hitObjects, BeatmapDifficulty beatmapDifficulty)
 {
     Assert.That(check.Run(getContext(hitObjects, beatmapDifficulty)), Is.Empty);
 }
Пример #24
0
        protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
        {
            base.ApplyDefaultsToSelf(controlPointInfo, difficulty);

            TimingControlPoint     timingPoint     = controlPointInfo.TimingPointAt(StartTime);
            DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(StartTime);

            double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;

            Velocity     = scoringDistance / timingPoint.BeatLength;
            TickDistance = scoringDistance / difficulty.SliderTickRate;
        }
Пример #25
0
 public void Setup()
 {
     check      = new CheckTooShortSpinners();
     difficulty = new BeatmapDifficulty();
 }
Пример #26
0
 public TestCatcherArea(BeatmapDifficulty beatmapDifficulty)
     : base(beatmapDifficulty)
 {
 }
Пример #27
0
        //Returns the closest difficulty to the one provided, preferring lower difficulties first if any exist
        public static IDifficultyBeatmap GetClosestDifficultyPreferLower(IBeatmapLevel level, BeatmapDifficulty difficulty, BeatmapCharacteristicSO characteristic = null)
        {
            //First, look at the characteristic parameter. If there's something useful in there, we try to use it, but fall back to Standard

            var desiredCharacteristic = level.beatmapLevelData.difficultyBeatmapSets.FirstOrDefault(x => x.beatmapCharacteristic.serializedName == (characteristic?.serializedName ?? "Standard")) ?? level.beatmapLevelData.difficultyBeatmapSets.First();

            IDifficultyBeatmap[] availableMaps =
                level
                .beatmapLevelData
                .difficultyBeatmapSets
                .FirstOrDefault(x => x.beatmapCharacteristic.serializedName == desiredCharacteristic.beatmapCharacteristic.serializedName)
                .difficultyBeatmaps
                .OrderBy(x => x.difficulty)
                .ToArray();

            IDifficultyBeatmap ret = availableMaps.FirstOrDefault(x => x.difficulty == difficulty);

            if (ret is CustomDifficultyBeatmap)
            {
                var extras       = Collections.RetrieveExtraSongData(ret.level.levelID);
                var requirements = extras?._difficulties.First(x => x._difficulty == ret.difficulty).additionalDifficultyData._requirements;
                if (
                    (requirements?.Count() > 0) &&
                    (!requirements?.ToList().All(x => Collections.capabilities.Contains(x)) ?? false)
                    )
                {
                    ret = null;
                }
            }

            if (ret == null)
            {
                ret = GetLowerDifficulty(availableMaps, difficulty, desiredCharacteristic.beatmapCharacteristic);
            }
            if (ret == null)
            {
                ret = GetHigherDifficulty(availableMaps, difficulty, desiredCharacteristic.beatmapCharacteristic);
            }

            return(ret);
        }
Пример #28
0
 protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
 {
     base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
     SpinsRequired = 1;
 }
Пример #29
0
        //Returns the next-highest difficulty to the one provided
        private static IDifficultyBeatmap GetHigherDifficulty(IDifficultyBeatmap[] availableMaps, BeatmapDifficulty difficulty, BeatmapCharacteristicSO characteristic)
        {
            var ret = availableMaps.SkipWhile(x => x.difficulty < difficulty).FirstOrDefault();

            if (ret is CustomDifficultyBeatmap)
            {
                var extras       = Collections.RetrieveExtraSongData(ret.level.levelID);
                var requirements = extras?._difficulties.First(x => x._difficulty == ret.difficulty).additionalDifficultyData._requirements;
                if (
                    (requirements?.Count() > 0) &&
                    (!requirements?.ToList().All(x => Collections.capabilities.Contains(x)) ?? false)
                    )
                {
                    ret = null;
                }
            }
            return(ret);
        }
Пример #30
0
        protected override void ApplyBeatmap(Beatmap <TaikoHitObject> beatmap)
        {
            base.ApplyBeatmap(beatmap);

            hpMultiplier = 1 / (object_count_factor * beatmap.HitObjects.FindAll(o => o is Hit).Count *BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.5, 0.75, 0.98));

            hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120);
        }
Пример #31
0
        public static async void PlaySong(IPreviewBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, PlaySong packet)
        {
            flow = (SoloFreePlayFlowCoordinator)Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First().GetField("_soloFreePlayFlowCoordinator");
            Action <IBeatmapLevel> SongLoaded = (loadedLevel) =>
            {
                Logger.Debug("G");
                MenuTransitionsHelper _menuSceneSetupData = Resources.FindObjectsOfTypeAll <MenuTransitionsHelper>().First();
                IDifficultyBeatmap    diffbeatmap         = loadedLevel.beatmapLevelData.GetDifficultyBeatmap(characteristic, difficulty);
                Logger.Debug("L");
                GameplaySetupViewController gameplaySetupViewController = (GameplaySetupViewController)typeof(SinglePlayerLevelSelectionFlowCoordinator).GetField("_gameplaySetupViewController", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(flow);
                Logger.Debug("D");
                OverrideEnvironmentSettings environmentSettings = gameplaySetupViewController.environmentOverrideSettings;
                ColorScheme scheme = gameplaySetupViewController.colorSchemesSettings.GetSelectedColorScheme();
                //GameplayModifiers modifiers = gameplaySetupViewController.gameplayModifiers;
                PlayerSpecificSettings settings = gameplaySetupViewController.playerSettings;
                //TODO: re add modifier customizability

                PracticeSettings  practiceSettings = ConvertPractice(packet.practiceSettings);
                GameplayModifiers modifiers        = ConvertModifiers(packet.gameplayModifiers, gameplaySetupViewController.gameplayModifiers);
                Logger.Debug(diffbeatmap.level.levelID + " " + scheme.colorSchemeId);
                _menuSceneSetupData.StartStandardLevel(
                    "Solo",
                    diffbeatmap,
                    diffbeatmap.level,
                    environmentSettings,
                    scheme,
                    modifiers,
                    settings,
                    practiceSettings,
                    "Menu",
                    false,
                    null,
                    new Action <StandardLevelScenesTransitionSetupDataSO, LevelCompletionResults>((StandardLevelScenesTransitionSetupDataSO q, LevelCompletionResults r) => { })
                    );
            };

            if (flow == null || flow.gameObject == null || !flow.gameObject.activeInHierarchy)
            {
                Button button = Resources.FindObjectsOfTypeAll <Button>().Where(x => x != null && x.name == "SoloButton").First();
                button.onClick.Invoke();
            }
            if ((level is PreviewBeatmapLevelSO && await HasDLCLevel(level.levelID)) ||
                level is CustomPreviewBeatmapLevel)
            {
                Logger.Debug("Loading DLC/Custom level...");
                var result = await GetLevelFromPreview(level);

                if (!(result?.isError == true))
                {
                    SongLoaded(result?.beatmapLevel);
                    return;
                }
                Logger.Debug("You Suck Idiot");
            }
            else if (level is BeatmapLevelSO)
            {
                Logger.Debug("Reading OST data without songloader...");
                SongLoaded(level as IBeatmapLevel);
            }
            else
            {
                Logger.Debug($"Skipping unowned DLC ({level.songName})");
            }
        }
Пример #32
0
 public AiReportDifficulty(BeatmapDifficulty difficulty, string condition)
     : base(Severity.Info,difficulty + " criteria: " + condition)
 {
 }
Пример #33
0
        public static IDifficultyBeatmap GetDifficultyBeatmap(this IBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, bool strictDifficulty = false)
        {
            IDifficultyBeatmapSet difficultySet = null;

            if (characteristic == null)
            {
                difficultySet = level.beatmapLevelData.difficultyBeatmapSets.FirstOrDefault();
            }
            else
            {
                difficultySet = level.beatmapLevelData.difficultyBeatmapSets.FirstOrDefault(x => x.beatmapCharacteristic == characteristic);
                if (difficultySet == null)
                {
                    difficultySet = level.beatmapLevelData.difficultyBeatmapSets.FirstOrDefault();
                }
            }

            if (difficultySet == null)
            {
                Plugin.log.Error("Unable to find any difficulty set!");
                return(null);
            }

            IDifficultyBeatmap beatmap = difficultySet.difficultyBeatmaps.FirstOrDefault(x => x.difficulty == difficulty);

            if (beatmap == null && !strictDifficulty)
            {
                int index = GetClosestDifficultyIndex(difficultySet.difficultyBeatmaps, difficulty);
                if (index >= 0)
                {
                    return(difficultySet.difficultyBeatmaps[index]);
                }
                else
                {
                    Plugin.log.Error("Unable to find difficulty!");
                    return(null);
                }
            }
            else
            {
                return(beatmap);
            }
        }
Пример #34
0
 public AiReportDifficultyTwoObjects(BeatmapDifficulty difficulty, string condition, HitObjectBase h1, HitObjectBase h2)
     : base(h1, h2, null, Severity.Info, difficulty + " criteria: " + condition, 0)
 {
 }
Пример #35
0
 // Token: 0x06001A7C RID: 6780
 // RVA: 0x000819F0 File Offset: 0x0007FBF0
 private void method_2()
 {
     double num = Class466.Current.method_14();
     if (num < 2.0)
     {
         this.beatmapDifficulty_0 = BeatmapDifficulty.Easy;
         return;
     }
     if (num < 3.5)
     {
         this.beatmapDifficulty_0 = BeatmapDifficulty.Normal;
         return;
     }
     if (num < 4.5)
     {
         this.beatmapDifficulty_0 = BeatmapDifficulty.Hard;
         return;
     }
     if (num < 5.0)
     {
         this.beatmapDifficulty_0 = BeatmapDifficulty.Insane;
         return;
     }
     this.beatmapDifficulty_0 = BeatmapDifficulty.Expert;
 }