using System; using UnityEngine; namespace Soundings { public enum SunPoolStyle { Automatic, None, Compact, Family, Resort } public enum SunPoolShape { Rectangle, Oval } public enum SunPoolPosition { Midship, Aft, Forward } public enum SunAttraction { Automatic, None, MiniGolf, Theater, GoKarts, RollerCoaster } [Serializable] public struct SunDeckPlan { public SunPoolStyle Pool; public SunPoolShape Shape; public SunPoolPosition Position; public SunAttraction Attraction; public bool NoShade, ExtraLoungers; internal int Code => (int)Pool | (int)Shape << 3 | (int)Position << 4 | (int)Attraction << 6 | (NoShade ? 1 << 9 : 0) | (ExtraLoungers ? 1 << 10 : 0); internal int PoolPrice => Pool switch { SunPoolStyle.Compact => 9500, SunPoolStyle.Family => 21000, SunPoolStyle.Resort => 59000, _ => 0 }; internal int AttractionPrice => Attraction switch { SunAttraction.MiniGolf => 16000, SunAttraction.Theater => 36000, SunAttraction.GoKarts => 62000, SunAttraction.RollerCoaster => 145000, _ => 0 }; internal int AddedAmenities => (Pool switch { SunPoolStyle.Compact => 42, SunPoolStyle.Family => 86, SunPoolStyle.Resort => 172, _ => 0 }) + (Attraction switch { SunAttraction.MiniGolf => 52, SunAttraction.GoKarts => 78, SunAttraction.RollerCoaster => 124, _ => 0 }); internal int AddedShows => Attraction == SunAttraction.Theater ? 110 : 0; internal bool ValidFor(int hull) => (uint)Pool <= (uint)SunPoolStyle.Resort && (uint)Shape <= (uint)SunPoolShape.Oval && (uint)Position <= (uint)SunPoolPosition.Forward && (uint)Attraction <= (uint)SunAttraction.RollerCoaster && (Pool != SunPoolStyle.Resort || hull >= Market.Regional) && hull >= RequiredHull(Attraction); internal static int RequiredHull(SunAttraction attraction) => attraction switch { SunAttraction.Theater or SunAttraction.GoKarts => Market.Regional, SunAttraction.RollerCoaster => Market.Ocean, _ => 0 }; } public sealed partial class Ship { [SerializeField] private SunDeckPlan sunDeckPlan; public SunDeckPlan SunDeckPlan => sunDeckPlan; internal int SunDeckPlanCode => sunDeckPlan.Code; internal bool HasValidSunDeckPlan => sunDeckPlan.ValidFor(HullIndex); internal void SetSunDeckPlan(SunDeckPlan plan) => sunDeckPlan = plan; } public sealed partial class Company { internal static int SunDeckCost(Ship ship, SunDeckPlan next) { SunDeckPlan current = ship.SunDeckPlan; int pool = Math.Max(0, next.PoolPrice - current.PoolPrice); int attraction = next.Attraction == current.Attraction ? 0 : Math.Max(0, next.AttractionPrice - current.AttractionPrice / 4); return pool + attraction; } public string ChangeSunDeck(Ship ship, SunDeckPlan next) { if (ship == null || !Fleet.Contains(ship)) return "Choose a ship from your fleet."; if (!next.ValidFor(ship.HullIndex)) return "This fitting requires a larger hull."; if (next.Code == ship.SunDeckPlanCode) return null; int cost = SunDeckCost(ship, next); if (AvailableCash < cost) return $"The company needs ${cost:N0} available for this refit."; Cash -= cost; ship.SetSunDeckPlan(next); return null; } } }