Rebrand as Big Ship Tycoon and add crew operations

This commit is contained in:
josh
2026-11-28 17:49:48 -05:00
parent a54f66cec9
commit 2c85a5ba00
68 changed files with 1642 additions and 98 deletions

View File

@@ -163,6 +163,7 @@ namespace Soundings
public int SuiteGuests, SuitePremium;
public string ShipName;
public int ItineraryStartDay, ItineraryLeg, ItineraryLegs;
public int[] CrewAssigned;
public OnboardReport Onboard;
public DeparturePlan Plan;
public ShoreOffer[] ShoreOffers;
@@ -179,6 +180,7 @@ namespace Soundings
{
var copy = (Voyage)MemberwiseClone();
copy.Onboard = null;
copy.CrewAssigned = CrewAssigned is { Length: > 0 } ? (int[])CrewAssigned.Clone() : null;
copy.ShoreOffers = ShorePortPlan.Copy(ShoreOffers);
copy.ShoreCallId = 0;
copy.ShoreReport = null;
@@ -249,7 +251,7 @@ namespace Soundings
return false;
}
if (ship.Fuel > ship.Tank || !ValidSavedItinerary(ship) || !ship.ValidShorePlans()
if (ship.Fuel > ship.Tank || !ValidSavedItinerary(ship) || !ship.ValidShorePlans() || !ship.ValidCrew()
|| ship.ShoreCall is ShoreCall call && (call.CallId < 1 || call.CallId > Voyages
|| !callIds.Add(call.CallId) || !call.CanLoad(ship.Port)))
return false;
@@ -259,6 +261,7 @@ namespace Soundings
foreach (Voyage voyage in History)
if (voyage == null || voyage.Origin < 0 || voyage.Origin >= Permits.Length
|| voyage.Destination < 0 || voyage.Destination >= Permits.Length
|| !CrewMarket.ValidPayroll(voyage)
|| voyage.ShoreCallId < 0 || voyage.ShoreCallId > Voyages
|| voyage.ShoreCallId > 0 && !recordedCalls.Add(voyage.ShoreCallId)
|| voyage.ShoreReport is ShoreReport report && (callIds.Contains(voyage.ShoreCallId)
@@ -516,6 +519,7 @@ namespace Soundings
(suiteGuests - grandSuiteGuests) * Market.Facilities[(int)Facility.Suite].FarePremiumPercent
+ grandSuiteGuests * Market.Facilities[(int)Facility.GrandSuite].FarePremiumPercent));
double unitCost = ship.Fuel > 0 ? ship.FuelValue / ship.Fuel : Market.FuelPrice(ship.Port, Day);
int[] crew = ship.CaptureCrew();
return new Voyage
{
@@ -536,7 +540,8 @@ namespace Soundings
SuitePremium = suitePremium,
TicketSales = guests * ship.Fare + suitePremium,
OnboardSales = (int)Math.Round(guests * days * (13 + entertainment * 18)),
Crew = ship.Hull.CrewPerDay * days + ship.Decks.Count * 500 * days,
CrewAssigned = crew,
Crew = CrewMarket.Payroll(crew) * days,
Catering = guests * days * 27,
PortFees = from.Fee / 2 + to.Fee,
FuelExpense = (int)Math.Round(Math.Min(fuel, ship.Fuel) * unitCost
@@ -563,6 +568,15 @@ namespace Soundings
return "Build cabins and dining before carrying guests.";
if (ship.Condition < 25)
return "An overhaul is required before the ship can sail.";
if (!CrewMarket.ValidPayroll(quote))
return "Refresh the voyage quote after changing the crew.";
foreach (CrewRoleSpec department in CrewMarket.Roles)
{
CrewRole role = department.Role;
int assigned = quote.CrewAssigned is { Length: > 0 } ? quote.CrewAssigned[(int)role] : ship.CrewCount(role);
if (assigned < CrewMarket.Minimum(ship, role))
return $"Assign the required {department.Name.ToLowerInvariant()} in the crew office.";
}
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)