Add port-specific shore excursions and deck stack

This commit is contained in:
josh
2026-11-28 17:19:25 -05:00
parent c570a64840
commit a54f66cec9
28 changed files with 1270 additions and 31 deletions

View File

@@ -158,6 +158,9 @@ namespace Soundings
if (!SubmitSmoke("passage-deck-1") || !CheckSmoke(passageDeck == 1, "Inspect the second guest deck"))
yield break;
yield return CaptureSmoke(directory, "06-guest-deck");
if (!CheckSmoke(root.Q<Button>("passage-deck-1")?.worldBound.yMin < root.Q<Button>("passage-deck-0")?.worldBound.yMin,
"The deck stack puts the upper deck above Deck 1"))
yield break;
if (!CheckSmoke(harbor.HasActiveGuest(GuestActivity.Drink) && harbor.HasActiveGuest(GuestActivity.TendBar)
&& harbor.HasActiveGuest(GuestActivity.Dine) && harbor.HasActiveGuest(GuestActivity.Watch),
"The fitted bar, dining room, and entertainment venue are active"))
@@ -573,6 +576,114 @@ namespace Soundings
&& fleetOpen && root.Q("fleet-overview") != null && !harbor.PortCinematicActive,
"Same-day arrivals settle without interrupting the fleet overview"))
yield break;
const int tourPort = 2;
const int tourIndex = 1;
var tour = ShoreExcursions.Catalog(tourPort)[tourIndex];
if (!SubmitSmoke("fleet-close") || !SubmitSmoke("nav-3") || !SubmitSmoke($"port-{tourPort}")
|| (!company.Permits[tourPort] && !SubmitSmoke("permit"))
|| !CheckSmoke(company.Refuel(Ship, 80) == null && Ship.Port == 1,
"Prepare the flagship's Nassau to Key West shore call")
|| !SubmitSmoke("weather-calm") || !SubmitSmoke("shore-planning-open"))
yield break;
IntegerField tourPrice = root.Q<IntegerField>($"shore-price-{tourIndex}");
IntegerField tourCapacity = root.Q<IntegerField>($"shore-capacity-{tourIndex}");
if (!CheckSmoke(tourPrice != null && tourCapacity != null && tourCapacity.value == 0
&& root.Q<Label>(className: "shore-tour-name")?.text == ShoreExcursions.Catalog(tourPort)[0].Name
&& ShoreExcursions.Catalog(tourPort)[0].Name != ShoreExcursions.Catalog(1)[0].Name,
"Chart opens port-specific optional shore offers"))
yield break;
int shorePrice = tour.MinPrice + 1;
int shoreCapacity = Math.Min(tour.MaxCapacity, 24);
tourPrice.value = shorePrice;
tourCapacity.value = shoreCapacity;
yield return CaptureSmoke(directory, "20-shore-excursion-planner");
if (!SubmitSmoke("shore-plan-save") || !SubmitSmoke("dispatch") || !SubmitSmoke("port-cinematic-skip")
|| !CheckSmoke(underway?.ShoreOffers is { Length: 1 } && underway.ShoreOffers[0].Price == shorePrice
&& underway.ShoreOffers[0].Capacity == shoreCapacity, "Configured prices and capacity carry into the voyage")
|| !SubmitSmoke("shore-planning-open"))
yield break;
tourPrice = root.Q<IntegerField>($"shore-price-{tourIndex}");
tourCapacity = root.Q<IntegerField>($"shore-capacity-{tourIndex}");
if (!CheckSmoke(tourPrice?.value == shorePrice && tourCapacity?.value == shoreCapacity,
"Underway planning shows the current offer before docking"))
yield break;
tourPrice.value = --shorePrice;
tourCapacity.value = --shoreCapacity;
if (!SubmitSmoke("shore-plan-save")
|| !CheckSmoke(underway.ShoreOffers[0].Price == shorePrice && underway.ShoreOffers[0].Capacity == shoreCapacity,
"Adjust ticket price and capacity during the crossing"))
yield break;
Voyage crossingWithShorePlan = underway;
if (!SubmitSmoke("company-menu") || !SubmitSmoke("career-save")
|| !SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0")
|| !CheckSmoke(underway != null && underway != crossingWithShorePlan
&& underway.ShoreOffers is { Length: 1 } && underway.ShoreOffers[0].Price == shorePrice
&& underway.ShoreOffers[0].Capacity == shoreCapacity,
"A mid-voyage save resumes the updated excursion plan"))
yield break;
int originalArrivalDay = underway.Day;
while (!(ShoreExcursions.Create(underway, underway.ShoreOffers)?.LateGuests > 0)
&& underway.Day < originalArrivalDay + 180)
underway.Day++;
if (!CheckSmoke(ShoreExcursions.Create(underway, underway.ShoreOffers)?.LateGuests > 0,
"Find a deterministic late return for the smoke scenario")
|| !SubmitSmoke("dock-now") || !SubmitSmoke("port-cinematic-skip")
|| !CheckSmoke(Ship.Port == tourPort && Ship.ShoreCall?.Phase == ShorePhase.Touring
&& root.Q("shore-operations") != null, "Docking begins the selected port's shore visit"))
yield break;
if (!SubmitSmoke("nav-3") || !SubmitSmoke("port-0")
|| !CheckSmoke(root.Q<Button>("dispatch")?.enabledInHierarchy == false,
"Next departure is blocked while excursion guests are ashore")
|| !SubmitSmoke("nav-0") || !SubmitSmoke("company-menu") || !SubmitSmoke("career-save"))
yield break;
int shoreCash = company.Cash;
int shoreVoyages = company.Voyages;
int lateGuests = Ship.ShoreCall.LateGuests;
float shoreTime = Ship.ShoreCall.RemainingSeconds;
Company beforeShoreLoad = company;
if (!SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0")
|| !CheckSmoke(company != beforeShoreLoad && Ship.ShoreCall?.Phase == ShorePhase.Touring
&& Ship.ShoreCall.LateGuests == lateGuests && Mathf.Abs(Ship.ShoreCall.RemainingSeconds - shoreTime) < .01f,
"Loading restores the shore clock and the same delayed group"))
yield break;
AdvanceShoreCalls(120);
if (!CheckSmoke(Ship.ShoreCall?.Phase == ShorePhase.AwaitingDecision,
"Late returning guests require a decision before departure"))
yield break;
yield return CaptureSmoke(directory, "21-shore-departure-decision");
if (!SubmitSmoke("shore-departure-hold")
|| !CheckSmoke(Ship.ShoreCall?.Phase == ShorePhase.Holding && Ship.Port == tourPort,
"Hold departure gives the late group time to return"))
yield break;
AdvanceShoreCalls(120);
ShoreReport heldReport = company.History[0].ShoreReport;
if (!CheckSmoke(Ship.ShoreCall == null && company.Voyages == shoreVoyages
&& heldReport?.Resolution == ShoreLateResolution.Held && heldReport.LateGuests == lateGuests
&& company.Cash == shoreCash + heldReport.NetIncome,
"The completed shore call settles once in the voyage's logbook"))
yield break;
if (!SubmitSmoke("nav-4"))
yield break;
yield return CaptureSmoke(directory, "22-shore-excursion-settlement");
if (!SubmitSmoke("company-menu") || !SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0"))
yield break;
AdvanceShoreCalls(120);
if (!SubmitSmoke("shore-departure-transport"))
yield break;
ShoreReport transportReport = company.History[0].ShoreReport;
if (!CheckSmoke(Ship.ShoreCall == null && company.Voyages == shoreVoyages
&& transportReport?.Resolution == ShoreLateResolution.AlternateTransport
&& transportReport.ExtraCost < heldReport.ExtraCost && transportReport.GuestImpact < heldReport.GuestImpact
&& company.Cash == shoreCash + transportReport.NetIncome,
"Arranging onward transport clears the call with cheaper costs and a worse guest survey"))
yield break;
if (!SubmitSmoke("nav-3") || !SubmitSmoke("port-0")
|| !CheckSmoke(root.Q<Button>("dispatch")?.enabledInHierarchy == true,
"Resolve the late group and clear the next departure"))
yield break;
Debug.Log($"Soundings player smoke passed at {Screen.width} × {Screen.height}.");
Application.Quit(0);
}