Ejemplo n.º 1
0
        private Pattern generate()
        {
            if (TotalColumns == 1)
            {
                var pattern = new Pattern();
                addToPattern(pattern, 0, HitObject.StartTime, EndTime);
                return(pattern);
            }

            if (spanCount > 1)
            {
                if (SegmentDuration <= 90)
                {
                    return(generateRandomHoldNotes(HitObject.StartTime, 1));
                }

                if (SegmentDuration <= 120)
                {
                    convertType |= PatternType.ForceNotStack;
                    return(generateRandomNotes(HitObject.StartTime, spanCount + 1));
                }

                if (SegmentDuration <= 160)
                {
                    return(generateStair(HitObject.StartTime));
                }

                if (SegmentDuration <= 200 && ConversionDifficulty > 3)
                {
                    return(generateRandomMultipleNotes(HitObject.StartTime));
                }

                double duration = EndTime - HitObject.StartTime;
                if (duration >= 4000)
                {
                    return(generateNRandomNotes(HitObject.StartTime, 0.23, 0, 0));
                }

                if (SegmentDuration > 400 && spanCount < TotalColumns - 1 - RandomStart)
                {
                    return(generateTiledHoldNotes(HitObject.StartTime));
                }

                return(generateHoldAndNormalNotes(HitObject.StartTime));
            }

            if (SegmentDuration <= 110)
            {
                if (PreviousPattern.ColumnWithObjects < TotalColumns)
                {
                    convertType |= PatternType.ForceNotStack;
                }
                else
                {
                    convertType &= ~PatternType.ForceNotStack;
                }
                return(generateRandomNotes(HitObject.StartTime, SegmentDuration < 80 ? 1 : 2));
            }

            if (ConversionDifficulty > 6.5)
            {
                if (convertType.HasFlag(PatternType.LowProbability))
                {
                    return(generateNRandomNotes(HitObject.StartTime, 0.78, 0.3, 0));
                }

                return(generateNRandomNotes(HitObject.StartTime, 0.85, 0.36, 0.03));
            }

            if (ConversionDifficulty > 4)
            {
                if (convertType.HasFlag(PatternType.LowProbability))
                {
                    return(generateNRandomNotes(HitObject.StartTime, 0.43, 0.08, 0));
                }

                return(generateNRandomNotes(HitObject.StartTime, 0.56, 0.18, 0));
            }

            if (ConversionDifficulty > 2.5)
            {
                if (convertType.HasFlag(PatternType.LowProbability))
                {
                    return(generateNRandomNotes(HitObject.StartTime, 0.3, 0, 0));
                }

                return(generateNRandomNotes(HitObject.StartTime, 0.37, 0.08, 0));
            }

            if (convertType.HasFlag(PatternType.LowProbability))
            {
                return(generateNRandomNotes(HitObject.StartTime, 0.17, 0, 0));
            }

            return(generateNRandomNotes(HitObject.StartTime, 0.27, 0, 0));
        }
Ejemplo n.º 2
0
        public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density,
                                         PatternType lastStair, IBeatmap originalBeatmap)
            : base(random, hitObject, beatmap, previousPattern, originalBeatmap)
        {
            if (previousTime > hitObject.StartTime)
            {
                throw new ArgumentOutOfRangeException(nameof(previousTime));
            }
            if (density < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(density));
            }

            StairType = lastStair;

            TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
            EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(hitObject.StartTime);

            var positionData = hitObject as IHasPosition;

            float  positionSeparation = ((positionData?.Position ?? Vector2.Zero) - previousPosition).Length;
            double timeSeparation     = hitObject.StartTime - previousTime;

            if (timeSeparation <= 80)
            {
                // More than 187 BPM
                convertType |= PatternType.ForceNotStack | PatternType.KeepSingle;
            }
            else if (timeSeparation <= 95)
            {
                // More than 157 BPM
                convertType |= PatternType.ForceNotStack | PatternType.KeepSingle | lastStair;
            }
            else if (timeSeparation <= 105)
            {
                // More than 140 BPM
                convertType |= PatternType.ForceNotStack | PatternType.LowProbability;
            }
            else if (timeSeparation <= 125)
            {
                // More than 120 BPM
                convertType |= PatternType.ForceNotStack;
            }
            else if (timeSeparation <= 135 && positionSeparation < 20)
            {
                // More than 111 BPM stream
                convertType |= PatternType.Cycle | PatternType.KeepSingle;
            }
            else if (timeSeparation <= 150 && positionSeparation < 20)
            {
                // More than 100 BPM stream
                convertType |= PatternType.ForceStack | PatternType.LowProbability;
            }
            else if (positionSeparation < 20 && density >= timingPoint.BeatLength / 2.5)
            {
                // Low density stream
                convertType |= PatternType.Reverse | PatternType.LowProbability;
            }
            else if (density < timingPoint.BeatLength / 2.5 || effectPoint.KiaiMode)
            {
                // High density
            }
            else
            {
                convertType |= PatternType.LowProbability;
            }

            if (!convertType.HasFlag(PatternType.KeepSingle))
            {
                if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && TotalColumns != 8)
                {
                    convertType |= PatternType.Mirror;
                }
                else if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP))
                {
                    convertType |= PatternType.Gathered;
                }
            }
        }