namespace GrassCutter { /// /// How big Herbaria-7 is. The ball keeps its 163 830 sectors whatever its size, so a smaller ball has smaller sectors /// too: less grass all round and every sector done sooner. The host picks it for a new save, it stays with the save, /// and everyone who joins gets the host's ball. 0 is the whole planet, as every save from before there was a choice. /// public enum Difficulty : byte { Hazard = 0, HoldMyBeer = 1, Mommy = 2 } public static class Difficulties { /// Easiest first, the way the choice is offered. public static readonly Difficulty[] Order = { Difficulty.Mommy, Difficulty.HoldMyBeer, Difficulty.Hazard }; public static string Name(Difficulty d) => d == Difficulty.Mommy ? "Mommy, I'm Scared!" : d == Difficulty.HoldMyBeer ? "Hold My Beer!" : "I AM THE FUCKING HAZARD!"; public static string Tag(Difficulty d) => Loc.T(d == Difficulty.Mommy ? Loc.N("EASY") : d == Difficulty.HoldMyBeer ? Loc.N("NORMAL") : Loc.N("EXTRA HARD")); public static string Blurb(Difficulty d) => Loc.T( d == Difficulty.Mommy ? Loc.N("A planet a third the size, with sectors to match. Earth can wait a little.") : d == Difficulty.HoldMyBeer ? Loc.N("Half the planet, half-size sectors. Still a lot of lawn.") : Loc.N("The whole of Herbaria-7, full-size sectors, every blade of it.")); /// The planet's radius against the whole one. public static float Scale(Difficulty d) => d == Difficulty.Mommy ? 1f / 3f : d == Difficulty.HoldMyBeer ? 0.5f : 1f; /// What the next new save starts on: set by the menu (and `-difficulty 0..2` for the dev bots). public static Difficulty Chosen = Difficulty.Hazard; /// The ball the world is built on right now. public static Difficulty Current { get; private set; } = Difficulty.Hazard; /// Builds the world on the ball for this difficulty, if it isn't on it already. public static void Apply(Difficulty d) { if (d != Difficulty.Mommy && d != Difficulty.HoldMyBeer) d = Difficulty.Hazard; if (d == Current) return; Current = d; Planet.Rescale(GameDefs.PlanetRadius * Scale(d)); } } }