2017-03-02 08:57:33 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-03-13 20:05:09 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-03-12 21:13:43 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2017-04-29 00:21:33 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Replays;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2017-03-06 17:16:21 +08:00
|
|
|
|
using System;
|
2017-08-23 14:35:31 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-03-06 17:16:21 +08:00
|
|
|
|
using System.Linq;
|
2017-08-23 15:54:06 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.UI;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2017-08-23 14:35:31 +08:00
|
|
|
|
using OpenTK;
|
2017-12-10 00:43:30 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2017-12-27 00:25:18 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
|
using osu.Framework.Graphics;
|
2017-12-28 22:36:27 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2017-03-02 08:57:33 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
2017-03-02 08:57:33 +08:00
|
|
|
|
{
|
|
|
|
|
public class OsuModNoFail : ModNoFail
|
|
|
|
|
{
|
2017-03-06 17:16:21 +08:00
|
|
|
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
|
2017-03-02 08:57:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModEasy : ModEasy
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-10 00:43:30 +08:00
|
|
|
|
public class OsuModHidden : ModHidden, IApplicableToDrawableHitObjects
|
2017-03-02 08:57:33 +08:00
|
|
|
|
{
|
|
|
|
|
public override string Description => @"Play with no approach circles and fading notes for a slight score advantage.";
|
|
|
|
|
public override double ScoreMultiplier => 1.06;
|
2017-12-10 00:43:30 +08:00
|
|
|
|
|
2017-12-29 17:25:33 +08:00
|
|
|
|
private const double fade_in_duration_multiplier = 0.4;
|
|
|
|
|
private const double fade_out_duration_multiplier = 0.3;
|
2017-12-27 00:25:18 +08:00
|
|
|
|
|
|
|
|
|
private float preEmpt => DrawableOsuHitObject.TIME_PREEMPT;
|
|
|
|
|
|
2017-12-10 00:43:30 +08:00
|
|
|
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
|
|
|
|
{
|
2017-12-27 00:25:18 +08:00
|
|
|
|
foreach (var d in drawables.OfType<DrawableOsuHitObject>())
|
2017-12-30 01:04:40 +08:00
|
|
|
|
{
|
2017-12-29 15:22:06 +08:00
|
|
|
|
d.ApplyCustomUpdateState += ApplyHiddenState;
|
2017-12-30 13:46:44 +08:00
|
|
|
|
d.FadeInDuration = preEmpt * fade_in_duration_multiplier;
|
2017-12-30 01:04:40 +08:00
|
|
|
|
}
|
2017-12-27 00:25:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-29 15:22:06 +08:00
|
|
|
|
protected void ApplyHiddenState(DrawableHitObject drawable, ArmedState state)
|
2017-12-27 00:25:18 +08:00
|
|
|
|
{
|
|
|
|
|
if (!(drawable is DrawableOsuHitObject d))
|
|
|
|
|
return;
|
2017-12-10 00:43:30 +08:00
|
|
|
|
|
2017-12-30 00:52:28 +08:00
|
|
|
|
var fadeOutStartTime = d.HitObject.StartTime - preEmpt + d.FadeInDuration;
|
2017-12-29 17:25:33 +08:00
|
|
|
|
var fadeOutDuration = preEmpt * fade_out_duration_multiplier;
|
2017-12-27 00:25:18 +08:00
|
|
|
|
|
2017-12-28 22:36:27 +08:00
|
|
|
|
// new duration from completed fade in to end (before fading out)
|
2017-12-29 17:28:16 +08:00
|
|
|
|
var longFadeDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime;
|
2017-12-28 22:36:27 +08:00
|
|
|
|
|
2017-12-29 17:48:10 +08:00
|
|
|
|
switch (drawable)
|
2017-12-27 00:25:18 +08:00
|
|
|
|
{
|
2017-12-29 17:48:10 +08:00
|
|
|
|
case DrawableHitCircle circle:
|
|
|
|
|
// we don't want to see the approach circle
|
|
|
|
|
circle.ApproachCircle.Hide();
|
|
|
|
|
|
|
|
|
|
// fade out immediately after fade in.
|
2017-12-30 00:46:22 +08:00
|
|
|
|
using (drawable.BeginAbsoluteSequence(fadeOutStartTime, true))
|
2017-12-29 17:48:10 +08:00
|
|
|
|
circle.FadeOut(fadeOutDuration);
|
|
|
|
|
break;
|
|
|
|
|
case DrawableSlider slider:
|
|
|
|
|
using (slider.BeginAbsoluteSequence(fadeOutStartTime, true))
|
|
|
|
|
{
|
|
|
|
|
slider.Body.FadeOut(longFadeDuration, Easing.Out);
|
|
|
|
|
|
|
|
|
|
// delay a bit less to let the sliderball fade out peacefully instead of having a hard cut
|
|
|
|
|
using (slider.BeginDelayedSequence(longFadeDuration - fadeOutDuration, true))
|
|
|
|
|
slider.Ball.FadeOut(fadeOutDuration);
|
|
|
|
|
}
|
2017-12-28 04:23:56 +08:00
|
|
|
|
|
2017-12-29 17:48:10 +08:00
|
|
|
|
break;
|
|
|
|
|
case DrawableSpinner spinner:
|
|
|
|
|
// hide elements we don't care about.
|
|
|
|
|
spinner.Disc.Hide();
|
|
|
|
|
spinner.Ticks.Hide();
|
|
|
|
|
spinner.Background.Hide();
|
|
|
|
|
|
|
|
|
|
using (spinner.BeginAbsoluteSequence(fadeOutStartTime + longFadeDuration, true))
|
|
|
|
|
{
|
|
|
|
|
spinner.FadeOut(fadeOutDuration);
|
|
|
|
|
|
|
|
|
|
// speed up the end sequence accordingly
|
|
|
|
|
switch (state)
|
2017-12-28 04:23:56 +08:00
|
|
|
|
{
|
2017-12-29 17:48:10 +08:00
|
|
|
|
case ArmedState.Hit:
|
|
|
|
|
spinner.ScaleTo(spinner.Scale * 1.2f, fadeOutDuration * 2, Easing.Out);
|
|
|
|
|
break;
|
|
|
|
|
case ArmedState.Miss:
|
2017-12-30 00:44:10 +08:00
|
|
|
|
spinner.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.In);
|
2017-12-29 17:48:10 +08:00
|
|
|
|
break;
|
2017-12-28 04:23:56 +08:00
|
|
|
|
}
|
2017-12-29 17:48:10 +08:00
|
|
|
|
|
|
|
|
|
spinner.Expire();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
2017-12-27 00:25:18 +08:00
|
|
|
|
}
|
2017-12-10 00:43:30 +08:00
|
|
|
|
}
|
2017-03-02 08:57:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-16 19:35:57 +08:00
|
|
|
|
public class OsuModHardRock : ModHardRock, IApplicableToHitObject<OsuHitObject>
|
2017-03-02 08:57:33 +08:00
|
|
|
|
{
|
|
|
|
|
public override double ScoreMultiplier => 1.06;
|
|
|
|
|
public override bool Ranked => true;
|
2017-08-23 14:35:31 +08:00
|
|
|
|
|
2017-11-16 19:35:57 +08:00
|
|
|
|
public void ApplyToHitObject(OsuHitObject hitObject)
|
2017-08-23 14:35:31 +08:00
|
|
|
|
{
|
2017-11-16 19:35:57 +08:00
|
|
|
|
hitObject.Position = new Vector2(hitObject.Position.X, OsuPlayfield.BASE_SIZE.Y - hitObject.Y);
|
|
|
|
|
|
|
|
|
|
var slider = hitObject as Slider;
|
|
|
|
|
if (slider == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var newControlPoints = new List<Vector2>();
|
|
|
|
|
slider.ControlPoints.ForEach(c => newControlPoints.Add(new Vector2(c.X, OsuPlayfield.BASE_SIZE.Y - c.Y)));
|
|
|
|
|
|
|
|
|
|
slider.ControlPoints = newControlPoints;
|
|
|
|
|
slider.Curve?.Calculate(); // Recalculate the slider curve
|
|
|
|
|
}
|
2017-03-02 08:57:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModSuddenDeath : ModSuddenDeath
|
|
|
|
|
{
|
2017-03-06 17:16:21 +08:00
|
|
|
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
|
2017-03-02 08:57:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-31 00:49:06 +08:00
|
|
|
|
public class OsuModDaycore : ModDaycore
|
|
|
|
|
{
|
|
|
|
|
public override double ScoreMultiplier => 0.5;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-02 08:57:33 +08:00
|
|
|
|
public class OsuModDoubleTime : ModDoubleTime
|
|
|
|
|
{
|
|
|
|
|
public override double ScoreMultiplier => 1.12;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModRelax : ModRelax
|
|
|
|
|
{
|
|
|
|
|
public override string Description => "You don't need to click.\nGive your clicking/tapping finger a break from the heat of things.";
|
2017-03-06 17:16:21 +08:00
|
|
|
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
|
2017-03-02 08:57:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModHalfTime : ModHalfTime
|
|
|
|
|
{
|
|
|
|
|
public override double ScoreMultiplier => 0.5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModNightcore : ModNightcore
|
|
|
|
|
{
|
|
|
|
|
public override double ScoreMultiplier => 1.12;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModFlashlight : ModFlashlight
|
|
|
|
|
{
|
|
|
|
|
public override double ScoreMultiplier => 1.12;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-02 13:07:28 +08:00
|
|
|
|
public class OsuModPerfect : ModPerfect
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-02 08:57:33 +08:00
|
|
|
|
public class OsuModSpunOut : Mod
|
|
|
|
|
{
|
2017-03-06 17:28:30 +08:00
|
|
|
|
public override string Name => "Spun Out";
|
2017-08-13 23:41:13 +08:00
|
|
|
|
public override string ShortenedName => "SO";
|
2017-03-02 08:57:33 +08:00
|
|
|
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout;
|
|
|
|
|
public override string Description => @"Spinners will be automatically completed";
|
|
|
|
|
public override double ScoreMultiplier => 0.9;
|
|
|
|
|
public override bool Ranked => true;
|
2017-03-07 16:27:55 +08:00
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) };
|
2017-03-02 08:57:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModAutopilot : Mod
|
|
|
|
|
{
|
2017-03-06 17:28:30 +08:00
|
|
|
|
public override string Name => "Autopilot";
|
2017-08-13 23:41:13 +08:00
|
|
|
|
public override string ShortenedName => "AP";
|
2017-03-02 08:57:33 +08:00
|
|
|
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot;
|
|
|
|
|
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
|
|
|
|
|
public override double ScoreMultiplier => 0;
|
|
|
|
|
public override bool Ranked => false;
|
2017-03-07 16:27:55 +08:00
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };
|
2017-03-06 17:16:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-13 20:05:09 +08:00
|
|
|
|
public class OsuModAutoplay : ModAutoplay<OsuHitObject>
|
2017-03-06 17:16:21 +08:00
|
|
|
|
{
|
2017-05-12 20:13:02 +08:00
|
|
|
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModSpunOut) }).ToArray();
|
2017-03-12 21:13:43 +08:00
|
|
|
|
|
2017-03-13 20:05:09 +08:00
|
|
|
|
protected override Score CreateReplayScore(Beatmap<OsuHitObject> beatmap) => new Score
|
2017-03-12 21:13:43 +08:00
|
|
|
|
{
|
2017-04-29 02:08:48 +08:00
|
|
|
|
Replay = new OsuAutoGenerator(beatmap).Generate()
|
2017-03-13 20:05:09 +08:00
|
|
|
|
};
|
2017-03-02 08:57:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OsuModTarget : Mod
|
|
|
|
|
{
|
2017-03-06 17:28:30 +08:00
|
|
|
|
public override string Name => "Target";
|
2017-08-13 23:41:13 +08:00
|
|
|
|
public override string ShortenedName => "TP";
|
2017-03-02 08:57:33 +08:00
|
|
|
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_target;
|
|
|
|
|
public override string Description => @"";
|
|
|
|
|
public override double ScoreMultiplier => 1;
|
|
|
|
|
}
|
|
|
|
|
}
|