Add port-specific shore excursions and deck stack
This commit is contained in:
@@ -18,7 +18,102 @@ namespace Soundings.Editor
|
||||
VerifyStormAndShipSystems();
|
||||
VerifyPortOrders();
|
||||
VerifyMultiStopItinerary();
|
||||
Debug.Log("Soundings economy verification passed for both starts, pricing, fuel, enlarged venues, fleet settlements, saves, weather, ship systems, port orders and multi-stop itineraries.");
|
||||
VerifyShoreExcursions();
|
||||
Debug.Log("Soundings economy verification passed for both starts, pricing, fuel, enlarged venues, fleet settlements, saves, weather, ship systems, port orders, multi-stop itineraries and shore excursions.");
|
||||
}
|
||||
|
||||
private static void VerifyShoreExcursions()
|
||||
{
|
||||
var names = new System.Collections.Generic.HashSet<string>();
|
||||
for (int i = 0; i < Market.Ports.Count; i++)
|
||||
{
|
||||
var tours = ShoreExcursions.Catalog(i);
|
||||
Require(tours.Count == 2, "two distinct local shore tours at " + Market.Ports[i].Name);
|
||||
foreach (ShoreTour tour in tours)
|
||||
Require(names.Add(tour.Name) && tour.MinPrice < tour.StandardPrice && tour.StandardPrice < tour.MaxPrice,
|
||||
"unique and priced shore tour " + tour.Name);
|
||||
}
|
||||
|
||||
Company company = Company.Start(false);
|
||||
Voyage quote = company.Forecast(company.ActiveShip, 1);
|
||||
var catalog = ShoreExcursions.Catalog(1);
|
||||
var offer = new ShoreOffer { Tour = 1, Price = catalog[1].StandardPrice, Capacity = catalog[1].MaxCapacity };
|
||||
ShoreOffer[] offers = { offer };
|
||||
Require(ShoreExcursions.Create(quote, null) == null, "shore excursions are optional");
|
||||
Require(!ShoreExcursions.ValidOffers(1, new[] { offer, offer }), "shore plans reject duplicate tours");
|
||||
ShoreBooking calm = ShoreExcursions.Forecast(quote, offers)[0];
|
||||
quote.Weather = WeatherCondition.Storm;
|
||||
ShoreBooking storm = ShoreExcursions.Forecast(quote, offers)[0];
|
||||
Require(storm.Demand < calm.Demand && storm.DelayRisk > calm.DelayRisk, "rough weather shifts shore demand and return risk");
|
||||
offer.Price = catalog[1].MaxPrice;
|
||||
Require(ShoreExcursions.Forecast(quote, offers)[0].Demand < storm.Demand, "higher shore prices reduce projected demand");
|
||||
offer.Price = catalog[1].MinPrice;
|
||||
offer.Capacity = 4;
|
||||
ShoreBooking limited = ShoreExcursions.Forecast(quote, offers)[0];
|
||||
Require(limited.Demand > limited.Guests && limited.Guests == 4 && limited.Revenue > limited.OperatorCost,
|
||||
"excursion seats limit sales and the price floor covers contracted operators");
|
||||
|
||||
offer.Capacity = catalog[1].MaxCapacity;
|
||||
var indoor = new ShoreOffer { Tour = 0, Price = catalog[0].MinPrice, Capacity = catalog[0].MaxCapacity };
|
||||
quote.Weather = WeatherCondition.Calm;
|
||||
int actualGuests = quote.Guests;
|
||||
quote.Guests = 75;
|
||||
ShoreBooking[] shared = ShoreExcursions.Forecast(quote, new[] { offer, indoor });
|
||||
Require(shared[0].Guests > 0 && shared[1].Guests > 0 && shared[0].Guests + shared[1].Guests <= quote.Guests,
|
||||
"multiple shore tours share a finite passenger pool");
|
||||
quote.Guests = actualGuests;
|
||||
|
||||
ShoreCall delayed = null, onTime = null;
|
||||
for (int tries = 0; tries < 150 && (delayed == null || onTime == null); tries++, quote.Day++)
|
||||
{
|
||||
ShoreCall call = ShoreExcursions.Create(quote, offers);
|
||||
if (call.LateGuests > 0)
|
||||
delayed = call;
|
||||
else
|
||||
onTime = call;
|
||||
}
|
||||
Require(delayed != null && onTime != null, "scheduled shore tours can arrive on time or run late");
|
||||
onTime.CallId = 1;
|
||||
Require(onTime.Advance(60) && onTime.Report().CanLoad(1, 1) && onTime.Report().Resolution == ShoreLateResolution.None,
|
||||
"an on-time tour settles without a departure decision");
|
||||
|
||||
delayed.CallId = 2;
|
||||
float fullDwell = delayed.RemainingSeconds;
|
||||
Require(!delayed.Advance(4) && delayed.RemainingSeconds < fullDwell, "tour group departure runs on the gameplay clock");
|
||||
delayed = JsonUtility.FromJson<ShoreCall>(JsonUtility.ToJson(delayed));
|
||||
Require(delayed.CanLoad(1) && delayed.Phase == ShorePhase.Touring && delayed.RemainingSeconds == fullDwell - 4,
|
||||
"shore groups and docking timer survive a save");
|
||||
Require(delayed.Advance(60) && delayed.Phase == ShorePhase.AwaitingDecision && delayed.LateGuests > 0
|
||||
&& !delayed.Advance(60) && delayed.Report() == null, "the departure decision waits for the player");
|
||||
var alternate = JsonUtility.FromJson<ShoreCall>(JsonUtility.ToJson(delayed));
|
||||
Require(delayed.ResolveLate(true) && delayed.CanLoad(1) && delayed.Phase == ShorePhase.Holding
|
||||
&& !delayed.ResolveLate(true), "holding persists and cannot be charged twice");
|
||||
Require(delayed.Advance(60) && delayed.Report().CanLoad(1, 2)
|
||||
&& delayed.Report().Resolution == ShoreLateResolution.Held && delayed.Report().NetIncome >= 0, "settle after holding the ship");
|
||||
Require(alternate.ResolveLate(false) && alternate.Report().CanLoad(1, 2)
|
||||
&& alternate.Report().Resolution == ShoreLateResolution.AlternateTransport && alternate.Report().NetIncome >= 0
|
||||
&& alternate.GuestImpact < delayed.GuestImpact && alternate.ReputationImpact < delayed.ReputationImpact,
|
||||
"alternate transport releases the berth immediately with worse guest feedback");
|
||||
|
||||
Ship ship = company.ActiveShip;
|
||||
quote = company.Forecast(ship, 1);
|
||||
quote.ShoreOffers = offers;
|
||||
Require(company.Sail(ship, 1, new OnboardSession(ship, quote)) == null && ship.ShoreCall?.CallId == 1
|
||||
&& company.History[0].ShoreCallId == ship.ShoreCall.CallId && company.History[0].ShoreReport == null,
|
||||
"an arrival books the excursion without settling it before guests return");
|
||||
Company resumed = JsonUtility.FromJson<Company>(JsonUtility.ToJson(company));
|
||||
Require(resumed.CanLoad() && resumed.ActiveShip.ShoreCall?.CallId == 1 && resumed.ActiveShip.ShoreCall.Phase == ShorePhase.Touring
|
||||
&& resumed.ActiveShip.ShoreCall.RemainingSeconds == ship.ShoreCall.RemainingSeconds && resumed.History[0].ShoreReport == null,
|
||||
"the career save restores an active shore call and its pending ledger entry");
|
||||
ShoreCall resumedCall = resumed.ActiveShip.ShoreCall;
|
||||
resumedCall.Advance(60);
|
||||
if (resumedCall.Phase == ShorePhase.AwaitingDecision)
|
||||
resumedCall.ResolveLate(false);
|
||||
resumed.ActiveShip.ShoreCall = null;
|
||||
resumed.History[0].ShoreReport = resumedCall.Report();
|
||||
resumed = JsonUtility.FromJson<Company>(JsonUtility.ToJson(resumed));
|
||||
Require(resumed.CanLoad() && resumed.ActiveShip.ShoreCall == null && resumed.History[0].ShoreReport?.CanLoad(1, 1) == true,
|
||||
"the career save restores the shore report after berth release");
|
||||
}
|
||||
|
||||
private static void VerifyUsedStartAndProfit()
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Soundings.Editor
|
||||
EditorBuildSettings.scenes = new[] { new EditorBuildSettingsScene(ScenePath, true) };
|
||||
PlayerSettings.companyName = "Soundings";
|
||||
PlayerSettings.productName = "Soundings";
|
||||
PlayerSettings.bundleVersion = "0.9.0";
|
||||
PlayerSettings.bundleVersion = "0.10.0";
|
||||
PlayerSettings.defaultScreenWidth = 1920;
|
||||
PlayerSettings.defaultScreenHeight = 1080;
|
||||
PlayerSettings.fullScreenMode = FullScreenMode.FullScreenWindow;
|
||||
|
||||
Reference in New Issue
Block a user