// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Configuration; namespace osu.Game.Rulesets.Mods { public interface IMod : IEquatable { /// /// The shortened name of this mod. /// string Acronym { get; } /// /// The name of this mod. /// string Name { get; } /// /// Short important information to display on the mod icon. For example, a rate adjust mod's rate /// or similarly important setting. /// Use if the icon should not display any additional info. /// string ExtendedIconInformation { get; } /// /// The user readable description of this mod. /// LocalisableString Description { get; } /// /// The type of this mod. /// ModType Type { get; } /// /// The icon of this mod. /// IconUsage? Icon { get; } /// /// Whether this mod is playable by a real human user. /// Should be false for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example). /// bool UserPlayable { get; } /// /// Whether this mod is valid for multiplayer matches. /// Should be false for mods that make gameplay duration dependent on user input (e.g. ). /// bool ValidForMultiplayer { get; } /// /// Whether this mod is valid as a required mod when freestyle is enabled. /// Should be true for mods that are guaranteed to be implemented across all rulesets. /// bool ValidForFreestyleAsRequiredMod { get; } /// /// Whether this mod is valid as a free mod in multiplayer matches. /// Should be false for mods that affect the gameplay duration (e.g. and ). /// bool ValidForMultiplayerAsFreeMod { get; } /// /// Indicates that this mod is always permitted in scenarios wherein a user is submitting a score regardless of other circumstances. /// Intended for mods that are informational in nature and do not really affect gameplay by themselves, /// but are more of a gauge of increased/decreased difficulty due to the user's configuration (e.g. ). /// bool AlwaysValidForSubmission { get; } /// /// Whether scores with this mod active can give performance points. /// bool Ranked { get; } /// /// Create a fresh instance based on this mod. /// Mod CreateInstance() => (Mod)Activator.CreateInstance(GetType())!; /// /// Whether any user adjustable setting attached to this mod has a non-default value. /// /// /// This returns the instantaneous state of this mod. It may change over time. /// For tracking changes on a dynamic display, make sure to setup a . /// bool HasNonDefaultSettings { get { bool hasAdjustments = false; foreach (var (_, property) in this.GetSettingsSourceProperties()) { var bindable = (IBindable)property.GetValue(this)!; if (!bindable.IsDefault) { hasAdjustments = true; break; } } return hasAdjustments; } } } }