Make Soundings voyages playable with ship operations and guided tips
This commit is contained in:
@@ -10,7 +10,9 @@ namespace Soundings.Editor
|
||||
VerifyUsedStartAndProfit();
|
||||
VerifyFinancedStartAndConstruction();
|
||||
VerifyFlagshipCampaign();
|
||||
Debug.Log("Soundings economy verification passed: both starts, pricing, fuel, accounting, saves and flagship progression.");
|
||||
VerifyLiveCrossingSettlement();
|
||||
VerifyStormAndShipSystems();
|
||||
Debug.Log("Soundings economy verification passed: both starts, pricing, fuel, accounting, saves, flagship progression, live settlement, weather and ship systems.");
|
||||
}
|
||||
|
||||
private static void VerifyUsedStartAndProfit()
|
||||
@@ -99,6 +101,90 @@ namespace Soundings.Editor
|
||||
Debug.Log($"Global circuit returned to Miami on day {company.Day} with ${company.Cash:N0} cash.");
|
||||
}
|
||||
|
||||
private static void VerifyLiveCrossingSettlement()
|
||||
{
|
||||
Company company = Company.Start(false);
|
||||
Ship ship = company.ActiveShip;
|
||||
Voyage booking = company.Forecast(ship, 1);
|
||||
int startingCash = company.Cash;
|
||||
int startingFuel = ship.Fuel;
|
||||
var live = new OnboardSession(ship, booking);
|
||||
int initialDemand = live.Get(OnboardService.Meals).Requested;
|
||||
int initialPrice = live.GetPrice(OnboardService.Meals);
|
||||
live.ChangePrice(OnboardService.Meals, 10);
|
||||
Require(live.Get(OnboardService.Meals).Requested < initialDemand, "meal requests respond to live prices");
|
||||
Require(live.StartSpecial(OnboardService.Meals) && live.EffectivePrice(OnboardService.Meals) < live.GetPrice(OnboardService.Meals),
|
||||
"specials reduce the effective price immediately");
|
||||
live.AdvanceTo(.30f);
|
||||
Require(live.CurrentEvent.HasValue && live.CanAcceptEvent, "an event opens with a meaningful budget");
|
||||
int eventCost = live.CurrentEvent.Value.Cost;
|
||||
int beforeDecision = live.Happiness;
|
||||
live.ResolveEvent(true);
|
||||
Require(live.Expenses == eventCost && live.Happiness > beforeDecision, "event decision affects the crossing");
|
||||
live.AdvanceTo(.46f);
|
||||
Require(company.Voyages == 0 && ship.Port == 0 && company.Cash == startingCash && ship.Fuel == startingFuel,
|
||||
"onboard simulation does not move the company before arrival");
|
||||
live.AdvanceTo(1);
|
||||
Require(company.Sail(ship, 1, live) == null, "complete live crossing");
|
||||
Voyage arrival = company.History[0];
|
||||
Require(arrival.Guests == booking.Guests && arrival.TicketSales == booking.TicketSales, "departed manifest stays fixed");
|
||||
Require(arrival.Day == booking.Day && ship.Fuel == startingFuel - booking.FuelBurn, "live arrival settles time and fuel");
|
||||
Require(company.Cash == startingCash + arrival.CashChange && company.LifetimeProfit == arrival.NetIncome,
|
||||
"live voyage accounting balances");
|
||||
var reloaded = JsonUtility.FromJson<Company>(JsonUtility.ToJson(company));
|
||||
Require(reloaded.CanLoad() && reloaded.History[0].OnboardSales == arrival.OnboardSales
|
||||
&& reloaded.History[0].Onboard.Happiness == arrival.Onboard.Happiness
|
||||
&& reloaded.ActiveShip.ServicePrices[(int)OnboardService.Meals] == initialPrice + 10,
|
||||
"live earnings, survey and future prices survive a save round-trip");
|
||||
Require(company.Sail(ship, 1, live) != null && company.Voyages == 1, "the live crossing cannot settle twice");
|
||||
}
|
||||
|
||||
private static void VerifyStormAndShipSystems()
|
||||
{
|
||||
Company company = Company.Start(false);
|
||||
Ship ship = company.ActiveShip;
|
||||
Voyage booking = company.Forecast(ship, 1);
|
||||
ship.Fuel = booking.RequiredFuel;
|
||||
var speed = new OnboardSession(ship, booking);
|
||||
Require(!speed.CanSetEngineMode(2), "full power cannot consume the arrival reserve");
|
||||
speed.SetEngineMode(0);
|
||||
Require(speed.SpeedFactor < 1 && speed.ProjectedFuelBurn < booking.FuelBurn, "economy power trades time for fuel");
|
||||
ship.Fuel = ship.Tank;
|
||||
speed.SetEngineMode(2);
|
||||
Require(speed.SpeedFactor > 1 && speed.ProjectedFuelBurn > booking.FuelBurn
|
||||
&& speed.ProjectedFuelBurn + booking.Reserve <= ship.Fuel, "full power uses spare fuel without consuming reserve");
|
||||
|
||||
var calm = new OnboardSession(ship, booking);
|
||||
Voyage stormBooking = company.Forecast(ship, 1);
|
||||
stormBooking.Weather = WeatherCondition.Storm;
|
||||
var storm = new OnboardSession(ship, stormBooking);
|
||||
Require(calm.Get(OnboardService.Amenities).Capacity > 0
|
||||
&& storm.Get(OnboardService.Amenities).Capacity == 0
|
||||
&& storm.Get(OnboardService.Amenities).Served == 0, "storm closes outdoor amenities");
|
||||
Require(storm.Get(OnboardService.Drinks).Requested > calm.Get(OnboardService.Drinks).Requested,
|
||||
"storm sends more guests to indoor venues");
|
||||
storm.AdvanceTo(.30f);
|
||||
Require(storm.CurrentEvent.HasValue && storm.CurrentEvent.Value.Title == "Outdoor decks closed", "storm presents a weather-specific decision");
|
||||
|
||||
// Keep the same manifest on a longer crossing to stress the ship's service and utility capacity.
|
||||
booking.Days = 7;
|
||||
var baseline = new OnboardSession(ship, booking) { Assisted = false };
|
||||
baseline.AdvanceTo(1);
|
||||
OnboardReport baselineReport = baseline.Report();
|
||||
Require(company.Build(ship, 0, 8, Facility.Galley) == null
|
||||
&& company.Build(ship, 0, 9, Facility.Stores) == null
|
||||
&& company.Build(ship, 0, 10, Facility.Water) == null
|
||||
&& company.Build(ship, 0, 11, Facility.Waste) == null
|
||||
&& company.Build(ship, 1, 0, Facility.Stores) == null, "service and utility modules fit spare berths");
|
||||
var upgraded = new OnboardSession(ship, booking) { Assisted = false };
|
||||
upgraded.AdvanceTo(1);
|
||||
Require(baselineReport.Provisions == 0 && upgraded.ProvisionsRemaining > 0
|
||||
&& upgraded.WaterPercent > baselineReport.WaterPercent
|
||||
&& upgraded.SewagePercent < baselineReport.SewagePercent
|
||||
&& upgraded.Health > baselineReport.Health
|
||||
&& upgraded.Happiness > baselineReport.Happiness, "upgraded resources sustain guest health and happiness on a long crossing");
|
||||
}
|
||||
|
||||
private static void Complete(Company company, Ship ship, int destination)
|
||||
{
|
||||
Voyage quote = company.Forecast(ship, destination);
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace Soundings.Editor
|
||||
EditorBuildSettings.scenes = new[] { new EditorBuildSettingsScene(ScenePath, true) };
|
||||
PlayerSettings.companyName = "Soundings";
|
||||
PlayerSettings.productName = "Soundings";
|
||||
PlayerSettings.bundleVersion = "0.2.0";
|
||||
PlayerSettings.defaultScreenWidth = 1600;
|
||||
PlayerSettings.defaultScreenHeight = 900;
|
||||
PlayerSettings.fullScreenMode = FullScreenMode.Windowed;
|
||||
PlayerSettings.bundleVersion = "0.3.0";
|
||||
PlayerSettings.defaultScreenWidth = 1920;
|
||||
PlayerSettings.defaultScreenHeight = 1080;
|
||||
PlayerSettings.fullScreenMode = FullScreenMode.FullScreenWindow;
|
||||
PlayerSettings.resizableWindow = true;
|
||||
PlayerSettings.runInBackground = true;
|
||||
PlayerSettings.SetApplicationIdentifier(NamedBuildTarget.Standalone, "game.soundings.simulator");
|
||||
|
||||
Reference in New Issue
Block a user