aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit 0eb024d2ec77174b5b2fd829f855987d1179b04c
parent b107961db26fc384a6c8e28f1bead59177365388
Author: anon <anon@example.com>
Date:   Fri,  6 Nov 2026 02:56:48 +0000

Verify starter combat and recovery across all profession and breed choices

Diffstat:
MTODO.md | 8++++++--
Adocs/alpha-progression-matrix.md | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aserver/browser_starter_combat_paths_test.go | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aserver/starter_combat_paths_test.go | 181+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools/client/test_starter_combat_paths.mjs | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 470 insertions(+), 2 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -219,8 +219,12 @@ research separately. More screenshots and test cases do not count as new gamepla bindings keep guards, vendors and reused templates outside this scope. Native kills retain heads/outfits, visible slope placement and exact loot ownership after reconnect/cold recovery; see [human encounters](docs/training-human-combat.md). - A7 remains open for the compact faction/profession progression matrix and - its bounded integration and affordability/pace checks. + The [compact progression matrix](docs/alpha-progression-matrix.md) now names + the finite routes, retained evidence and remaining checks. All 48 profession/ + breed starts pass a full-health fight, recovery and cold ownership check + using starting IP and issued equipment; MPs use their issued pet and shield. + A7 remains open for level-5/10 non-Enforcer loadouts, a current Clan/Neutral + repeat/level-training sample, and bounded release/affordability/pace checks. - [x] **A8: Isolate administration before public hosting.** The current HTTP and HTTPS listeners share a handler. Administration now requires separate diff --git a/docs/alpha-progression-matrix.md b/docs/alpha-progression-matrix.md @@ -0,0 +1,101 @@ +# Alpha progression acceptance matrix + +A7 covers the offered twelve professions and four breeds through levels 1-10, +with Omni, Clan and Neutral starts. The rows below separate retained ordinary +play from controlled acceptance checks. They do not require replaying earned +levels or the same mission route for every combination. A7 remains open until +the remaining cells have direct evidence; historical balance precision is +outside this gate. + +## Finite content + +| Area | Included alpha content | Evidence and limits | +| --- | --- | --- | +| Training and hunting | Omni 950, Clan 952, Neutral 954; fifteen distinct creature bodies and six human opponent populations | [Creature/corpse matrix](alpha-item-recovery.md), [human encounters](training-human-combat.md). All have supported combat/reward/lifecycle paths. Wider outdoor hunting and public dungeons are deferred. | +| Starter missions | The 130 original paired backyard booths/entrances, including Omni Backyard 1, Tir Backyard 1 and Newland Backyard 1 | [Starter missions](starter-missions.md). Shared Find Item contract, five Leet encounters, original book pickup and return. Encounter levels are bounded at 1-10. City mission generation is unsupported. | +| Shops | Training grounds 950/952/954 and basic shops 1180/1183/1186, plus the five reviewed NPC vendors | [190-terminal inventory](early-shop-stock.md), [NPC vendors](npc-shops.md). Seventy terminals stock the supported subset; 120 explain their unsupported purchases and retain sales. | +| Profession essentials | Actual issued kits and the bounded early weapon, armor, recovery and nano purchases | [Twelve-profession matrix](alpha-profession-paths.md). Full profession catalogs, more robot tiers, charms and heal pets are deferred unless an encounter demonstrates a necessary dependency. | +| Death/recovery | Training return and original faction scanner/reclaim routes | [Item/recovery matrix](alpha-item-recovery.md), [insurance](insurance.md). Significant ownership changes persist atomically. | + +Mission completion pays the saved cash/item promise; completion XP and tokens +are not implemented or advertised. Combat XP is independent. Current reward +and encounter balance remains explicitly provisional. + +## Connected behavior + +| Acceptance criterion | Authoritative evidence | Remaining A7 check | +| --- | --- | --- | +| Create offered characters and use issued tools | All 255 original heads with profession/faction choices survive restart; the twelve-profession check uploads all nineteen issued crystals with starting IP; the 48 profession/breed starter checks below connect fight, recovery and cold ownership | Starter readiness covered; higher-level non-Enforcer loadouts remain below | +| Fight and loot on every faction's training route | Original creature and human placement checks use native picking and exact corpse ownership through cold recovery | These controlled body checks do not establish normal-play pace | +| Earn/train a level | Retained fresh Omni Enforcer loop earns level 2 and spends earned IP; the same ordinary progression continues through level 10 | Inspect retained evidence for the bounded release sample; do not repeat leveling | +| Obtain/use an upgrade and replenish supplies | Ordinary Omni armor/weapon/recovery purchases; ordinary Clan bat and Neutral glove mission rewards; current three-faction purchase/use/reconnect checks | Check controlled level-5/10 non-Enforcer loadouts for a usable encounter/recovery path | +| Finish and repeat missions | Ordinary Omni repeated contracts through level 10; ordinary Clan and Neutral entry, book return, reward wear and cold native login | One bounded current Clan/Neutral repeat/level-training integration sample remains | +| Recover from death | Ordinary Omni level-10 combat death, cold pending reclaim, exact collection and return to the interrupted mission; controlled native Clan/Neutral scanner/death/reclaim checkpoints | Shared recovery ownership is covered by A6; retain the faction checkpoints in release acceptance | +| Reconnect/restart without losing progress | Exact-state and failed-write/retry matrix; two-client native cold login; ordinary earned checkpoints | One bounded release acceptance pass after remaining known gaps are resolved | +| Affordability and progression pace | Current 500-credits-per-mission-level policy has all-faction level-1/5/10 settlement/resupply checks; retained ordinary level-two mission funds recovery and armor | Older earned runs used 20-credit hand-ins. Use one bounded current ordinary sample for pace; funded fixtures alone do not close it | + +The retained ordinary records are [starter progression](starter-progression.md), +[all-faction starter missions](starter-missions.md) and +[earned levels through ten](mission-levels.md). Their historical observations +remain valid for those runs; superseded limitations in those chronological +records do not reopen work already closed by the current A2-A6 evidence. + +## Current implementation gaps and coverage limits + +No new gameplay defect is established by assembling this matrix. The six +previously appearance-only human populations are now implemented and verified. +The remaining cells above are explicit A7 integration/coverage requirements, +not a new content backlog or a claim that all untested paths are broken. + +A1's specific Trade movement report remains separate and unreproduced. Its +actor/location or a new failing capture is still needed before repeating the +passing Trade routes. A7 evidence cannot close that reported visible defect. + +## November 5 starter readiness + +`TestCreatedProfessionsFightAndRecoverWithIssuedKits` checks all twelve +professions in each of the four offered breeds. Each starts through the account +creation endpoint, spends only its original 1500 IP, equips its actual issued +weapon (or uses MA fists), selects maximum aggression and reaches full resources +through ordinary sitting regeneration. The fixture places one admitted, +full-health level-one Leet beside the Omni arrival. Placement and the random +stream are controlled; stats, equipment, casting, damage and rewards use their +normal handlers and authored requirements. + +The training batch raises the six abilities by three, Body Development to 9, +Evade Close and Treatment to 8, and the issued attack skill to 9. MPs also train +Matter Creation and Time and Space to 9, upload the issued Lesser Anger +Manifestation crystal and summon it through the normal casting handler. The +shield-only Nanomage probe lost with eight enemy HP remaining; using the issued +pet and shield supplies its intended complete combat path without a balance +change. Other professions need no nano or special to pass this particular +baseline; their complete issued effects have separate A5 evidence. + +Combat uses the normal hit/miss, critical and damage rules with a fixed PCG +seed `(1,2)`. All 48 cases win and earn exactly 100 XP. Survivors have 2-68 HP +and retain 1001-1173 starting IP. When recovery is needed, one actual laboratory +charge restores its original health/nano amounts and installs the Treatment +lock; five Opifex cases finish at full resources and retain their charge. +Ordinary regeneration completes recovery. Cold loading preserves every issued +item's identity, slot, quality and count, learned nano, surviving pet count, +trained stats, XP, wallet and health/nano values. + +The complete check passes in 23.64 seconds after package initialization; the +log is `local/alpha-combat-paths/verified.log`. These are controlled readiness +checks, not forty-eight native playthroughs or a statistical survival/balance +claim. The original all-hit probe intentionally removed evasion and cannot +establish ordinary encounter difficulty. This matrix does not require using +the same weapon or training choice at higher levels. + +`TestBrowserNanomageStarterCombatAndRecovery` exercises the MP dependency in +the real browser client. Normal creation/training prepares the controlled +fixture; native enemy selection, Q and `/pet attack` defeat the full-health +Leet. Native self-selection, sitting and laboratory Use consume one charge. +The reconnected native inventory reports 24 remaining charges, and a cold database load +preserves exact inventory, trained stats, XP, resources, pet count and the +Treatment lock. The final run passes in 61.89 seconds; artifacts are retained +under `local/alpha-combat-paths/20261105-185454/` and the log is +`local/alpha-combat-paths/browser-verified.log`. The kill view was inspected; +reconnect checks use client/server state (the final screenshot still shows +the loading overlay). `go vet ./server`, JavaScript syntax and local document +links also pass. This milestone changes coverage and documentation, not gameplay. diff --git a/server/browser_starter_combat_paths_test.go b/server/browser_starter_combat_paths_test.go @@ -0,0 +1,93 @@ +package main + +import ( + "context" + "crypto/sha256" + "encoding/json" + "fmt" + "math" + "net/http" + "net/http/httptest" + "os" + "os/exec" + "path/filepath" + "reflect" + "runtime" + "testing" + "time" +) + +func TestBrowserNanomageStarterCombatAndRecovery(t *testing.T) { + if os.Getenv("AO_GAME_TEST") != "1" { + t.Skip("set AO_GAME_TEST=1 for native starter combat") + } + _, source, _, _ := runtime.Caller(0) + root := filepath.Dir(filepath.Dir(source)) + output := filepath.Join(root, "local/alpha-combat-paths", time.Now().Format("20060102-150405")) + world, _ := newCreatedStarterCombatWorld(t, 12, 40172) + player, target := world.characters[2], world.characters[1000000] + delete(world.clients, 2) + yaw := math.Atan2(float64(target.position[0]-player.position[0]), float64(target.position[2]-player.position[2])) + player.rotation = [4]float32{0, float32(math.Sin(yaw / 2)), 0, float32(math.Cos(yaw / 2))} + player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte("starter-combat"))) + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + + // The fixture prepares creation/training; native input performs combat and kit use. + mux := http.NewServeMux() + mux.Handle("/", world.httpHandler()) + mux.HandleFunc("GET /test-state", func(w http.ResponseWriter, r *http.Request) { + world.mutex.Lock() + defer world.mutex.Unlock() + pets := make(map[uint32]uint32) + for id, pet := range player.pets { + pets[id] = pet.health + } + json.NewEncoder(w).Encode(map[string]any{"id": player.id, "health": player.health, "maximumHealth": player.maximumHealth(), "nano": player.nano, "experience": player.experience, "inventory": player.inventory, "target": target.id, "targetHealth": target.health, "pets": pets}) + }) + host := httptest.NewServer(mux) + defer host.Close() + defer closeTestSessions(t, world) + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + stopped := make(chan struct{}) + go func() { + defer close(stopped) + ticker := time.NewTicker(20 * time.Millisecond) + defer ticker.Stop() + for { + select { + case now := <-ticker.C: + world.advancePlayerMovement(now) + world.advanceCombat(now) + world.advanceRegeneration(now) + case <-ctx.Done(): + return + } + } + }() + defer func() { cancel(); <-stopped }() + command := exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_starter_combat_paths.mjs"), host.URL, output) + command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr + err := command.Run() + cancel() + <-stopped + closeTestSessions(t, world) + t.Logf("Browser artifacts: %s", output) + if err != nil { + t.Fatal(err) + } + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + cold := newTestInventoryServer(t).characters[player.id] + // Cold inventories use the shared allocator, including the new corpse loot. + expectedInventory := player.inventory + expectedInventory.LastID = world.nextItem + if !reflect.DeepEqual(cold.inventory, expectedInventory) { + t.Fatalf("cold inventory = %+v; want %+v", cold.inventory, expectedInventory) + } + if player.health == 0 || player.experience != 100 || target.health != 0 || player.inventory.Items[0].Count != 24 || cold.health != player.health || cold.nano != player.nano || cold.stats != player.stats || cold.experience != 100 || len(cold.pets) != len(player.pets) || !cold.skillLocks[124].Equal(player.skillLocks[124]) { + t.Fatal("native starter combat or recovery changed after cold load", cold.profile(), player.profile()) + } +} diff --git a/server/starter_combat_paths_test.go b/server/starter_combat_paths_test.go @@ -0,0 +1,181 @@ +package main + +import ( + "encoding/binary" + "fmt" + "math/rand/v2" + "net/http" + "reflect" + "slices" + "testing" + "time" +) + +// Normal creation, training and equipment prepare a bounded full-health encounter. +func newCreatedStarterCombatWorld(t *testing.T, profession uint16, head uint32) (*server, time.Time) { + t.Helper() + + data := testNPCData() + group := &data.Playfields[0].Districts[0].Groups[0] + group.Levels, group.AppearanceStatus = [2]uint16{1, 1}, "inferred_species" + group.Positions = [][3]float32{{54.5, 14.75, 58}} + originalResources := resources + useNPCData(t, data) + resources = originalResources + world := newTestServer(t) + fields := creationForm() + fields.Set("profession", fmt.Sprint(profession)) + fields.Set("head_mesh", fmt.Sprint(head)) + if response := creationRequest(world, accountVisitor(t, world), fields); response.Code != http.StatusNoContent { + t.Fatal(response.Code, response.Body.String()) + } + player := world.characters[2] + client := &worldClient{id: 2, conn: &combatTestConn{}, ready: true, target: true, npcs: map[uint32]bool{1000000: true}} + world.clients[2] = client + + // Spend starting IP on abilities, survival, recovery and the issued attack skill. + trained := player.baseStats() + for _, field := range trained.trainingStats() { + if field.stat >= 16 && field.stat <= 21 { + *field.value += 3 + } + } + trained.Body.BodyDevelopment = 9 + trained.Speed.EvadeClose = 8 + trained.NanoAiding.Treatment = 8 + if profession == 12 { + trained.NanoAiding.MatterCreation = 9 + trained.NanoAiding.TimeAndSpace = 9 + } + primary := []uint32{116, 100, 112, 114, 113, 112, 115, 112, 102, 112, 112, 102}[profession-1] + for _, field := range trained.trainingStats() { + if field.stat == primary { + *field.value = 9 + } + } + request := skillTrainingRequest(trained) + binary.BigEndian.PutUint32(request[28:32], player.id) + if err := world.handleSkillTraining(client, request[20:]); err != nil { + t.Fatal(err) + } + trained.ImprovementPoints = player.stats.ImprovementPoints + if player.stats != trained || player.stats.ImprovementPoints == 0 || player.stats.ImprovementPoints >= 1500 { + t.Fatal("training refused", player.stats) + } + + // MA uses fists; every other profession equips its actual issued weapon. + if profession != 2 { + if err := world.handleInventory(client, inventoryMovePacket(2, 67, 6)[20:]); err != nil || client.equipment == nil { + t.Fatal("equip", err) + } + world.advanceEquipment(client.equipment.readyAt) + } + world.combatRoll = rand.New(rand.NewPCG(1, 2)).Uint32N + aggression := binary.BigEndian.AppendUint32(nil, 100) + if err := world.handleCombat(client, n3Packet(0x76793f0d, 50000, player.id, aggression)[20:]); err != nil { + t.Fatal(err) + } + + // Training does not refill HP; recover through the normal sitting ticks. + now := time.Now() + if err := world.handlePosture(client, characterActionPacket(2, [5]uint32{86})[20:]); err != nil { + t.Fatal(err) + } + for ticks := 0; ticks < 500 && (player.health < player.maximumHealth() || player.nano < player.maximumNano()); ticks++ { + now = now.Add(2 * time.Second) + world.advanceRegeneration(now) + } + if player.health != player.maximumHealth() || player.nano != player.maximumNano() { + t.Fatal("starter did not recover before combat") + } + + // The MP's issued attack pet supplements its shield, including for Nanomages. + if profession == 12 { + if err := world.handlePosture(client, characterActionPacket(player.id, [5]uint32{87})[20:]); err != nil { + t.Fatal(err) + } + if err := world.handleOwnedItemUse(client, backpackUseRequest(player.id, 68, 1)[20:]); err != nil { + t.Fatal(err) + } + if err := world.handleNanoCast(client, characterActionPacket(player.id, [5]uint32{19, 0, 0, 53019, 43324})[20:]); err != nil || client.nanoCast == nil { + t.Fatal("issued attack pet could not be summoned", err) + } + world.advanceNanos(client.nanoCast.readyAt.Add(time.Nanosecond)) + if len(player.pets) != 1 { + t.Fatal("issued attack pet was not created") + } + } + return world, now +} + +func TestCreatedProfessionsFightAndRecoverWithIssuedKits(t *testing.T) { + for _, breed := range []struct { + name string + head uint32 + }{ + {"Solitus", 40681}, {"Opifex", 40252}, {"Nanomage", 40172}, {"Atrox", 40132}, + } { + for profession := uint16(1); profession <= 12; profession++ { + t.Run(fmt.Sprintf("%s/%d", breed.name, profession), func(t *testing.T) { + world, now := newCreatedStarterCombatWorld(t, profession, breed.head) + player, client, target := world.characters[2], world.clients[2], world.characters[1000000] + items := slices.Clone(player.inventory.Items) + trained := player.stats + started := now + + // Normal hit/miss, critical and damage rules use a repeatable random stream. + if target.health != 100 { + t.Fatal("starter encounter was not full health", target.health) + } + if err := world.handleCombat(client, attackPacket(2, target.id)[20:]); err != nil { + t.Fatal(err) + } + if profession == 12 { + client.selectedTarget = [2]uint32{50000, target.id} + request := petFollowRequest(player.id) + binary.BigEndian.PutUint32(request[36:], 7) + if err := world.handlePetCommand(client, request[20:]); err != nil { + t.Fatal(err) + } + } + for tick := 0; tick < 1800 && target.health > 0 && player.health > 0; tick++ { + now = now.Add(100 * time.Millisecond) + world.advanceCombat(now) + world.advanceRegeneration(now) + } + t.Logf("HP %d/%d; fight %s; IP %d", player.health, player.maximumHealth(), now.Sub(started), player.stats.ImprovementPoints) + if player.health == 0 || target.health != 0 || target.corpse == nil || target.corpse.looter != player.id || player.experience != 100 { + t.Fatal("starter failed its complete encounter", player.health, target.health, player.experience) + } + // Use the actual issued laboratory, then finish recovery through ordinary ticks. + client.selectedTarget = [2]uint32{50000, player.id} + if err := world.handlePosture(client, characterActionPacket(player.id, [5]uint32{86})[20:]); err != nil { + t.Fatal(err) + } + if player.health < player.maximumHealth() || player.nano < player.maximumNano() { + health, nano := player.health, player.nano + if err := world.handleOwnedItemUse(client, backpackUseRequest(player.id, 64, 2)[20:]); err != nil { + t.Fatal(err) + } + items[0].Count = 24 + if player.health != min(player.maximumHealth(), health+15) || player.nano != min(player.maximumNano(), nano+15) || !slices.Equal(player.inventory.Items, items) || player.skillLocks[124].IsZero() { + t.Fatal("issued recovery did not retain its charge, health and lock contract") + } + } + for tick := 0; tick < 500 && (player.health < player.maximumHealth() || player.nano < player.maximumNano()); tick++ { + now = now.Add(2 * time.Second) + world.advanceRegeneration(now) + } + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + cold := newTestInventoryServer(t).characters[player.id] + + // Exact kit ownership, trained stats, earned XP and recovered health survive restart. + if player.health != player.maximumHealth() || cold.health != player.health || cold.nano != player.nano || cold.stats != trained || cold.level != 1 || cold.experience != 100 || cold.inventory.Credits != 0 || !reflect.DeepEqual(cold.inventory.Items, items) || !slices.Equal(cold.inventory.LearnedNanos, player.inventory.LearnedNanos) || len(cold.pets) != len(player.pets) || !cold.skillLocks[124].Equal(player.skillLocks[124]) { + t.Fatal("starter combat/recovery changed on cold load", cold.profile(), cold.inventory) + } + }) + } + } +} diff --git a/tools/client/test_starter_combat_paths.mjs b/tools/client/test_starter_combat_paths.mjs @@ -0,0 +1,89 @@ +import assert from 'node:assert/strict'; +import fs from 'node:fs/promises'; +import {createRequire} from 'node:module'; +import {GameTest} from './game_test.mjs'; + +const {chromium} = createRequire(import.meta.url)('playwright'); +const [url, output] = process.argv.slice(2); +const browser = await chromium.launch({executablePath: '/usr/bin/chromium', args: [ + '--enable-gpu', '--use-gl=angle', '--use-angle=gl', '--no-sandbox', '--disable-dev-shm-usage', + '--disable-background-timer-throttling', '--disable-renderer-backgrounding']}); +let game; +const evidence = {}; +try { + const context = await browser.newContext({viewport: {width: 1024, height: 768}}); + await context.addCookies([{name: 'ao_client', value: 'starter-combat', url}]); + const page = await context.newPage(); + game = await GameTest.attach(page); + const server = async () => (await page.request.get(url + '/test-state')).json(); + await page.goto(url); + await game.ready(); + if (!game.state.camera.firstPerson) await game.key('F8'); + evidence.before = await server(); + assert.equal(evidence.before.targetHealth, 100); + assert.equal(evidence.before.experience, 0); + assert.equal(evidence.before.health, evidence.before.maximumHealth); + + const point = await game.point(512, 300); + let mouseY = point.y, sequence = game.sequence; + await page.mouse.move(point.x, mouseY); + await page.mouse.down({button: 'right'}); + try { + await game.waitInput(sequence, 1025); + const deadline = Date.now() + 10000; + for (;;) { + await game.snapshot(); + const y = game.state.actors.find(actor => actor.type === 50000 && actor.id === evidence.before.target).screenPosition[1]; + if (y >= 450 && y <= 550) break; + assert(Date.now() < deadline, 'Could not frame starter enemy'); + mouseY += y > 550 ? 10 : -10; + await page.mouse.move(point.x, mouseY, {steps: 2}); + } + } finally { + sequence = game.sequence; + await page.mouse.up({button: 'right'}); + } + await game.waitInput(sequence, 1026); + await game.click(...await game.pick(50000, evidence.before.target)); + await game.wait('starter enemy selected', state => state.selected[1] === evidence.before.target); + await game.key('q'); + await game.key('Enter'); + await page.keyboard.type('/pet attack'); + await game.key('Enter'); + await game.wait('full-health starter defeated', state => { + assert(game.local(state).stats[27] > 0, 'Nanomage starter died'); + return state.actors.some(actor => actor.type === 51050 && actor.id === evidence.before.target); + }, 120000); + evidence.killed = await server(); + assert.equal(evidence.killed.targetHealth, 0); + assert(evidence.killed.health > 0); + assert.equal(evidence.killed.experience, 100); + await game.save(output + '/kill'); + + await game.key('F1'); + await game.key('KeyX'); + await game.wait('seated for issued laboratory', state => game.local(state).stats[430] === 2); + await game.key('KeyI'); + await game.wait('laboratory inventory cell', state => state.grids.some(grid => grid.cells.some(cell => cell.identity[0] === 104 && cell.identity[1] === 48 && !cell.dummy))); + const cell = game.state.grids.flatMap(grid => grid.cells).find(cell => cell.identity[0] === 104 && cell.identity[1] === 48 && !cell.dummy); + await game.click((cell.bounds[0] + cell.bounds[2]) / 2, (cell.bounds[1] + cell.bounds[3]) / 2, 'right'); + await game.waitFor('one issued laboratory charge used', async () => (await server()).inventory.Items[0].Count === 24); + evidence.recovered = await server(); + assert(evidence.recovered.health > evidence.killed.health || evidence.recovered.nano > evidence.killed.nano); + await page.reload(); + await game.ready(); + await game.wait('reconnected HUD and remaining laboratory charges', state => + state.regions.some(region => region[1] === state.screen[1] - 20) && + game.local(state).inventory.some(item => item.slot === 48 && item.count === 24)); + evidence.reconnected = await server(); + assert.equal(evidence.reconnected.experience, 100); + assert.deepEqual(evidence.reconnected.inventory, evidence.recovered.inventory); + assert.deepEqual(game.errors, []); + console.log('PASS: created Nanomage MP uses issued shield/pet, defeats full-health Leet and retains kit recovery through reconnect'); +} finally { + try { + await fs.mkdir(output, {recursive: true}); + await fs.writeFile(output + '/verification.json', JSON.stringify(evidence, null, 2) + '\n'); + if (game) await game.save(output + '/final'); + } finally { await browser.close(); } +}