-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathRushRuleset.cs
188 lines (157 loc) · 7.06 KB
/
RushRuleset.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// Copyright (c) Shane Woolcock. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Configuration;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Rulesets.Rush.Beatmaps;
using osu.Game.Rulesets.Rush.Configuration;
using osu.Game.Rulesets.Rush.Input;
using osu.Game.Rulesets.Rush.Mods;
using osu.Game.Rulesets.Rush.Replays;
using osu.Game.Rulesets.Rush.Scoring;
using osu.Game.Rulesets.Rush.UI;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Rush
{
public partial class RushRuleset : Ruleset
{
public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;
public const string SHORT_NAME = "rush";
private static readonly Lazy<bool> is_development_build = new Lazy<bool>(() => typeof(RushRuleset).Assembly.GetName().Name.EndsWith("-dev"));
public static bool IsDevelopmentBuild => is_development_build.Value;
public override string ShortName => !IsDevelopmentBuild ? SHORT_NAME : $"{SHORT_NAME}-dev";
public override string Description => !IsDevelopmentBuild ? "Rush!" : "Rush! (dev build)";
public override string PlayingVerb => "Punching doods";
public override RulesetSettingsSubsection CreateSettings() => new RushSettingsSubsection(this);
public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new RushRulesetConfigManager(settings, RulesetInfo);
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new DrawableRushRuleset(this, beatmap, mods);
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new RushBeatmapConverter(beatmap, this);
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new RushDifficultyCalculator(RulesetInfo, beatmap);
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new RushHealthProcessor();
public override ScoreProcessor CreateScoreProcessor() => new RushScoreProcessor(this);
public override IEnumerable<Mod> GetModsFor(ModType type)
{
switch (type)
{
case ModType.DifficultyReduction:
return new Mod[]
{
new RushModNoFail(),
new MultiMod(new RushModHalfTime(), new RushModDaycore())
};
case ModType.DifficultyIncrease:
return new Mod[]
{
new MultiMod(new RushModSuddenDeath(), new RushModPerfect()),
new MultiMod(new RushModDoubleTime(), new RushModNightcore()),
new RushModFlashlight()
};
case ModType.Automation:
return new[]
{
new MultiMod(new RushModAutoplay(), new RushModCinema())
};
case ModType.Fun:
return new[]
{
new MultiMod(new ModWindUp(), new ModWindDown())
};
default:
return Array.Empty<Mod>();
}
}
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
{
new KeyBinding(InputKey.J, RushAction.GroundPrimary),
new KeyBinding(InputKey.K, RushAction.GroundSecondary),
new KeyBinding(InputKey.L, RushAction.GroundTertiary),
new KeyBinding(InputKey.Semicolon, RushAction.GroundQuaternary),
new KeyBinding(InputKey.F, RushAction.AirPrimary),
new KeyBinding(InputKey.D, RushAction.AirSecondary),
new KeyBinding(InputKey.S, RushAction.AirTertiary),
new KeyBinding(InputKey.A, RushAction.AirQuaternary),
new KeyBinding(InputKey.MouseRight, RushAction.GroundPrimary),
new KeyBinding(InputKey.MouseLeft, RushAction.AirPrimary),
new KeyBinding(InputKey.Space, RushAction.Fever),
};
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new RushReplayFrame();
public override Drawable CreateIcon() => new RushIcon();
protected override IEnumerable<HitResult> GetValidHitResults()
{
return new[]
{
HitResult.Great,
HitResult.Good,
HitResult.SmallBonus,
HitResult.LargeBonus
};
}
public override LocalisableString GetDisplayNameForHitResult(HitResult result) => result switch
{
HitResult.SmallBonus => "Heart bonus",
HitResult.LargeBonus => "Fever bonus",
_ => base.GetDisplayNameForHitResult(result)
};
public partial class RushIcon : CompositeDrawable
{
public RushIcon()
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.Regular.Circle,
},
};
if (!RushRuleset.IsDevelopmentBuild)
{
AddInternal(new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.6f),
Icon = FontAwesome.Solid.Running,
});
}
else
{
AddRangeInternal(new[]
{
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.4f),
Icon = FontAwesome.Solid.Running,
Margin = new MarginPadding { Bottom = 0.5f, Right = 0.5f },
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.4f),
Icon = FontAwesome.Solid.Wrench,
Margin = new MarginPadding { Top = 0.5f, Left = 0.5f },
}
});
}
}
}
}
}