public void Start(OsuBeatmap beatmap)
    {
        Ac__DisplayClass15_0 ac__DisplayClass15_ = default(Ac__DisplayClass15_0);

        ac__DisplayClass15_.A4__this = this;
        ac__DisplayClass15_.beatmap  = beatmap;
        this.beatmap = ac__DisplayClass15_.beatmap;
        enabled      = true;
        ac__DisplayClass15_.index            = osu.Player.HitObjectManager.CurrentHitObjectIndex;
        ac__DisplayClass15_.currentHitObject = ac__DisplayClass15_.beatmap.HitObjects[ac__DisplayClass15_.index];
        ac__DisplayClass15_.hitObjectRadius  = osu.HitObjectRadius(ac__DisplayClass15_.beatmap.CircleSize);
        while (osu.CanPlay && ac__DisplayClass15_.index < ac__DisplayClass15_.beatmap.HitObjects.Count && enabled)
        {
            Thread.Sleep(10);
            if (osu.IsPaused)
            {
                continue;
            }
            int currentTime = osu.CurrentTime;
            if (currentTime <= ac__DisplayClass15_.currentHitObject.EndTime)
            {
                ac__DisplayClass15_.hitObjectPosition = ((ac__DisplayClass15_.currentHitObject is OsuSlider) ? (ac__DisplayClass15_.currentHitObject as OsuSlider).PositionAtTime(osu.CurrentTime) : ac__DisplayClass15_.currentHitObject.Position);
                if (!(ac__DisplayClass15_.currentHitObject is OsuSpinner))
                {
                    AStartg__aimAssist15_0(osu.WindowManager.PlayfieldToScreen(ac__DisplayClass15_.hitObjectPosition), ref ac__DisplayClass15_);
                }
                lastMousePos = osu.Player.Ruleset.MousePosition;
            }
            if (currentTime >= ac__DisplayClass15_.currentHitObject.EndTime)
            {
                AStartg__getNextObject15_2(ref ac__DisplayClass15_);
            }
            while (osu.CanPlay && ac__DisplayClass15_.index >= ac__DisplayClass15_.beatmap.HitObjects.Count && enabled)
            {
                Thread.Sleep(5);
            }
        }
    }
Esempio n. 2
0
        public void Reset(OsuBeatmap beatmap)
        {
            this.beatmap = beatmap;

            hitWindow50  = osuManager.HitWindow50(beatmap.OverallDifficulty);
            hitWindow100 = osuManager.HitWindow100(beatmap.OverallDifficulty);
            hitWindow300 = osuManager.HitWindow300(beatmap.OverallDifficulty);

            var mods = osuManager.Player.HitObjectManager.CurrentMods;

            audioRate = mods.HasFlag(Mods.HalfTime) ? 0.75f : mods.HasFlag(Mods.DoubleTime) ? 1.5f : 1;

            minOffset          = calculateTimingOffset(configManager.HitTimingsMinOffset);
            maxOffset          = calculateTimingOffset(configManager.HitTimingsMaxOffset);
            minAlternateOffset = calculateTimingOffset(configManager.HitTimingsAlternateMinOffset);
            maxAlternateOffset = calculateTimingOffset(configManager.HitTimingsAlternateMaxOffset);

            hitObjectRadius = osuManager.HitObjectRadius(beatmap.CircleSize);
            missRadius      = configManager.HitScanMissRadius;

            canMiss            = false;
            lastHitScanIndex   = -1;
            lastOnNotePosition = null;
        }
Esempio n. 3
0
    public void Start(OsuBeatmap beatmap)
    {
        Ac__DisplayClass18_0 ac__DisplayClass18_ = default(Ac__DisplayClass18_0);

        ac__DisplayClass18_.A4__this = this;
        ac__DisplayClass18_.beatmap  = beatmap;
        this.beatmap                     = ac__DisplayClass18_.beatmap;
        enabled                          = true;
        ac__DisplayClass18_.key1         = (VirtualKeyCode)osu.BindingManager.GetKeyCode(Bindings.OsuLeft);
        ac__DisplayClass18_.key2         = (VirtualKeyCode)osu.BindingManager.GetKeyCode(Bindings.OsuRight);
        currentKeyPressed                = ac__DisplayClass18_.key2;
        ac__DisplayClass18_.beatmapSpeed = (osu.Player.HitObjectManager.CurrentMods.HasFlag(Mods.DoubleTime) ? 1.5f : (osu.Player.HitObjectManager.CurrentMods.HasFlag(Mods.HalfTime) ? 0.75f : 1f));
        int num  = osu.HitWindow50(ac__DisplayClass18_.beatmap.OverallDifficulty);
        int num2 = osu.HitWindow50(ac__DisplayClass18_.beatmap.OverallDifficulty);
        int num3 = osu.HitWindow100(ac__DisplayClass18_.beatmap.OverallDifficulty);
        int num4 = osu.HitWindow300(ac__DisplayClass18_.beatmap.OverallDifficulty);

        ac__DisplayClass18_.hitObjectRadius = osu.HitObjectRadius(ac__DisplayClass18_.beatmap.CircleSize);
        ac__DisplayClass18_.alreadyHit      = false;
        bool flag = false;

        ac__DisplayClass18_.rand             = new Random();
        ac__DisplayClass18_.randomOffset     = ac__DisplayClass18_.rand.Next(-offset, offset);
        ac__DisplayClass18_.randomHoldTime   = ac__DisplayClass18_.rand.Next((int)(((float)holdTime - 5f) * ac__DisplayClass18_.beatmapSpeed), (int)(((float)holdTime + 5f) * ac__DisplayClass18_.beatmapSpeed));
        ac__DisplayClass18_.lastTimeHit      = 0;
        ac__DisplayClass18_.index            = osu.Player.HitObjectManager.CurrentHitObjectIndex;
        ac__DisplayClass18_.currentHitObject = ac__DisplayClass18_.beatmap.HitObjects[ac__DisplayClass18_.index];
        AStartg__releaseBothKeys18_2(ref ac__DisplayClass18_);
        Ac__DisplayClass18_1 ac__DisplayClass18_2 = default(Ac__DisplayClass18_1);

        while (osu.CanPlay && ac__DisplayClass18_.index < ac__DisplayClass18_.beatmap.HitObjects.Count && enabled)
        {
            TimingHelper.Delay(1u);
            if (osu.IsPaused)
            {
                Thread.Sleep(5);
                continue;
            }
            ac__DisplayClass18_2.currentTime = osu.CurrentTime;
            if (ac__DisplayClass18_2.currentTime >= ac__DisplayClass18_.currentHitObject.StartTime - num)
            {
                ac__DisplayClass18_.hitObjectPosition = ((ac__DisplayClass18_.currentHitObject is OsuSlider) ? (ac__DisplayClass18_.currentHitObject as OsuSlider).PositionAtTime(osu.CurrentTime) : ac__DisplayClass18_.currentHitObject.Position);
                if (!ac__DisplayClass18_.alreadyHit)
                {
                    if (AStartg__isMouseOnNote18_1(ref ac__DisplayClass18_))
                    {
                        if (ac__DisplayClass18_2.currentTime >= ac__DisplayClass18_.currentHitObject.StartTime + ac__DisplayClass18_.randomOffset)
                        {
                            flag = false;
                            AStartg__pressKey18_4(ref ac__DisplayClass18_, ref ac__DisplayClass18_2);
                        }
                    }
                    else if (ac__DisplayClass18_2.currentTime >= ac__DisplayClass18_.currentHitObject.StartTime + num2)
                    {
                        flag = true;
                        AStartg__pressKey18_4(ref ac__DisplayClass18_, ref ac__DisplayClass18_2);
                    }
                }
            }
            if (!flag & ac__DisplayClass18_.alreadyHit)
            {
                if (ac__DisplayClass18_2.currentTime >= ac__DisplayClass18_.currentHitObject.EndTime + ac__DisplayClass18_.randomOffset + ac__DisplayClass18_.randomHoldTime)
                {
                    AStartg__releaseKey18_5(ref ac__DisplayClass18_);
                    AStartg__getNextObject18_3(ref ac__DisplayClass18_);
                }
            }
            else if (ac__DisplayClass18_2.currentTime >= ac__DisplayClass18_.currentHitObject.EndTime + num2 + ac__DisplayClass18_.randomHoldTime)
            {
                AStartg__releaseKey18_5(ref ac__DisplayClass18_);
                AStartg__getNextObject18_3(ref ac__DisplayClass18_);
            }
            while (osu.CanPlay && ac__DisplayClass18_.index >= ac__DisplayClass18_.beatmap.HitObjects.Count && enabled)
            {
                Thread.Sleep(5);
            }
        }
    }
Esempio n. 4
0
        private HitScanResult getHitScanResult(int index)
        {
            var hitObject = currentBeatmap.HitObjects[index];

            if (!configManager.EnableHitScan || hitObject is Spinner)
            {
                return(HitScanResult.CanHit);
            }

            if (lastHitScanIndex != index)
            {
                lastHitScanIndex   = index;
                lastOnNotePosition = null;
                lastSliderPath     = hitObject is Slider slider ? new SliderPath(slider) : null;
            }

            float   hitObjectRadius   = osuManager.HitObjectRadius(currentBeatmap.DifficultySection.CircleSize);
            Vector2 hitObjectPosition = hitObject.Position;

            if (hitObject is Slider && osuManager.CurrentTime > hitObject.StartTime)
            {
                float  sliderDuration    = hitObject.EndTime - hitObject.StartTime;
                float  currentSliderTime = osuManager.CurrentTime - hitObject.StartTime;
                double progress          = (currentSliderTime / sliderDuration).Clamp(0, 1) * (hitObject as Slider).Repeats % 1;
                progress = lastSliderPath.ProgressAt(progress);

                hitObjectPosition += lastSliderPath.PositionAt(progress);
            }

            float distanceToObject  = Vector2.Distance(osuManager.CursorPosition, hitObjectPosition * osuManager.OsuWindow.PlayfieldRatio);
            float distanceToLastPos = Vector2.Distance(osuManager.CursorPosition, lastOnNotePosition ?? Vector2.Zero);

            if (osuManager.CurrentTime > hitObject.EndTime + hitWindow50)
            {
                if (configManager.HitScanMissAfterHitWindow50)
                {
                    if (distanceToObject <= hitObjectRadius + configManager.HitScanRadiusAdditional && !intersectsWithOtherHitObjects(index + 1))
                    {
                        return(HitScanResult.ShouldHit);
                    }
                }

                return(HitScanResult.MoveToNextObject);
            }

            if (configManager.EnableHitScanPrediction)
            {
                if (distanceToObject > hitObjectRadius * configManager.HitScanRadiusMultiplier)
                {
                    if (lastOnNotePosition != null && distanceToLastPos <= configManager.HitScanMaxDistance)
                    {
                        return(HitScanResult.ShouldHit);
                    }
                }
                else
                {
                    lastOnNotePosition = osuManager.CursorPosition;
                }
            }

            if (distanceToObject <= hitObjectRadius)
            {
                return(HitScanResult.CanHit);
            }

            if (configManager.HitScanMissChance != 0)
            {
                if (distanceToObject <= hitObjectRadius + configManager.HitScanRadiusAdditional && random.Next(1, 101) <= configManager.HitScanMissChance && !intersectsWithOtherHitObjects(index + 1))
                {
                    return(HitScanResult.CanHit);
                }
            }

            return(HitScanResult.Wait);
        }