Add riverboat captain career and distinct ship classes

Add class-specific vessel geometry and sea motion, a guided helm qualification path, dockside sailing orders, and local excursions at all 24 ports.
This commit is contained in:
josh
2026-11-29 20:41:00 -05:00
parent 46624bf5ba
commit 290e4cb45d
67 changed files with 1783 additions and 301 deletions

View File

@@ -88,7 +88,7 @@ namespace BigShipTycoon
if (!legacy && owners[anchor] != 0)
return false;
FacilitySpec spec = Market.Facilities[(int)facility];
if (hull < spec.MinimumHull || (spec.BayCount == 1 && rotation != 0))
if (!Market.MeetsHullRequirement(hull, spec.MinimumHull) || (spec.BayCount == 1 && rotation != 0))
return false;
foreach (Vector2Int offset in spec.Footprint(rotation))
{
@@ -132,17 +132,17 @@ namespace BigShipTycoon
public int CasinoCapacity => FacilityCapacity(Facility.CasinoLounge) + FacilityCapacity(Facility.Casino)
+ FacilityCapacity(Facility.GrandCasino) + FacilityCapacity(Facility.RoyalCasino);
public int Capacity => Math.Min(Beds, Meals);
public int GalleyCapacity => (HullIndex == Market.Mega ? 540 : 168 + HullIndex * 72)
public int GalleyCapacity => (HullIndex == Market.River ? 56 : HullIndex == Market.Mega ? 540 : 168 + HullIndex * 72)
+ FacilityCapacity(Facility.Galley) + FacilityCapacity(Facility.ProductionGalley);
public int FoodCapacity => (HullIndex == Market.Mega ? 5600 : 1500 + HullIndex * 640)
public int FoodCapacity => (HullIndex == Market.River ? 220 : HullIndex == Market.Mega ? 5600 : 1500 + HullIndex * 640)
+ FacilityCapacity(Facility.Stores) + FacilityCapacity(Facility.ColdChain);
public int WaterCapacity => (HullIndex == Market.Mega ? 62000 : 16000 + HullIndex * 7600)
public int WaterCapacity => (HullIndex == Market.River ? 4400 : HullIndex == Market.Mega ? 62000 : 16000 + HullIndex * 7600)
+ FacilityCapacity(Facility.Water) + FacilityCapacity(Facility.MembranePlant);
public int WaterProduction => (HullIndex == Market.Mega ? 28000 : 9000 + HullIndex * 3900)
public int WaterProduction => (HullIndex == Market.River ? 2600 : HullIndex == Market.Mega ? 28000 : 9000 + HullIndex * 3900)
+ Count(Facility.Water) * 6000 + Count(Facility.MembranePlant) * 36000;
public int WasteCapacity => (HullIndex == Market.Mega ? 52000 : 12000 + HullIndex * 6800)
public int WasteCapacity => (HullIndex == Market.River ? 3600 : HullIndex == Market.Mega ? 52000 : 12000 + HullIndex * 6800)
+ FacilityCapacity(Facility.Waste) + FacilityCapacity(Facility.ReclamationPlant);
public int WasteTreatment => (HullIndex == Market.Mega ? 26000 : 5500 + HullIndex * 3400)
public int WasteTreatment => (HullIndex == Market.River ? 1950 : HullIndex == Market.Mega ? 26000 : 5500 + HullIndex * 3400)
+ Count(Facility.Waste) * 7000 + Count(Facility.ReclamationPlant) * 40000;
internal int FittedRepairCapacity => FacilityCapacity(Facility.Workshop) + FacilityCapacity(Facility.EngineeringCenter);
internal int FittedLaundryCapacity => FacilityCapacity(Facility.LaundryPlant);
@@ -186,7 +186,8 @@ namespace BigShipTycoon
+ (Onboard?.Expenses ?? 0);
public int NetIncome => TicketSales + OnboardSales - OperatingCash - FuelExpense - LoanInterest + (ShoreReport?.NetIncome ?? 0);
public int CashChange => TicketSales + OnboardSales - OperatingCash - LoanInterest - Principal + (ShoreReport?.NetIncome ?? 0);
public int RequiredFuel => FuelBurn + Reserve;
public int DepartureFuelBurn => Plan == null || Onboard != null ? FuelBurn : PortPlanning.PlannedFuel(FuelBurn, Plan.Order);
public int RequiredFuel => DepartureFuelBurn + Reserve;
internal Voyage CopyForPassage(bool hasDeparturePlan)
{
@@ -198,7 +199,8 @@ namespace BigShipTycoon
copy.ShoreReport = null;
copy.Plan = hasDeparturePlan && Plan != null ? new DeparturePlan
{
FoodUnits = Plan.FoodUnits, FoodCost = Plan.FoodCost, Program = Plan.Program, ProgramCost = Plan.ProgramCost
FoodUnits = Plan.FoodUnits, FoodCost = Plan.FoodCost, Program = Plan.Program, ProgramCost = Plan.ProgramCost,
Order = Plan.Order
} : null;
return copy;
}
@@ -240,10 +242,12 @@ namespace BigShipTycoon
public bool CanLoad()
{
if (Permits?.Length == Market.Brickell && !IsCaptainCareer)
Array.Resize(ref Permits, Market.Ports.Count);
if (Version != SaveVersion || Day < 1 || Cash < 0 || Debt < 0 || Reputation < 0 || Reputation > 100
|| Voyages < 0 || Permits == null || Permits.Length != Market.Ports.Count || !Permits[0] || !Permits[1]
|| Fleet == null || Fleet.Count > Market.MaxFleet || History == null || History.Count > MaxHistory
|| (Fleet.Count == 0 ? SelectedShip != -1 : SelectedShip < 0 || SelectedShip >= Fleet.Count))
|| (Fleet.Count == 0 ? SelectedShip != -1 : SelectedShip < 0 || SelectedShip >= Fleet.Count) || !ValidCaptainCareer())
return false;
var callIds = new HashSet<int>();
@@ -251,8 +255,10 @@ namespace BigShipTycoon
{
if (ship == null || string.IsNullOrWhiteSpace(ship.Name) || ship.HullIndex < 0 || ship.HullIndex >= Market.Hulls.Count
|| ship.Port < 0 || ship.Port >= Permits.Length || !Permits[ship.Port] || ship.Condition < 24
|| ship.HullIndex == Market.River && !IsCaptainCareer || !Market.CanVisit(ship.HullIndex, ship.Port)
|| ship.Condition > 100 || ship.Fare < Market.MinFare || ship.Fare > Market.MaxFare
|| ship.Decks == null || ship.Decks.Count < Market.Hulls[0].StarterDecks || ship.Decks.Count > ship.Hull.MaxDecks
|| ship.Decks == null || ship.Decks.Count < (ship.HullIndex == Market.River ? 1 : Market.Hulls[0].StarterDecks)
|| ship.Decks.Count > ship.Hull.MaxDecks
|| ship.Fuel < 0 || double.IsNaN(ship.FuelValue) || double.IsInfinity(ship.FuelValue) || ship.FuelValue < 0)
return false;
@@ -293,7 +299,7 @@ namespace BigShipTycoon
{
if ((uint)hullIndex >= (uint)Market.Hulls.Count)
return "Choose a hull at the shipyard.";
if (used && hullIndex >= Market.Ocean)
if (used && Market.HullRank(hullIndex) >= Market.HullRank(Market.Ocean))
return $"{Market.Hulls[hullIndex].Name} hulls are available as new commissions.";
if (Fleet.Count >= Market.MaxFleet)
return "The fleet has reached its eight-ship limit.";
@@ -307,6 +313,9 @@ namespace BigShipTycoon
internal string ShipyardUnlock(int hullIndex)
{
string command = CommandBlock(hullIndex);
if (command != null)
return command;
HullSpec hull = Market.Hulls[hullIndex];
if (hullIndex == Market.Mega && !Flagship)
return "Complete the Ocean Class flagship charter from Bermuda to Lisbon.";
@@ -348,13 +357,20 @@ namespace BigShipTycoon
Name = name,
HullIndex = hullIndex,
Condition = original ? 78 : used ? 72 : 100,
Fare = hullIndex switch { Market.Coastal => 550, Market.Regional => 850, Market.Mega => 1450, _ => 1250 },
Fuel = original ? 48 : used ? 25 : 0
Fare = hullIndex switch { Market.River => 340, Market.Coastal => 550, Market.Regional => 850, Market.Mega => 1450, _ => 1250 },
Fuel = hullIndex == Market.River ? used ? 13 : 0 : original ? 48 : used ? 25 : 0
};
ship.FuelValue = ship.Fuel * Market.FuelPrice(0, 1);
for (int i = 0; i < ship.Hull.StarterDecks; i++)
ship.AddEmptyDeck();
if (used)
if (used && hullIndex == Market.River)
{
ship.Decks[0].Cells[0] = Facility.Cabin;
ship.Decks[0].Cells[1] = Facility.Dining;
ship.Decks[0].Cells[3] = Facility.Bar;
ship.Decks[0].Cells[4] = Facility.Entertainment;
}
else if (used)
{
for (int i = 0; i < 8; i++)
ship.Decks[0].Cells[i] = Facility.Cabin;
@@ -367,7 +383,7 @@ namespace BigShipTycoon
return ship;
}
public int DeckPrice(Ship ship) => 29000 + ship.Decks.Count * 8500 + ship.HullIndex * 13000;
public int DeckPrice(Ship ship) => ship.HullIndex == Market.River ? 13500 : 29000 + ship.Decks.Count * 8500 + ship.HullIndex * 13000;
public string AddDeck(Ship ship)
{
@@ -402,7 +418,7 @@ namespace BigShipTycoon
bool turning = previous == plan;
if (turning && rotation == deck.RotationAt(anchor))
return null;
if (ship.HullIndex < spec.MinimumHull)
if (!Market.MeetsHullRequirement(ship.HullIndex, spec.MinimumHull))
return $"Requires a {Market.Hulls[spec.MinimumHull].Name} hull or larger.";
if (!turning && previous != Facility.Empty)
return "Clear this berth before building another facility.";
@@ -515,12 +531,16 @@ namespace BigShipTycoon
{
if (!Market.TryDistance(ship.Port, destination, out int miles))
return null;
bool river = ship.HullIndex == Market.River;
if ((river || Market.IsRiverPort(ship.Port) || Market.IsRiverPort(destination))
&& (!Market.CanVisit(ship.HullIndex, ship.Port) || !Market.CanVisit(ship.HullIndex, destination)))
return null;
PortSpec from = Market.Ports[ship.Port];
PortSpec to = Market.Ports[destination];
int days = 1 + (int)Math.Ceiling(miles / 415.0);
int days = river ? 1 : 1 + (int)Math.Ceiling(miles / 415.0);
var (fuel, reserve) = LegFuel(ship, miles);
double referenceFare = 330 + days * 88 + to.Appeal * 125;
double referenceFare = river ? 235 + to.Appeal * 110 : 330 + days * 88 + to.Appeal * 125;
double fareFactor = Math.Pow(referenceFare / ship.Fare, 1.55);
double season = 1 + .13 * Math.Cos((Day + destination * 13) * 2 * Math.PI / 112);
int recentSailings = 0;
@@ -534,7 +554,12 @@ namespace BigShipTycoon
double saturation = Math.Max(.66, 1 - recentSailings * .085);
double entertainment = Math.Min(1, (double)ship.Entertainment / Math.Max(1, ship.Capacity));
double classDemand = ship.HullIndex == Market.Mega ? 230 + ship.Capacity * .68 : 150 + ship.Capacity * .50;
double classDemand = ship.HullIndex switch
{
Market.River => 38 + ship.Capacity * .62,
Market.Mega => 230 + ship.Capacity * .68,
_ => 150 + ship.Capacity * .50
};
double marketDemand = classDemand * from.MarketSize * to.Appeal * season * saturation;
double product = (.66 + Reputation * .006 + entertainment * .20) * (.8 + ship.Condition * .002);
int roomDemand = Math.Max(0, (int)Math.Round(marketDemand * fareFactor * product));
@@ -572,7 +597,7 @@ namespace BigShipTycoon
CrewAssigned = crew,
Crew = CrewMarket.Payroll(crew) * days,
Catering = guests * days * 27,
PortFees = from.Fee / 2 + to.Fee,
PortFees = PortCallFee(ship, ship.Port) / 2 + PortCallFee(ship, destination),
FuelExpense = (int)Math.Round(Math.Min(fuel, ship.Fuel) * unitCost
+ Math.Max(0, fuel - ship.Fuel) * Market.FuelPrice(ship.Port, Day)),
LoanInterest = (int)Math.Ceiling(Debt * .13 * days / 365),
@@ -591,8 +616,8 @@ namespace BigShipTycoon
return $"This itinerary's next stop is {Market.Ports[itinerary.NextPort].Name}.";
if (!Permits[quote.Destination])
return "Obtain a destination permit in Ports.";
if (ship.HullIndex < Market.Ports[quote.Destination].MinimumHull)
return "This destination requires a larger hull class.";
if (!Market.CanVisit(ship.HullIndex, ship.Port) || !Market.CanVisit(ship.HullIndex, quote.Destination))
return ship.HullIndex == Market.River ? "This riverboat is certified for local river routes." : "This destination requires a different hull class.";
if (ship.Beds == 0 || ship.Meals == 0)
return "Build cabins and dining before carrying guests.";
if (ship.Condition < 25)
@@ -606,6 +631,10 @@ namespace BigShipTycoon
if (assigned < CrewMarket.Minimum(ship, role))
return $"Assign the required {department.Name.ToLowerInvariant()} in the crew office.";
}
if (quote.Plan?.Order == PassageOrder.Express && (quote.CrewAssigned is { Length: > 0 }
? quote.CrewAssigned[(int)CrewRole.Engineering] : ship.CrewCount(CrewRole.Engineering))
< CrewMarket.Recommended(ship, CrewRole.Engineering) * .85)
return "Express requires 85% of the recommended engineering crew.";
if (quote.RequiredFuel > ship.Tank)
return $"This route needs {quote.RequiredFuel} t. Add a bunker tank or use a larger hull.";
if (ship.Fuel < quote.RequiredFuel)
@@ -653,6 +682,8 @@ namespace BigShipTycoon
Debt -= quote.Principal;
Reputation = Market.Clamp(Reputation + quote.ReputationChange, 0, 100);
Voyages++;
if (IsCaptainCareer)
commandVoyages[ship.HullIndex]++;
LifetimeProfit += quote.NetIncome;
Flagship |= ship.HullIndex == Market.Ocean && ship.Capacity >= 320 && ship.Entertainment >= 160
&& quote.Origin == Market.Bermuda && quote.Destination == Market.Lisbon;