Add MEGA Ocean Liner, split decks, and detailed ship materials

This commit is contained in:
josh
2026-11-28 21:02:42 -05:00
parent ce0d38c8de
commit 46624bf5ba
47 changed files with 2042 additions and 382 deletions

View File

@@ -3,10 +3,10 @@ using UnityEngine;
namespace BigShipTycoon
{
public enum SunPoolStyle { Automatic, None, Compact, Family, Resort }
public enum SunPoolStyle { Automatic, None, Compact, Family, Resort, Lagoon }
public enum SunPoolShape { Rectangle, Oval }
public enum SunPoolPosition { Midship, Aft, Forward }
public enum SunAttraction { Automatic, None, MiniGolf, Theater, GoKarts, RollerCoaster, Pool }
public enum SunAttraction { Automatic, None, MiniGolf, Theater, GoKarts, RollerCoaster, Pool, SkyGarden }
[Serializable]
public struct SunDeckPlacement
@@ -51,21 +51,24 @@ namespace BigShipTycoon
internal static int PoolPriceFor(SunPoolStyle pool) => pool switch
{
SunPoolStyle.Compact => 9500, SunPoolStyle.Family => 21000, SunPoolStyle.Resort => 59000, _ => 0
SunPoolStyle.Compact => 9500, SunPoolStyle.Family => 21000, SunPoolStyle.Resort => 59000,
SunPoolStyle.Lagoon => 145000, _ => 0
};
internal static int AttractionPrice(SunAttraction kind) => kind switch
{
SunAttraction.MiniGolf => 16000, SunAttraction.Theater => 36000, SunAttraction.GoKarts => 62000,
SunAttraction.RollerCoaster => 145000, _ => 0
SunAttraction.RollerCoaster => 145000, SunAttraction.SkyGarden => 124000, _ => 0
};
private static int PoolAdmissions(SunPoolStyle pool) => pool switch
{
SunPoolStyle.Compact => 42, SunPoolStyle.Family => 86, SunPoolStyle.Resort => 172, _ => 0
SunPoolStyle.Compact => 42, SunPoolStyle.Family => 86, SunPoolStyle.Resort => 172,
SunPoolStyle.Lagoon => 330, _ => 0
};
private static int AttractionAdmissions(SunAttraction kind) => kind switch
{
SunAttraction.MiniGolf => 52, SunAttraction.GoKarts => 78, SunAttraction.RollerCoaster => 124, _ => 0
SunAttraction.MiniGolf => 52, SunAttraction.GoKarts => 78, SunAttraction.RollerCoaster => 124,
SunAttraction.SkyGarden => 195, _ => 0
};
internal int AddedAmenities => CustomLayout ? AddedCapacity(false) : PoolAdmissions(Pool) + AttractionAdmissions(Attraction);
@@ -85,14 +88,19 @@ namespace BigShipTycoon
return count;
}
internal bool ValidOptions(int hull) => (uint)Pool <= (uint)SunPoolStyle.Resort && (uint)Shape <= (uint)SunPoolShape.Oval
internal bool ValidOptions(int hull) => (uint)Pool <= (uint)SunPoolStyle.Lagoon && (uint)Shape <= (uint)SunPoolShape.Oval
&& (uint)Position <= (uint)SunPoolPosition.Forward && (uint)Attraction <= (uint)SunAttraction.RollerCoaster
&& (Pool != SunPoolStyle.Resort || hull >= Market.Regional) && hull >= RequiredHull(Attraction);
&& hull >= RequiredHull(Pool) && hull >= RequiredHull(Attraction);
internal static int RequiredHull(SunPoolStyle pool) => pool switch
{
SunPoolStyle.Resort => Market.Regional, SunPoolStyle.Lagoon => Market.Mega, _ => 0
};
internal static int RequiredHull(SunAttraction attraction) => attraction switch
{
SunAttraction.Theater or SunAttraction.GoKarts => Market.Regional,
SunAttraction.RollerCoaster => Market.Ocean,
SunAttraction.RollerCoaster => Market.Ocean, SunAttraction.SkyGarden => Market.Mega,
_ => 0
};
}
@@ -100,21 +108,44 @@ namespace BigShipTycoon
public sealed partial class Ship
{
[SerializeField] private SunDeckPlan sunDeckPlan;
public SunDeckPlan SunDeckPlan => sunDeckPlan;
internal int SunDeckPlanCode => sunDeckPlan.Code;
[SerializeField] private SunDeckPlan aftSunDeckPlan;
public SunDeckPlan SunDeckPlan => SunDeckFor(SunDeckZone.Sky);
public bool HasAftTerrace => HullIndex == Market.Mega;
internal int OutdoorAmenityCapacity => sunDeckPlan.AddedAmenities + (HasAftTerrace ? aftSunDeckPlan.AddedAmenities : 0);
internal int OutdoorShowCapacity => sunDeckPlan.AddedShows + (HasAftTerrace ? aftSunDeckPlan.AddedShows : 0);
internal int SunDeckPlanCode => HasAftTerrace ? unchecked(sunDeckPlan.Code * 109 + aftSunDeckPlan.Code) : sunDeckPlan.Code;
internal bool HasValidSunDeckPlan => sunDeckPlan.ValidOptions(HullIndex)
&& (!sunDeckPlan.CustomLayout || new SunDeckGrid(this).Valid(sunDeckPlan));
internal void SetSunDeckPlan(SunDeckPlan plan) => sunDeckPlan = plan;
&& (!HasAftTerrace || SunDeckFor(SunDeckZone.AftTerrace).ValidOptions(HullIndex)) && SunDecksFitAt(Decks.Count);
public SunDeckPlan SunDeckFor(SunDeckZone zone)
{
SunDeckPlan stored = zone == SunDeckZone.AftTerrace ? aftSunDeckPlan : sunDeckPlan;
return stored.CustomLayout || !HasAftTerrace ? stored
: new SunDeckPlan { CustomLayout = true, Pool = SunPoolStyle.Compact, Attraction = SunAttraction.None };
}
internal bool SupportsSunDeck(SunDeckZone zone) => zone == SunDeckZone.Sky || zone == SunDeckZone.AftTerrace && HasAftTerrace;
internal bool SunDecksFitAt(int count) => (!sunDeckPlan.CustomLayout || new SunDeckGrid(this, count).Valid(sunDeckPlan))
&& (!HasAftTerrace || new SunDeckGrid(this, count, SunDeckZone.AftTerrace).Valid(SunDeckFor(SunDeckZone.AftTerrace)));
internal void SetSunDeckPlan(SunDeckPlan plan, SunDeckZone zone)
{
if (zone == SunDeckZone.AftTerrace)
aftSunDeckPlan = plan;
else
sunDeckPlan = plan;
}
}
public sealed partial class Company
{
internal static int SunDeckCost(Ship ship, SunDeckPlan next)
internal static int SunDeckCost(Ship ship, SunDeckPlan next, SunDeckZone zone = SunDeckZone.Sky)
{
SunDeckPlan current = ship.SunDeckPlan;
SunDeckPlan current = ship.SunDeckFor(zone);
if (current.CustomLayout || next.CustomLayout)
{
var grid = new SunDeckGrid(ship);
var grid = new SunDeckGrid(ship, zone: zone);
if (grid.PoolIndex < 0 || next.Pool == grid.SelectedPool)
return 0;
int priorPrice = grid.Existing[grid.PoolIndex].Included ? 0 : SunDeckPlan.PoolPriceFor(grid.SelectedPool);
@@ -126,16 +157,18 @@ namespace BigShipTycoon
return pool + attraction;
}
public string ChangeSunDeck(Ship ship, SunDeckPlan next)
public string ChangeSunDeck(Ship ship, SunDeckPlan next, SunDeckZone zone = SunDeckZone.Sky)
{
if (ship == null || !Fleet.Contains(ship))
return "Choose a ship from your fleet.";
if (!ship.SupportsSunDeck(zone))
return "The split aft terrace requires a MEGA Ocean Liner.";
if (!next.ValidOptions(ship.HullIndex))
return "This fitting requires a larger hull.";
int cost = SunDeckCost(ship, next);
var grid = new SunDeckGrid(ship);
if (ship.SunDeckPlan.CustomLayout || next.CustomLayout)
int cost = SunDeckCost(ship, next, zone);
var grid = new SunDeckGrid(ship, zone: zone);
if (ship.SunDeckFor(zone).CustomLayout || next.CustomLayout)
{
int pool = grid.PoolIndex;
if (next.Pool is SunPoolStyle.None or SunPoolStyle.Automatic)
@@ -150,56 +183,61 @@ namespace BigShipTycoon
return $"The company needs ${cost:N0} available for this refit.";
Cash -= cost;
ship.SetSunDeckPlan(next);
ship.SetSunDeckPlan(next, zone);
return null;
}
internal static int SunDeckPlacementPrice(Ship ship, SunDeckPlacement placement, int replacing = -1)
internal static int SunDeckPlacementPrice(Ship ship, SunDeckPlacement placement, int replacing = -1,
SunDeckZone zone = SunDeckZone.Sky)
{
if (replacing >= 0)
return 0;
return placement.Kind == SunAttraction.Pool ? SunDeckPlan.PoolPriceFor(new SunDeckGrid(ship).SelectedPool)
return placement.Kind == SunAttraction.Pool ? SunDeckPlan.PoolPriceFor(new SunDeckGrid(ship, zone: zone).SelectedPool)
: SunDeckPlan.AttractionPrice(placement.Kind);
}
public string SunDeckPlacementBlock(Ship ship, SunDeckPlacement placement, int replacing = -1)
public string SunDeckPlacementBlock(Ship ship, SunDeckPlacement placement, int replacing = -1, SunDeckZone zone = SunDeckZone.Sky)
{
if (ship == null || !Fleet.Contains(ship))
return "Choose a ship from your fleet.";
var grid = new SunDeckGrid(ship);
if (!ship.SupportsSunDeck(zone))
return "The split aft terrace requires a MEGA Ocean Liner.";
var grid = new SunDeckGrid(ship, zone: zone);
string block = grid.PlacementBlock(placement, grid.SelectedPool, grid.Existing, replacing);
if (block != null)
return block;
return AvailableCash < SunDeckPlacementPrice(ship, placement, replacing) ? "The company needs more cash." : null;
return AvailableCash < SunDeckPlacementPrice(ship, placement, replacing, zone) ? "The company needs more cash." : null;
}
public string PlaceSunDeck(Ship ship, SunDeckPlacement placement, int replacing = -1)
public string PlaceSunDeck(Ship ship, SunDeckPlacement placement, int replacing = -1, SunDeckZone zone = SunDeckZone.Sky)
{
string block = SunDeckPlacementBlock(ship, placement, replacing);
string block = SunDeckPlacementBlock(ship, placement, replacing, zone);
if (block != null)
return block;
var grid = new SunDeckGrid(ship);
SunDeckPlan next = grid.Customize(ship.SunDeckPlan, replacing < 0 ? 1 : 0);
var grid = new SunDeckGrid(ship, zone: zone);
SunDeckPlan next = grid.Customize(ship.SunDeckFor(zone), replacing < 0 ? 1 : 0);
int index = replacing < 0 ? next.Placements.Length - 1 : replacing;
placement.Included = replacing >= 0 && next.Placements[index].Included;
next.Placements[index] = placement;
Cash -= SunDeckPlacementPrice(ship, placement, replacing);
ship.SetSunDeckPlan(next);
Cash -= SunDeckPlacementPrice(ship, placement, replacing, zone);
ship.SetSunDeckPlan(next, zone);
return null;
}
public string RemoveSunDeck(Ship ship, int index)
public string RemoveSunDeck(Ship ship, int index, SunDeckZone zone = SunDeckZone.Sky)
{
if (ship == null || !Fleet.Contains(ship))
return "Choose a ship from your fleet.";
var grid = new SunDeckGrid(ship);
if (!ship.SupportsSunDeck(zone))
return "The split aft terrace requires a MEGA Ocean Liner.";
var grid = new SunDeckGrid(ship, zone: zone);
if ((uint)index >= (uint)grid.Existing.Count)
return "Select a fitted attraction to remove.";
SunDeckPlan next = grid.Customize(ship.SunDeckPlan, omit: index);
SunDeckPlan next = grid.Customize(ship.SunDeckFor(zone), omit: index);
SunDeckPlacement removed = grid.Existing[index];
if (!removed.Included)
Cash += SunDeckPlacementPrice(ship, removed) / 4;
ship.SetSunDeckPlan(next);
Cash += SunDeckPlacementPrice(ship, removed, zone: zone) / 4;
ship.SetSunDeckPlan(next, zone);
return null;
}
}