示例#1
0
        /// <summary>
        /// Generic Enemy stuff
        /// </summary>

        private int getPatternID()
        {
            SampleInfoList samples = enemy.Samples;
            bool           snipe   = samples.Any(s => s.Name == SampleInfo.HIT_WHISTLE);
            bool           wave    = samples.Any(s => s.Name == SampleInfo.HIT_NORMAL);
            bool           circle  = samples.Any(s => s.Name == SampleInfo.HIT_FINISH);
            bool           line    = samples.Any(s => s.Name == SampleInfo.HIT_CLAP);

            if (snipe)
            {
                return(patternID = 1);
            }
            if (circle)
            {
                return(patternID = 3);
            }
            if (line)
            {
                return(patternID = 4);
            }
            if (wave)
            {
                return(patternID = 2);
            }
            else
            {
                return(patternID = 0);
            }
        }
示例#2
0
        private SampleInfoList convertSoundType(LegacySoundType type, SampleBankInfo bankInfo)
        {
            var soundTypes = new SampleInfoList
            {
                new SampleInfo
                {
                    Bank   = bankInfo.Normal,
                    Name   = SampleInfo.HIT_NORMAL,
                    Volume = bankInfo.Volume
                }
            };

            if ((type & LegacySoundType.Finish) > 0)
            {
                soundTypes.Add(new SampleInfo
                {
                    Bank   = bankInfo.Add,
                    Name   = SampleInfo.HIT_FINISH,
                    Volume = bankInfo.Volume
                });
            }

            if ((type & LegacySoundType.Whistle) > 0)
            {
                soundTypes.Add(new SampleInfo
                {
                    Bank   = bankInfo.Add,
                    Name   = SampleInfo.HIT_WHISTLE,
                    Volume = bankInfo.Volume
                });
            }

            if ((type & LegacySoundType.Clap) > 0)
            {
                soundTypes.Add(new SampleInfo
                {
                    Bank   = bankInfo.Add,
                    Name   = SampleInfo.HIT_CLAP,
                    Volume = bankInfo.Volume
                });
            }

            return(soundTypes);
        }
示例#3
0
        protected override IEnumerable <TaikoHitObject> ConvertHitObject(HitObject obj, Beatmap beatmap)
        {
            var distanceData = obj as IHasDistance;
            var repeatsData  = obj as IHasRepeats;
            var endTimeData  = obj as IHasEndTime;
            var curveData    = obj as IHasCurve;

            // Old osu! used hit sounding to determine various hit type information
            SampleInfoList samples = obj.Samples;

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

            if (distanceData != null)
            {
                int repeats = repeatsData?.RepeatCount ?? 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 * repeats * 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.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
                // The duration of the taiko hit object
                double taikoDuration = distance / taikoVelocity;

                // For some reason, old osu! always uses speedAdjustment to determine the taiko velocity, but
                // only uses it to determine osu! velocity if beatmap version < 8. Let's account for that here.
                if (beatmap.BeatmapInfo.BeatmapVersion >= 8)
                {
                    speedAdjustedBeatLength *= speedAdjustment;
                }

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

                // 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.Difficulty.SliderTickRate, taikoDuration / repeats);

                if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength)
                {
                    List <SampleInfoList> allSamples = curveData != null ? curveData.RepeatSamples : new List <SampleInfoList>(new[] { samples });

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

                        if (isRim)
                        {
                            yield return(new RimHit
                            {
                                StartTime = j,
                                Samples = currentSamples,
                                IsStrong = strong
                            });
                        }
                        else
                        {
                            yield return(new CentreHit
                            {
                                StartTime = j,
                                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.Difficulty.SliderTickRate == 3 ? 3 : 4,
                    });
                }
            }
            else if (endTimeData != null)
            {
                double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier;

                yield return(new Swell
                {
                    StartTime = obj.StartTime,
                    Samples = obj.Samples,
                    IsStrong = strong,
                    Duration = endTimeData.Duration,
                    RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier),
                });
            }
            else
            {
                bool isRim = samples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE);

                if (isRim)
                {
                    yield return(new RimHit
                    {
                        StartTime = obj.StartTime,
                        Samples = obj.Samples,
                        IsStrong = strong,
                    });
                }
                else
                {
                    yield return(new CentreHit
                    {
                        StartTime = obj.StartTime,
                        Samples = obj.Samples,
                        IsStrong = strong,
                    });
                }
            }
        }