commit 73a1fade94e280f5e572ebf79f7adb56463e8cc7 parent 62a2bcf3b168b254be2a8c8c85c397f922444506 Author: anon <anon@example.com> Date: Sun, 8 Nov 2026 19:02:36 +0000 Reduce provisional early enemy health for forgiving starter combat Diffstat:
47 files changed, 272 insertions(+), 124 deletions(-)
diff --git a/TODO.md b/TODO.md @@ -257,8 +257,14 @@ research separately. More screenshots and test cases do not count as new gamepla ordinary-action and creature-body matrix. New A7 encounters must establish their corpse/recovery behavior when admitted. -- [x] **A7: Analytically establish a viable early progression path.** Determine - whether the implemented combat, loot, shops and rewards support progress for +- [x] **A7: Analytically establish a viable early progression path.** + November 8: the reported unfair starter encounters reopened the balance check. + Provisional early enemy HP is now 20 at levels 1/2, then +10 per level; original + damage and rewards remain unchanged. Untrained pistol checks win 18..20 of 20 + fights per starter species/level, averaging about 15 seconds after the first + shot. Prepared profession/breed paths and native combat/recovery/restart pass; + this closes the focused balance follow-up. See the updated assessment below. + Determine whether the implemented combat, loot, shops and rewards support progress for Omni, Clan and Neutral starts. Levels 1-10 bound the content being assessed; they are not a playthrough requirement for any faction or profession. Reuse existing tests, retained gameplay evidence and shared rules, checking diff --git a/docs/alpha-progression-matrix.md b/docs/alpha-progression-matrix.md @@ -18,7 +18,39 @@ recovery. Mission income, issued supplies and lower-difficulty encounters cover that gap. This closes the finite analytical A7 gate; it does not certify every build, enemy choice or player input schedule as equally forgiving. -## Starter combat screening +## Starter health adjustment + +The reported training-ground difficulty reopened A7's starter-balance check. +Provisional HP is now 20 at levels 1/2 and grows by 10 per level thereafter, +instead of 100 at levels 1/2 and growth of 25. All admitted early enemy profiles +receive the reduction, including training humans and bosses; original damage +and rewards remain unchanged. See [current profiles](combat-npc-balance.md). + +The screening and recovery budgets below describe the preceding 100-HP +baseline. They remain historical evidence, not current fight-time or survival +predictions. The focused regression uses an untrained Solitus Doctor's issued +pistol at default aggression with no nanos, specials or healing, across eight +early creature/level cases and twenty deterministic random streams per case. + +The production combat regression wins 19/20 level-one Leet fights, 18/20 +level-two Leet fights, 20/20 Reet and Rollerrat fights, 18/20 Snake, Green Lizard +and Blubbag fights, and 20/20 Tiny Stalker fights. Mean successful fight duration +after the first shot is 14.8..15.7 seconds. This finite sample is a regression +screen, not a guaranteed survival probability; regeneration is omitted. +The earlier trained Nanomage MA distribution calculation, changing only Leet +HP to 20, gives 9.52 seconds mean kill time and over 99.99% modeled survival +using ordinary fists, versus 48.4 seconds and 60.1% at 100 HP. Its existing +assumptions (full aggression, in range, no recovery or scheduler jitter) remain. + +All 48 prepared profession/breed starter paths also pass at the new health. +The browser Nanomage MP check verifies the 20-HP encounter, earned XP, laboratory +consumption, reconnect and a cold restart, including the surviving attack pet. +The restart fixtures use complete server loading so living pets are restored. +NPC/mission regressions retain original damage, rewards, placement, respawning +and ownership. The whole-repository suite was stopped during unrelated account +tests; verification is scoped to the affected tests, the browser check and vet. + +## Starter combat screening (100-HP baseline) The trained Nanomage Martial Artist is a useful fragile case: 35 maximum HP, effective MA 11, and effective Evade Close 10 in the retained starter fixture. diff --git a/docs/combat-npc-balance.md b/docs/combat-npc-balance.md @@ -10,6 +10,21 @@ The [Omni training boss](omni-training-boss.md) now uses an explicit level-4 profile and original Aquaan attack endpoints; its identity and balance remain provisional. The separate Clan boss retains its existing independent profile. +## Forgiving early health + +Current provisional enemy profiles use 20 HP at levels 1 and 2, then add +10 HP per level: 30 at level 3, 40 at level 4, and 100 at level 10. +This applies to every admitted early creature and training-human profile, +including Leets, Minibulls, Reets, Tiny Stalkers, Rollerrats, snakes, Malles, +lizards, Blubbags, Androids, Biofreaks, Clawfingers and Eye Mutants. +The Omni and Neutral training bosses have 40 HP; the independent Clan boss +has 20 HP. These are deliberate forgiving balance values, not historical data. + +Weapon endpoints, damage, timing, skills, XP, cash and loot are unchanged. +Unprofiled actors, guards, vendors and summoned pets are outside this adjustment. +The historical gameplay reports below retain their measured old-health results; +they must not be read as measurements of the current balance. + ## Bounded early progression `npc_combat.yaml` contains level anchors, not an unlimited species formula. @@ -22,20 +37,20 @@ catalog, weapon QL, loot and population-scope validation as an explicit anchor. | Leet level | HP / solo XP | Raw MA / Duck / Dodge / Evade Close / Nano Resist | Monster Parts QL | | --- | --- | --- | --- | -| 1 | 100 / 100 | 5 | 1 | -| 2 | 100 / 100 | 5 | 1..3 | -| 3 | 125 / 125 | 10 | 2..4 | -| 4 | 150 / 150 | 15 | 3..5 | -| 5 | 175 / 175 | 20 | 4..6 | -| 6 | 200 / 200 | 25 | 5..7 | -| 7 | 225 / 225 | 30 | 6..8 | -| 8 | 250 / 250 | 35 | 7..9 | -| 9 | 275 / 275 | 40 | 8..10 | -| 10 | 300 / 300 | 45 | 9..11 | +| 1 | 20 / 100 | 5 | 1 | +| 2 | 20 / 100 | 5 | 1..3 | +| 3 | 30 / 125 | 10 | 2..4 | +| 4 | 40 / 150 | 15 | 3..5 | +| 5 | 50 / 175 | 20 | 4..6 | +| 6 | 60 / 200 | 25 | 5..7 | +| 7 | 70 / 225 | 30 | 6..8 | +| 8 | 80 / 250 | 35 | 7..9 | +| 9 | 90 / 275 | 40 | 8..10 | +| 10 | 100 / 300 | 45 | 9..11 | All numbers in this table are **provisional gameplay balance**. Levels 1 and 2 -retain their independently tested baseline. From level 2, each next level adds -25 HP/XP and five raw skill points. Levels 3, 5 and 10 are explicit anchors; +share the 20-HP starter baseline. From level 2, each next level adds +10 HP, 25 XP and five raw skill points. Levels 3, 5 and 10 are explicit anchors; levels 4 and 6..9 are resolved by the shared interpolation. This bounded choice unlocks the next ordinary missions without claiming that the original server used these slopes. @@ -284,7 +299,7 @@ outside their QL range, zero health, and AggDef outside -100..100. | Value | Selected setting | Evidence status | | --- | --- | --- | -| Maximum health | 100 at each level | Provisional prototype value retained independently; no health scaling formula inferred | +| Maximum health | 20 at each level | Provisional forgiving starter balance; no historical HP measurement | | Solo XP reward | 100 at each level | Provisional; the atomic [XP path](kill-experience.md) does not establish original reward size or eligibility | | Weapon | LeetBite1 endpoints 120910 / 120911, QL 1 or 2 | Shipped endpoints and native actor-level construction verified; binding and choice of variant provisional | | Normal damage endpoints | Level 1: 4-8; level 2: 4-9 | Shared recovered item interpolation; ordinary accuracy uses template weights and the provisional probability curve, while NPC damage rating scaling remains unresolved | diff --git a/server/browser_combat_facing_test.go b/server/browser_combat_facing_test.go @@ -77,7 +77,7 @@ func TestBrowserCombatTurnPublication(t *testing.T) { if err != nil { t.Fatal(err) } - if owner.fighting != 0 || npc.health != 100 { + if owner.fighting != 0 || npc.health != 20 { t.Fatal("facing fixture left combat active or executed a held attack") } } diff --git a/server/browser_fallback_placement_test.go b/server/browser_fallback_placement_test.go @@ -87,7 +87,7 @@ func TestBrowserFallbackPlacementMelee(t *testing.T) { if err != nil { t.Fatal(err) } - if enemy.health >= 100 || enemy.motion.home[1] == 10.8 { + if enemy.health >= 20 || enemy.motion.home[1] == 10.8 { t.Fatal("native approach and melee did not reach the grounded fallback", enemy.position, enemy.health) } } diff --git a/server/browser_npc_water_test.go b/server/browser_npc_water_test.go @@ -87,7 +87,7 @@ func TestBrowserNPCOutdoorWaterMotion(t *testing.T) { if err != nil { t.Fatal(err) } - if npc.health >= 100 || npc.movement.components[0] != 4 || !npc.movement.deepWater || players[0].health == 0 { + if npc.health >= 20 || npc.movement.components[0] != 4 || !npc.movement.deepWater || players[0].health == 0 { t.Fatal("native ordinary hit and pursuit did not retain the living water encounter") } } diff --git a/server/browser_starter_combat_paths_test.go b/server/browser_starter_combat_paths_test.go @@ -30,6 +30,9 @@ func TestBrowserNanomageStarterCombatAndRecovery(t *testing.T) { 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.saveUser(player); err != nil { + t.Fatal(err) + } if err := world.flushWorld(); err != nil { t.Fatal(err) } @@ -57,6 +60,10 @@ func TestBrowserNanomageStarterCombatAndRecovery(t *testing.T) { command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr err := command.Run() host.Close() + callTestZone(t, world, player.id, zoneTestCommand(func(state *server) error { + player, target = state.characters[2], state.characters[targetID] + return nil + })) if err := shutdown(); err != nil { t.Fatal(err) } @@ -65,7 +72,7 @@ func TestBrowserNanomageStarterCombatAndRecovery(t *testing.T) { if err != nil { t.Fatal(err) } - cold := newTestInventoryServer(t).characters[player.id] + cold := newServerForTest(t).characters[player.id] // Cold inventories use the shared allocator, including the new corpse loot. expectedInventory := player.inventory expectedInventory.LastID = cold.inventory.LastID @@ -73,6 +80,8 @@ func TestBrowserNanomageStarterCombatAndRecovery(t *testing.T) { 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()) + t.Fatalf("native starter recovery: live HP/nano/XP/pets/lock %d/%d/%d/%d/%v, cold %d/%d/%d/%d/%v; target HP %d, charges %d", + player.health, player.nano, player.experience, len(player.pets), player.skillLocks[124], + cold.health, cold.nano, cold.experience, len(cold.pets), cold.skillLocks[124], target.health, player.inventory.Items[0].Count) } } diff --git a/server/corpse_expiry_test.go b/server/corpse_expiry_test.go @@ -48,7 +48,7 @@ func TestCorpseExpiryClosesLootAndRemovesOnlyTheDeadLifeForBothObservers(t *test world.clients[1].npcs[1000000] || world.clients[2].npcs[1000000] || len(world.corpseExpiry) != 0 { t.Fatal("expired corpse retained its actor, loot window, interest or expiry entry") } - if len(world.characters) != 3 || world.characters[1000001].health != 100 || + if len(world.characters) != 3 || world.characters[1000001].health != 20 || len(world.mobileNPCs[950]) != 1 || world.mobileNPCs[950][0].id != 1000001 { t.Fatal("corpse removal changed the living replacement") } @@ -132,7 +132,7 @@ func TestCorpseExpiryBeforeRespawnWithoutObserversKeepsOneRoamingReplacement(t * client.npcs = make(map[uint32]bool) world.advanceNPCs(killed.Add(101 * time.Second)) - if len(world.characters) != 2 || world.characters[1000001].health != 100 || len(world.npcRespawns) != 0 || + if len(world.characters) != 2 || world.characters[1000001].health != 20 || len(world.npcRespawns) != 0 || len(world.mobileNPCs[950]) != 1 || world.mobileNPCs[950][0].id != 1000001 || len(conn.packets) != 2 || binary.BigEndian.Uint32(conn.packets[0][16:20]) != 0x271b3a6b || binary.BigEndian.Uint32(conn.packets[1][16:20]) != 0x1d3c0f1c { @@ -215,7 +215,7 @@ func TestCorpseExpiryFixedCreatureDoesNotRequireARoamingRoster(t *testing.T) { world.advanceCorpseExpiry(killed.Add(180 * time.Second)) world.advanceNPCRespawns(killed.Add(181 * time.Second)) - if world.characters[1000000] != nil || world.characters[1000001].health != 100 || + if world.characters[1000000] != nil || world.characters[1000001].health != 20 || world.characters[1000001].motion != nil || len(world.corpseExpiry) != 0 || len(world.npcRespawns) != 0 { t.Fatal("fixed corpse cleanup or its replacement required an unrelated roaming roster") } diff --git a/server/gamedata/minibull_test.go b/server/gamedata/minibull_test.go @@ -10,7 +10,7 @@ func TestMinibullProfilesUseBoundedOriginalHeadbutt(t *testing.T) { first, last := profiles[4], profiles[10] - if len(profiles) != 10 || first == nil || last == nil || first.Health != 150 || last.Health != 300 || + if len(profiles) != 10 || first == nil || last == nil || first.Health != 40 || last.Health != 100 || first.Experience != 150 || last.Experience != 300 || first.Weapon != [2]uint32{120961, 120962} || !slices.Equal(first.TemplateCodes, []string{"MB01"}) || profiles[0] != nil || profiles[11] != nil { t.Fatal("Minibull profiles lost their explicit bounded anchors or original weapon", profiles) diff --git a/server/gamedata/npc_combat.yaml b/server/gamedata/npc_combat.yaml @@ -1,9 +1,11 @@ # MonsterData and level anchors; intermediate levels interpolate within each species. +# Provisional early health: 20 at levels 1..2, then +10 per level. +# The Clan boss retains its separate baseline. XP and original weapons are independent. # Values outside the anchored range retain prototype combat. See docs/combat-npc-balance.md. 17655: 1: &leet # Provisional health; no historical level-1 Leet HP measurement recovered. - health: 100 + health: 20 # Provisional solo XP; no historical level-1 Leet reward measurement recovered. experience: 100 # Provisional raw Martial Arts, evades and Nano Resist; no player trickle. @@ -27,8 +29,8 @@ quality: [1, 1] chance: 50 2: - # Retained prototype health and the same provisional solo reward, not a scaling formula. - health: 100 + # Provisional starter health and solo reward, not historical measurements. + health: 20 experience: 100 skills: {100: 5, 153: 5, 154: 5, 155: 5, 168: 5} # Original LeetBite1 endpoints; the native constructor uses creature level as QL. @@ -45,11 +47,11 @@ quality: [1, 3] chance: 50 - # Bounded provisional growth: +25 HP/XP and +5 raw skills per level from 2. + # Bounded provisional growth: +10 HP, +25 XP and +5 raw skills per level from 2. # This is a gameplay choice, not a recovered historical formula. Level 4 is interpolated. 3: <<: *leet - health: 125 + health: 30 experience: 125 skills: {100: 10, 153: 10, 154: 10, 155: 10, 168: 10} loot: @@ -58,7 +60,7 @@ chance: 50 5: <<: *leet - health: 175 + health: 50 experience: 175 skills: {100: 20, 153: 20, 154: 20, 155: 20, 168: 20} loot: @@ -71,7 +73,7 @@ # The shared loader interpolates levels 6..9; it does not admit level 11. 10: <<: *leet - health: 300 + health: 100 experience: 300 skills: {100: 45, 153: 45, 154: 45, 155: 45, 168: 45} loot: @@ -84,7 +86,7 @@ # MB01 is an inferred species binding; other Minibull codes stay unreviewed. template_codes: [MB01] # Explicit provisional resources/ratings/loot, not historical species measurements. - health: 100 + health: 20 experience: 100 skills: {100: 5, 153: 5, 154: 5, 155: 5, 168: 5} # Original Headbutt endpoints; choosing it instead of Kick remains provisional. @@ -106,7 +108,7 @@ chance: 50 4: <<: *minibull - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -115,7 +117,7 @@ chance: 50 10: <<: *minibull - health: 300 + health: 100 experience: 300 skills: {100: 45, 153: 45, 154: 45, 155: 45, 168: 45} loot: @@ -128,7 +130,7 @@ # RT01/RT02 retain their inferred species bindings and original Peck weapon. template_codes: [RT01, RT02] # Provisional starter balance, not a recovered species growth or loot formula. - health: 100 + health: 20 experience: 100 skills: {100: 5, 153: 5, 154: 5, 155: 5, 168: 5} # Original ReetPeck endpoints; selecting Peck rather than Facepeck is provisional. @@ -153,7 +155,7 @@ <<: *reet # The authored RT02 range extends to 4; RT01 remains bounded to 1..2. template_codes: [RT02] - health: 125 + health: 30 experience: 125 skills: {100: 10, 153: 10, 154: 10, 155: 10, 168: 10} loot: @@ -162,7 +164,7 @@ chance: 50 4: <<: *starter_reet - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -175,7 +177,7 @@ # SR01's species binding is medium-confidence; see docs/tiny-stalker.md. template_codes: [SR01] # Explicit provisional balance, not an original species growth formula. - health: 100 + health: 20 experience: 100 skills: {100: 5, 153: 5, 154: 5, 155: 5, 168: 5} # Original StalkerStomp endpoints; selecting Stomp rather than Spit is provisional. @@ -192,7 +194,7 @@ chance: 50 4: <<: *tiny_stalker - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -205,7 +207,7 @@ # Original RR01/ROLL populations; the full species bindings remain inferred. template_codes: [RR01, ROLL] # Shared provisional starter baseline, not historical species statistics. - health: 100 + health: 20 experience: 100 skills: {100: 5, 153: 5, 154: 5, 155: 5, 168: 5} # Original Faceroll endpoints. Selection instead of Spray is provisional. @@ -231,7 +233,7 @@ <<: *starter_rollerrat # ROLL's authored training range extends to 4; RR01 remains bounded to 1..2. template_codes: [ROLL] - health: 125 + health: 30 experience: 125 skills: {100: 10, 153: 10, 154: 10, 155: 10, 168: 10} loot: @@ -240,7 +242,7 @@ chance: 50 4: <<: *starter_roll - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -264,7 +266,7 @@ 4: <<: *starter_snake # Explicit provisional upper anchor; shared interpolation resolves level 3. - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -287,7 +289,7 @@ chance: 50 4: <<: *starter_malle - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -311,7 +313,7 @@ chance: 50 4: <<: *starter_lizard - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -334,7 +336,7 @@ chance: 50 3: <<: *starter_blubbag - health: 125 + health: 30 experience: 125 skills: {100: 10, 153: 10, 154: 10, 155: 10, 168: 10} loot: @@ -361,7 +363,7 @@ chance: 50 4: <<: *starter_android - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -383,7 +385,7 @@ chance: 50 4: <<: *starter_biofreak - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -405,7 +407,7 @@ chance: 50 3: <<: *starter_clawfinger - health: 125 + health: 30 experience: 125 skills: {100: 10, 153: 10, 154: 10, 155: 10, 168: 10} loot: @@ -425,7 +427,7 @@ chance: 50 4: <<: *starter_eye_mutant - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} loot: @@ -439,7 +441,7 @@ # The Aquaan identity is low-confidence; see docs/omni-training-boss.md. template_codes: [BNMO] # Provisional level-4 early balance, not a recovered boss template. - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} # Original AquaanOnearmslash endpoints; selecting this attack is provisional. @@ -471,7 +473,7 @@ # The original Clan Training fixed boss; ordinary salamanders do not inherit it. template_codes: [BSML] # Provisional early-profile baseline; no historical boss multipliers recovered. - health: 100 + health: 20 experience: 100 credits: [1, 5] # Original SalamanderBite1 endpoints; choosing variant 1 for this boss is provisional. @@ -498,7 +500,7 @@ 1: &training_human template_codes: [H320] groups: [950/district/1/group/0/authored_point] - health: 100 + health: 20 experience: 100 skills: {100: 5, 153: 5, 154: 5, 155: 5, 168: 5} weapon: [120697, 120698] @@ -533,7 +535,7 @@ groups: [950/district/4/group/0/authored_point] 4: <<: *training_informer - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} @@ -549,6 +551,6 @@ <<: *training_mercenary 4: <<: *training_mercenary - health: 150 + health: 40 experience: 150 skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} diff --git a/server/gamedata/npc_combat_test.go b/server/gamedata/npc_combat_test.go @@ -78,16 +78,16 @@ func TestNPCLevelAnchorsRejectAmbiguousIntermediateIdentity(t *testing.T) { } func TestProductionNPCGrowthRetainsBaselineAndStopsAtReviewedBoundary(t *testing.T) { - expected := []struct{ health, skill, qualityLow, qualityHigh int32 }{ - {100, 5, 1, 1}, {100, 5, 1, 3}, {125, 10, 2, 4}, {150, 15, 3, 5}, {175, 20, 4, 6}, - {200, 25, 5, 7}, {225, 30, 6, 8}, {250, 35, 7, 9}, {275, 40, 8, 10}, {300, 45, 9, 11}, + expected := []struct{ health, experience, skill, qualityLow, qualityHigh int32 }{ + {20, 100, 5, 1, 1}, {20, 100, 5, 1, 3}, {30, 125, 10, 2, 4}, {40, 150, 15, 3, 5}, {50, 175, 20, 4, 6}, + {60, 200, 25, 5, 7}, {70, 225, 30, 6, 8}, {80, 250, 35, 7, 9}, {90, 275, 40, 8, 10}, {100, 300, 45, 9, 11}, } profiles := NPCCombatProfiles[17655] for index, want := range expected { profile := profiles[uint16(index+1)] - if profile == nil || profile.Health != uint32(want.health) || profile.Experience != uint32(want.health) || + if profile == nil || profile.Health != uint32(want.health) || profile.Experience != uint32(want.experience) || !maps.Equal(profile.Skills, map[uint32]int32{100: want.skill, 153: want.skill, 154: want.skill, 155: want.skill, 168: want.skill}) || profile.Loot[0].Quality != [2]uint32{uint32(want.qualityLow), uint32(want.qualityHigh)} || profile.Weapon != [2]uint32{120910, 120911} { t.Fatal("production profile changed the declared bounded growth", index+1, profile) diff --git a/server/minibull_test.go b/server/minibull_test.go @@ -35,7 +35,7 @@ func TestMinibullPopulationRetainsAuthoredRangeAndNativeWeapon(t *testing.T) { } continue } - if npc.combatProfile != gamedata.NPCCombatProfiles[30360][level] || npc.health != 150+25*uint32(index) || + if npc.combatProfile != gamedata.NPCCombatProfiles[30360][level] || npc.health != 40+10*uint32(index) || npc.attackRating() != 15+5*int32(index) || !slices.Equal(npc.combatProfile.TemplateCodes, []string{"MB01"}) { t.Fatal("Minibull population lost its bounded profile", npc.id, npc.combatProfile) } diff --git a/server/mission_boundaries_test.go b/server/mission_boundaries_test.go @@ -153,7 +153,7 @@ func TestMissionBoundariesNanosRejectForeignWorldAndRefundDepartedTargets(t *tes } world.advanceNanos(client.nanoCast.readyAt.Add(time.Nanosecond)) if player.nano >= 100 || len(outputs[1].packets) != 0 || len(outputs[2].packets) == 0 || - friendly && len(target.activeNanos) != 1 || !friendly && target.health >= 100 { + friendly && len(target.activeNanos) != 1 || !friendly && target.health >= 20 { t.Fatal("clear same-world retry failed or broadcast into the other instance") } }) @@ -230,7 +230,7 @@ func TestMissionBoundariesCombatAndLootCannotReachAnotherWorld(t *testing.T) { t.Fatal(err) } - if player.fighting != 0 || world.characters[2000006].health != 100 || len(world.fighting) != 0 || len(outputs[1].packets) != 0 || len(outputs[2].packets) != 0 { + if player.fighting != 0 || world.characters[2000006].health != 20 || len(world.fighting) != 0 || len(outputs[1].packets) != 0 || len(outputs[2].packets) != 0 { t.Fatal("forged known-actor attack crossed the runtime world") } npc.health = 1 @@ -373,7 +373,7 @@ func TestMissionBoundariesRetirementEvacuatesGuestsAndPreservesTheOtherWorld(t * if world.characters[id] != nil || cold.characters[id] != nil { t.Fatal("retired mission actor survived a checkpoint", id) } - } else if cold.characters[id] == nil || cold.characters[id].health != 100 || cold.characters[id].playfield != 65537 { + } else if cold.characters[id] == nil || cold.characters[id].health != 20 || cold.characters[id].playfield != 65537 { t.Fatal("another world's original population changed", id) } } diff --git a/server/mission_encounter_lifecycle_test.go b/server/mission_encounter_lifecycle_test.go @@ -217,7 +217,7 @@ func TestMissionEncounterCompletionKeepsPopulationAndClaimedLoot(t *testing.T) { } } if len(current.characters[1].missions) != 0 || living != 4 || !current.missionExpiry[0].completed || - current.characters[2000000].health != 100 || current.characters[2000004].health != 0 || current.characters[2000004].corpse == nil || + current.characters[2000000].health != 20 || current.characters[2000004].health != 0 || current.characters[2000004].corpse == nil || current.characters[1].experience != 100 || current.characters[1].inventory.Credits != 25 || current.items[loot].Template != 42640 { t.Fatal("completion retired the population, repeated kill XP or lost claimed loot") } @@ -270,7 +270,7 @@ func TestMissionEncounterDifferentWorldRejectsCombatNanoAndLoot(t *testing.T) { after, readErr := readTestItemStore(world) if err != nil || readErr != nil || !reflect.DeepEqual(before, after) || player.fighting != 0 || client.nanoCast != nil || - player.nano != 30 || player.nanoReserved != 0 || player.experience != 100 || world.characters[2000003].health != 100 || + player.nano != 30 || player.nanoReserved != 0 || player.experience != 100 || world.characters[2000003].health != 20 || len(world.characters[2000004].corpse.items) != 1 || world.characters[2000004].corpse.credits != 1 { t.Fatal("private-world boundary admitted a stale target, cast or loot source", err, readErr) } @@ -304,7 +304,7 @@ func TestMissionEncounterRetirementRemovesHiddenSourcesWithoutTouchingAnotherWor for _, current := range []*server{world, cold} { if current.characters[hidden.id] != nil || len(current.npcRespawns) != 0 || current.characters[other.id] == nil || - current.characters[other.id].playfield != 65537 || current.characters[other.id].health != 100 || len(current.mobileNPCs[65537]) != 1 { + current.characters[other.id].playfield != 65537 || current.characters[other.id].health != 20 || len(current.mobileNPCs[65537]) != 1 { t.Fatal("retired hidden source returned or retirement changed another world's encounter") } } diff --git a/server/mission_encounters_test.go b/server/mission_encounters_test.go @@ -46,7 +46,7 @@ func TestMissionEncounterAcceptanceCommitsConcretePopulationAndRestoresIt(t *tes id := 2000000 + uint32(index) npc, restored := world.characters[id], cold.characters[id] if npc == nil || restored == nil || npc.id != id || npc.playfield != 65536 || npc.level != 1 || npc.monsterData != 17655 || - npc.name != "Leet" || npc.health != 100 || npc.position[0] != 15 || npc.position[2] != z || npc.combatProfile == nil || + npc.name != "Leet" || npc.health != 20 || npc.position[0] != 15 || npc.position[2] != z || npc.combatProfile == nil || npc.motion == nil || npc.motion.roaming || npc.motion.home != npc.position || npc.npcDefinitionID != "950/district/2/group/0/authored_point" || npc.worldState(true, time.Time{}) != restored.worldState(true, time.Time{}) { t.Fatal("selected encounter lost its admitted profile, placement or identity", id, npc, restored) diff --git a/server/mission_generation_test.go b/server/mission_generation_test.go @@ -69,7 +69,7 @@ func TestMissionGeneratedChamberKeepsExistingEncountersReachable(t *testing.T) { if err := world.saveInventory(player, player.inventory); err != nil { t.Fatal(err) } - world.combatRoll = func(uint32) uint32 { return 0 } + world.combatRoll = landedCombatRoll target := world.characters[2000000+uint32(index)] if err := world.handleCombat(client, attackPacket(1, target.id)[20:]); err != nil { @@ -77,7 +77,7 @@ func TestMissionGeneratedChamberKeepsExistingEncountersReachable(t *testing.T) { } world.advanceCombat(player.nextAttack) - if target.health == 0 || target.health >= 100 || player.inventory.Items[0].Ammo != 2 { + if target.health == 0 || target.health >= 20 || player.inventory.Items[0].Ammo != 2 { t.Fatal("alternate chamber blocked an admitted encounter", target.position, target.health, player.inventory) } }) diff --git a/server/mission_levels_test.go b/server/mission_levels_test.go @@ -114,7 +114,7 @@ func TestMissionSelectedEncounterLevelsAndQualitySurviveRecipeAndPlayerChanges(t } for _, id := range []uint32{2000000, 2000001} { npc := cold.characters[id] - if npc.level != 2 || npc.combatProfile != gamedata.NPCCombatProfiles[17655][2] || npc.health != 100 { + if npc.level != 2 || npc.combatProfile != gamedata.NPCCombatProfiles[17655][2] || npc.health != 20 { t.Fatal("selected encounter level did not survive cold load", npc) } var level uint16 diff --git a/server/mission_placement_test.go b/server/mission_placement_test.go @@ -26,7 +26,7 @@ func TestFixedMissionEncounterPlacementsAdmitClearCombatAndRejectWalls(t *testin if err := world.saveInventory(player, player.inventory); err != nil { t.Fatal(err) } - world.combatRoll = func(uint32) uint32 { return 0 } + world.combatRoll = landedCombatRoll if err := world.handleCombat(client, attackPacket(1, npc.id)[20:]); err != nil { t.Fatal(err) @@ -38,10 +38,10 @@ func TestFixedMissionEncounterPlacementsAdmitClearCombatAndRejectWalls(t *testin cold := reloadMissionEntranceWorld(t) if scenario.blocked { - if npc.health != 100 || cold.characters[npc.id].health != 100 || world.items[player.inventory.LastID].Ammo != 3 || cold.items[player.inventory.LastID].Ammo != 3 { + if npc.health != 20 || cold.characters[npc.id].health != 20 || world.items[player.inventory.LastID].Ammo != 3 || cold.items[player.inventory.LastID].Ammo != 3 { t.Fatal("a wall allowed damage or an ammunition cost", npc.health) } - } else if npc.health == 0 || npc.health >= 100 || cold.characters[npc.id].health != npc.health || world.items[player.inventory.LastID].Ammo != 2 || cold.items[player.inventory.LastID].Ammo != 2 { + } else if npc.health == 0 || npc.health >= 20 || cold.characters[npc.id].health != npc.health || world.items[player.inventory.LastID].Ammo != 2 || cold.items[player.inventory.LastID].Ammo != 2 { t.Fatal("accepted encounter could not receive an ordinary clear-path hit", npc.position, npc.health) } var kills int diff --git a/server/npc_activity_test.go b/server/npc_activity_test.go @@ -12,7 +12,7 @@ func TestNPCActivitySkipsDistantAndUnavailablePlayers(t *testing.T) { t.Run(scenario, func(t *testing.T) { world, _, start := newNPCPursuitWorld(t) npc := world.characters[1000000] - npc.health = 50 + npc.health = 10 switch scenario { case "distant": world.characters[1].position = [3]float32{202, 0, 0} @@ -47,7 +47,7 @@ func TestNPCActivitySkipsDistantAndUnavailablePlayers(t *testing.T) { func TestNPCActivityResumesNearAnyPlayerWithoutMovementCatchup(t *testing.T) { world, _, start := newNPCPursuitWorld(t) npc := world.characters[1000000] - npc.fighting, npc.health = 0, 50 + npc.fighting, npc.health = 0, 10 delete(world.fighting, npc.id) npc.motion.moving, npc.motion.returning = true, true npc.motion.home = [3]float32{21, 0, 0} @@ -61,7 +61,7 @@ func TestNPCActivityResumesNearAnyPlayerWithoutMovementCatchup(t *testing.T) { world.advanceRegeneration(start.Add(time.Hour)) world.advanceRegeneration(start.Add(time.Hour + 2*time.Second)) - if before != [3]float32{1, 0, 0} || npc.position[0] <= 1 || npc.position[0] > 2.125 || npc.health != 51 { + if before != [3]float32{1, 0, 0} || npc.position[0] <= 1 || npc.position[0] > 2.125 || npc.health != 11 { t.Fatal("nearby observer did not resume bounded motion and recovery", before, npc.position, npc.health) } } diff --git a/server/npc_combat_test.go b/server/npc_combat_test.go @@ -82,7 +82,7 @@ func TestNPCProfileNativeSpawnUsesLeetBiteAfterRestart(t *testing.T) { health = state.characters[1000000].health return nil })) - if health != map[uint16]uint32{1: 100, 2: 100, 6: 200, 10: 300}[level] { + if health != map[uint16]uint32{1: 20, 2: 20, 6: 60, 10: 100}[level] { t.Fatal("profile did not initialize the NPC's health") } if err := shutdown(); err != nil { diff --git a/server/npc_engagement_range_test.go b/server/npc_engagement_range_test.go @@ -63,7 +63,7 @@ func TestProfiledNPCRetainsEngagementOutsideWeaponRange(t *testing.T) { func TestFixedNPCRangedEngagementUsesCombatRecovery(t *testing.T) { world, _ := newRangedWorld(t) player, npc := world.characters[1], world.characters[1000000] - npc.monsterData, npc.level, npc.health = 30354, 4, 100 + npc.monsterData, npc.level, npc.health = 30354, 4, 20 npc.combatProfile = gamedata.NPCCombatProfiles[30354][4] if err := world.handleCombat(world.clients[1], attackPacket(1, npc.id)[20:]); err != nil { t.Fatal(err) diff --git a/server/npc_fallback_placement_test.go b/server/npc_fallback_placement_test.go @@ -63,7 +63,7 @@ func TestFallbackNPCsUseDryDistrictCellsWithoutChangingSourcePoints(t *testing.T restored := newTestInventoryServer(t) respawn := restored.characters[world.nextNPC-1] - if respawn.position != [3]float32{130, 14, 98} || respawn.motion.home != respawn.position || respawn.health != 100 { + if respawn.position != [3]float32{130, 14, 98} || respawn.motion.home != respawn.position || respawn.health != 20 { t.Fatal("respawn or cold recovery lost the dry home", respawn.position, respawn.motion.home) } } diff --git a/server/npc_growth_test.go b/server/npc_growth_test.go @@ -13,8 +13,8 @@ func TestMissionEarlyGrowthLevelsSurviveColdAcceptance(t *testing.T) { rating int32 credits uint32 }{ - {3, 125, 10, 7}, {4, 150, 15, 6}, {5, 175, 20, 5}, {6, 200, 25, 4}, - {7, 225, 30, 3}, {8, 250, 35, 2}, {9, 275, 40, 1}, {10, 300, 45, 0}, + {3, 30, 10, 7}, {4, 40, 15, 6}, {5, 50, 20, 5}, {6, 60, 25, 4}, + {7, 70, 30, 3}, {8, 80, 35, 2}, {9, 90, 40, 1}, {10, 100, 45, 0}, } { t.Run(fmt.Sprint(expected.level), func(t *testing.T) { world, _ := newMissionOfferWorld(t) @@ -99,7 +99,7 @@ func TestNPCProfileFoundationsUseExistingRatingAndArmorConsumers(t *testing.T) { defense := npc.weaponRating(npc.attackWeapon(), 13) armor := npc.equipmentBonus(91) - if npc.maximumHealth() != 150 || attack != 20 || defense != 22 || armor != 20 || npc.baseStats().Speed.NanoResist != 15 || + if npc.maximumHealth() != 40 || attack != 20 || defense != 22 || armor != 20 || npc.baseStats().Speed.NanoResist != 15 || npc.baseStats().Speed.DodgeRanged != 15 || npc.baseStats().Speed.DuckExplosions != 15 || len(gamedata.NPCCombatProfiles[17655][4].Modifiers) != 0 { t.Fatal("NPC foundations gained player trickle, bypassed consumers or changed shared data", attack, defense, armor, npc.baseStats().Speed) } diff --git a/server/npc_levels_test.go b/server/npc_levels_test.go @@ -91,7 +91,7 @@ func TestNPCLevelTwoUsesInterpolatedBiteForBothObservers(t *testing.T) { damage = append(damage, binary.BigEndian.Uint32(packet[29:33])) } } - if !slices.Equal(damage, []uint32{9, 9}) || player.health != 16 || npc.maximumHealth() != 100 || npc.nextAttack != start.Add(8750*time.Millisecond) { + if !slices.Equal(damage, []uint32{9, 9}) || player.health != 16 || npc.maximumHealth() != 20 || npc.nextAttack != start.Add(8750*time.Millisecond) { t.Fatal("level-2 profile did not use QL2 damage, selected resources and catalog timing", damage, player.health, npc.maximumHealth(), npc.nextAttack.Sub(start)) } if itemStat(gamedata.ItemTemplates[120910], 285) != 8 || itemStat(gamedata.ItemTemplates[120911], 285) != 406 { diff --git a/server/npc_outdoor_surface_test.go b/server/npc_outdoor_surface_test.go @@ -79,7 +79,7 @@ func TestNPCOutdoorReturnLeavesWaterAndRetainsHomeAfterColdLoad(t *testing.T) { } if returning.motion.returning || returning.motion.moving || returning.movement.deepWater || returning.movement.components[0] != 2 || - math.Abs(float64(returning.position[0]-130)) >= 1 || returning.position[1] < 13.3 || returning.motion.home != [3]float32{130, 14, 98} || returning.health != 100 { + math.Abs(float64(returning.position[0]-130)) >= 1 || returning.position[1] < 13.3 || returning.motion.home != [3]float32{130, 14, 98} || returning.health != 20 { t.Fatal("cold return did not leave water at its retained home", returning.position, returning.motion, returning.movement) } } diff --git a/server/npc_population_levels_test.go b/server/npc_population_levels_test.go @@ -27,7 +27,7 @@ func TestNPCPopulationStartupIncludesBothStarterLeetLevelsAfterRestart(t *testin npc := cold.characters[id] if npc != nil && npc.npcDefinitionID == "950/district/1/group/1/authored_point" { after = append(after, npc.level) - if npc.combatProfile == nil || npc.maximumHealth() != 100 { + if npc.combatProfile == nil || npc.maximumHealth() != 20 { t.Fatal("starter level lost its exact combat profile", npc.level) } } @@ -149,7 +149,7 @@ func TestNPCPopulationSecondLevelRetainsSelectedLifeThroughRespawn(t *testing.T) for _, current := range []*server{world, cold} { npc := current.characters[1000002] - if npc == nil || npc.level != 2 || npc.combatProfile != gamedata.NPCCombatProfiles[17655][2] || npc.health != 100 || npc.npcDefinitionID != "test/npc" || npc.position != [3]float32{54, 14, 56} { + if npc == nil || npc.level != 2 || npc.combatProfile != gamedata.NPCCombatProfiles[17655][2] || npc.health != 20 || npc.npcDefinitionID != "test/npc" || npc.position != [3]float32{54, 14, 56} { t.Fatal("replacement lost the selected level, profile or authored position", npc) } if current.characters[1000001].level != 2 || current.characters[1000001].corpse == nil || len(current.npcRespawns) != 0 { diff --git a/server/npc_regeneration_test.go b/server/npc_regeneration_test.go @@ -14,7 +14,10 @@ func newNPCRegenerationWorld(t *testing.T) (*server, *combatTestConn, time.Time) world, conn := newCombatWorld(t) world.characters[1000000].monsterData = 17655 world.characters[1000000].level = 1 - world.characters[1000000].combatProfile = gamedata.NPCCombatProfiles[17655][1] + // Leave room for recovery independently of production encounter health. + profile := *gamedata.NPCCombatProfiles[17655][1] + profile.Health = 100 + world.characters[1000000].combatProfile = &profile world.characters[1000000].health = 20 start := time.Unix(100, 0) // Keep player recovery out of the NPC packet assertions. diff --git a/server/npc_shared_pursuit_test.go b/server/npc_shared_pursuit_test.go @@ -179,7 +179,7 @@ func TestFixedNPCRespawnUsesHomeAndKeepsIdlePolicy(t *testing.T) { replacement := cold.characters[world.nextNPC-1] if replacement == nil || replacement.id == npc.id || replacement.position != [3]float32{1, 0, 0} || replacement.motion.roaming || - replacement.motion.moving || replacement.motion.returning || replacement.health != 100 || len(cold.mobileNPCs[952]) != 1 || cold.characters[npc.id].health != 0 { + replacement.motion.moving || replacement.motion.returning || replacement.health != 20 || len(cold.mobileNPCs[952]) != 1 || cold.characters[npc.id].health != 0 { t.Fatal("fixed respawn reused corpse position, wandered or lost its separate life", replacement) } } diff --git a/server/omni_training_boss_test.go b/server/omni_training_boss_test.go @@ -35,7 +35,7 @@ func TestOmniTrainingBossIsTheOnlyAdmittedAquaanPopulation(t *testing.T) { for _, current := range []*server{world, cold} { npc := current.characters[1000000] - if npc.name != "Aquaan Boss" || npc.level != 4 || npc.monsterData != 30369 || npc.health != 150 || + if npc.name != "Aquaan Boss" || npc.level != 4 || npc.monsterData != 30369 || npc.health != 40 || npc.combatProfile == nil || npc.attackRating() != 15 || itemStat(npc.attackWeapon(), 286) != 7 || itemStat(npc.attackWeapon(), 285) != 16 || npc.motion == nil || npc.motion.home != npc.position || npc.motion.returning { t.Fatal("authored Omni boss lost its explicit combat contract", npc) diff --git a/server/profession_checkpoint_combat_test.go b/server/profession_checkpoint_combat_test.go @@ -183,7 +183,7 @@ func TestProfessionCheckpointsFightAndRecover(t *testing.T) { if err := world.handleCombat(client, n3Packet(0x76793f0d, 50000, player.id, binary.BigEndian.AppendUint32(nil, 100))[20:]); err != nil { t.Fatal(err) } - if target.level != level || target.health != map[uint16]uint32{5: 175, 10: 300}[level] { + if target.level != level || target.health != map[uint16]uint32{5: 50, 10: 100}[level] { t.Fatal("checkpoint encounter is not full health", target.level, target.health) } if err := world.handleCombat(client, attackPacket(player.id, target.id)[20:]); err != nil { diff --git a/server/reet_test.go b/server/reet_test.go @@ -26,8 +26,8 @@ func TestReetStarterPopulationsRetainProfilesAndNativeWeapons(t *testing.T) { for index := range data.Playfields[0].Districts[0].Groups[0].Positions { npc := current.characters[1000000+uint32(index)] if npc.name != "Reet of Paradise" || npc.monsterData != 30365 || npc.level < 1 || npc.level > 2 || - npc.combatProfile == nil || !slices.Equal(npc.combatProfile.TemplateCodes, []string{"RT01", "RT02"}) || npc.maximumHealth() != 100 || - npc.health != 100 || npc.attackRating() != 5 || itemStat(npc.attackWeapon(), 286) != 4 || + npc.combatProfile == nil || !slices.Equal(npc.combatProfile.TemplateCodes, []string{"RT01", "RT02"}) || npc.maximumHealth() != 20 || + npc.health != 20 || npc.attackRating() != 5 || itemStat(npc.attackWeapon(), 286) != 4 || itemStat(npc.attackWeapon(), 285) != uint32(8+npc.level) { t.Fatal("original Reet population lost its bounded profile, level or weapon", npc.id, npc.level, npc.combatProfile) } diff --git a/server/respawn_durability_test.go b/server/respawn_durability_test.go @@ -95,7 +95,7 @@ func TestNPCRespawnFailureKeepsPendingLifeAndRetriesOnce(t *testing.T) { world.advanceNPCRespawns(due.Add(3 * time.Second)) afterRetry := newTestInventoryServer(t) - if world.characters[1000003] == nil || world.characters[1000003].health != 100 || len(world.npcRespawns) != 0 || + if world.characters[1000003] == nil || world.characters[1000003].health != 20 || len(world.npcRespawns) != 0 || world.nextNPC != 1000004 || world.mobileNPCs[950][0].id != 1000003 || len(conn.packets) != 2 || afterRetry.characters[1000003] == nil || len(afterRetry.npcRespawns) != 0 || afterRetry.nextNPC != 1000004 { t.Fatal("retry did not create and commit exactly one fresh life") diff --git a/server/respawn_test.go b/server/respawn_test.go @@ -60,7 +60,7 @@ func TestNPCRespawnCreatesOneFreshLifeAtHomeForBothObservers(t *testing.T) { if replacement == nil || len(world.characters) != 4 || len(world.npcRespawns) != 0 || world.nextNPC != 1000002 { t.Fatal("respawn did not create exactly one replacement") } - if replacement.health != 100 || replacement.corpse != nil || replacement.fighting != 0 || + if replacement.health != 20 || replacement.corpse != nil || replacement.fighting != 0 || !replacement.nextAttack.IsZero() || !replacement.rechargeUntil.IsZero() || replacement.position != [3]float32{52, 14, 56} || replacement.rotation != [4]float32{0, 0, 0, 1} || replacement.motion.home != [3]float32{52, 14, 56} || replacement.motion.moving || !replacement.motion.nextMove.IsZero() || @@ -111,7 +111,7 @@ func TestNPCRespawnWithoutObserversThenReentryAndRestart(t *testing.T) { if spawns != 1 || corpses != 1 || profiles != 1 { t.Fatalf("reentry lost the living replacement or old corpse: %d/%d/%d", spawns, corpses, profiles) } - if len(restarted.characters) != 3 || restarted.characters[1000001].health != 100 || + if len(restarted.characters) != 3 || restarted.characters[1000001].health != 20 || restarted.characters[1000000].corpse == nil || len(restarted.npcRespawns) != 0 || len(restarted.mobileNPCs[950]) != 1 || restarted.mobileNPCs[950][0].id != 1000001 { t.Fatal("restart lost the living replacement, old remains or consumed respawn deadline") @@ -140,7 +140,7 @@ func TestNPCRespawnConcurrentTicksAndStaleCombatKeepLifeSeparate(t *testing.T) { world.handleCombat(world.clients[1], attackPacket(1, 1000000)[20:]) world.advanceCombat(killed.Add(time.Hour)) - if len(world.characters) != 3 || world.characters[1000001].health != 100 || + if len(world.characters) != 3 || world.characters[1000001].health != 20 || world.characters[1].fighting != 0 || len(world.fighting) != 0 || len(world.npcRespawns) != 0 || world.nextNPC != 1000002 { t.Fatal("concurrent timers or a stale request duplicated or attacked the new life") } @@ -184,7 +184,7 @@ func TestNPCRespawnKeepsOldLootSeparateAcrossTwoKills(t *testing.T) { world.advanceNPCRespawns(secondKill.Add(100 * time.Second)) world.advanceNPCRespawns(secondKill.Add(time.Hour)) - if len(world.characters) != 4 || world.characters[1000002].health != 100 || world.characters[1000002].corpse != nil || + if len(world.characters) != 4 || world.characters[1000002].health != 20 || world.characters[1000002].corpse != nil || len(world.npcRespawns) != 0 || len(world.mobileNPCs[950]) != 1 || world.mobileNPCs[950][0].id != 1000002 { t.Fatal("a second death did not produce exactly one fresh living replacement") } diff --git a/server/starter_balance_test.go b/server/starter_balance_test.go @@ -0,0 +1,77 @@ +package main + +import ( + "fmt" + "math/rand/v2" + "net/http" + "testing" + "time" +) + +func TestFreshStarterPistolCanDefeatEarlyEnemies(t *testing.T) { + for _, enemy := range []struct { + code string + monster uint32 + level uint16 + }{ + {"LEET", 17655, 1}, {"LEET", 17655, 2}, {"RT01", 30365, 1}, + {"RR01", 17687, 1}, {"SN01", 30252, 1}, {"LZ01", 22794, 1}, + {"BB01", 40075, 1}, {"SR01", 17708, 2}, + } { + t.Run(fmt.Sprintf("%s/%d", enemy.code, enemy.level), func(t *testing.T) { + wins := 0 + var total time.Duration + for seed := uint64(1); seed <= 20; seed++ { + t.Run(fmt.Sprint(seed), func(t *testing.T) { + // Create an untrained character beside one admitted starter enemy. + data := testNPCData() + group := &data.Playfields[0].Districts[0].Groups[0] + group.TemplateCode, group.MonsterData = enemy.code, enemy.monster + group.Levels, group.AppearanceStatus = [2]uint16{enemy.level, enemy.level}, "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", "10") + if response := creationRequest(world, accountVisitor(t, world), fields); response.Code != http.StatusNoContent { + t.Fatal(response.Code, response.Body.String()) + } + player, target := world.characters[2], world.characters[1000000] + client := &worldClient{id: 2, conn: &combatTestConn{}, ready: true, target: true, npcs: map[uint32]bool{1000000: true}} + world.clients[2] = client + if err := world.handleInventory(client, inventoryMovePacket(2, 67, 6)[20:]); err != nil || client.equipment == nil { + t.Fatal("equip issued pistol", err) + } + world.advanceEquipment(client.equipment.readyAt) + world.combatRoll = rand.New(rand.NewPCG(seed, 2)).Uint32N + + // Ordinary attacks at default aggression, without training, nanos or healing. + if err := world.handleCombat(client, attackPacket(2, target.id)[20:]); err != nil { + t.Fatal(err) + } + started := player.nextAttack + now := started + for tick := 0; tick < 600 && player.health > 0 && target.health > 0; tick++ { + world.advanceCombat(now) + now = now.Add(100 * time.Millisecond) + } + + // Count completed kills while retaining the ordinary starting resources. + if target.maximumHealth() != 20 || player.maximumHealth() != 34 || player.stats.ImprovementPoints != 1500 { + t.Fatal("fixture must use fresh, untrained player and reduced enemy health") + } + if player.health > 0 && target.health == 0 && player.experience == 100 { + wins++ + total += now.Sub(started) + } + }) + } + t.Logf("%d/20 wins; mean successful fight after first swing %s", wins, total/time.Duration(max(1, wins))) + if wins < 18 || total/time.Duration(max(1, wins)) > 30*time.Second { + t.Fatal("ordinary starter fights must be forgiving and short") + } + }) + } +} diff --git a/server/starter_boss_test.go b/server/starter_boss_test.go @@ -22,7 +22,7 @@ func TestStarterBossAuthoredSpawnHasUsefulSelectedQualityLoot(t *testing.T) { } if spawn.monsterData != 30354 || spawn.level != 4 || spawn.position != [3]float32{186.06424, 13.7, 182.79846} || spawn.combatProfile == nil || - spawn.combatProfile.Health != 100 || spawn.combatProfile.Experience != 100 || spawn.combatProfile.Weapon != [2]uint32{121063, 121064} || + spawn.combatProfile.Health != 20 || spawn.combatProfile.Experience != 100 || spawn.combatProfile.Weapon != [2]uint32{121063, 121064} || !reflect.DeepEqual(spawn.combatProfile.Loot, []gamedata.NPCLoot{{Template: 85596, Quality: [2]uint32{4, 4}, Chance: 50}, {Template: 123742, Quality: [2]uint32{4, 4}, Chance: 25}}) { t.Fatal("authored starter boss has no isolated, level-appropriate equipment profile", spawn.combatProfile) } @@ -184,10 +184,14 @@ func TestStarterBossCodeRecheckedOnColdLoadAndReplacement(t *testing.T) { cold := newTestInventoryServer(t) cold.advanceNPCRespawns(death.Add(100 * time.Second)) respawned := newTestInventoryServer(t) + health := uint32(20) + if changed { + health = 100 + } for _, current := range []*server{cold, respawned} { if len(current.characters[1000000].corpse.items) != 2 || current.characters[player.id].experience != 100 || current.nextItem != 2 || - (current.characters[1000000].combatProfile != nil) == changed || (current.characters[1000001].combatProfile != nil) == changed || current.characters[1000001].health != 100 { + (current.characters[1000000].combatProfile != nil) == changed || (current.characters[1000001].combatProfile != nil) == changed || current.characters[1000001].health != health { t.Fatal("code change leaked a boss profile or erased already committed rewards") } } diff --git a/server/starter_combat_paths_test.go b/server/starter_combat_paths_test.go @@ -124,7 +124,7 @@ func TestCreatedProfessionsFightAndRecoverWithIssuedKits(t *testing.T) { started := now // Normal hit/miss, critical and damage rules use a repeatable random stream. - if target.health != 100 { + if target.health != 20 { t.Fatal("starter encounter was not full health", target.health) } if err := world.handleCombat(client, attackPacket(2, target.id)[20:]); err != nil { @@ -169,7 +169,7 @@ func TestCreatedProfessionsFightAndRecoverWithIssuedKits(t *testing.T) { if err := world.flushWorld(); err != nil { t.Fatal(err) } - cold := newTestInventoryServer(t).characters[player.id] + cold := newServerForTest(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]) { diff --git a/server/starter_fauna_test.go b/server/starter_fauna_test.go @@ -51,7 +51,7 @@ func TestStarterFaunaPopulationsRecoverProfilesAndNativeWeapons(t *testing.T) { for index, level := range scenario.levels { npc := current.characters[1000000+uint32(index)] if npc.monsterData != scenario.monster || npc.level != level || npc.combatProfile != gamedata.NPCCombatProfiles[scenario.monster][level] || - npc.health != []uint32{100, 100, 125, 150}[level-1] || npc.attackRating() != []int32{5, 5, 10, 15}[level-1] || + npc.health != []uint32{20, 20, 30, 40}[level-1] || npc.attackRating() != []int32{5, 5, 10, 15}[level-1] || itemStat(npc.attackWeapon(), 286) != scenario.damage[index][0] || itemStat(npc.attackWeapon(), 285) != scenario.damage[index][1] || !slices.Contains(npc.combatProfile.TemplateCodes, data.Playfields[0].Districts[0].Groups[0].TemplateCode) { t.Fatal("starter population lost its authored level, identity or shared profile", npc.id, npc.level, npc.combatProfile) diff --git a/server/starter_level_test.go b/server/starter_level_test.go @@ -85,7 +85,7 @@ func TestCreatedEnforcerEarnsFirstAbilityCapWithoutSeededExperience(t *testing.T world.advanceCorpseExpiry(now) npc = world.characters[world.nextNPC-1] } - if player.health != 84 || npc == nil || npc.health != 100 || npc.corpse != nil { + if player.health != 84 || npc == nil || npc.health != 20 || npc.corpse != nil { t.Fatal("ordinary recovery/respawn did not prepare a full-health encounter", index, player.health, npc) } if err := world.handlePosture(client, characterActionPacket(2, [5]uint32{87})[20:]); err != nil { diff --git a/server/tiny_stalker_test.go b/server/tiny_stalker_test.go @@ -27,7 +27,7 @@ func TestTinyStalkerPopulationProfilesRecoverNativeWeapons(t *testing.T) { rating int32 low uint32 high uint32 - }{{2, 100, 5, 4, 10}, {3, 125, 10, 4, 11}, {4, 150, 15, 4, 12}, {2, 100, 5, 4, 10}} { + }{{2, 20, 5, 4, 10}, {3, 30, 10, 4, 11}, {4, 40, 15, 4, 12}, {2, 20, 5, 4, 10}} { npc := current.characters[1000000+uint32(index)] if npc.name != "Tiny Stalker" || npc.monsterData != 17708 || npc.level != expected.level || npc.health != expected.health || npc.combatProfile == nil || !slices.Equal(npc.combatProfile.TemplateCodes, []string{"SR01"}) || npc.attackRating() != expected.rating || diff --git a/server/training_humans_test.go b/server/training_humans_test.go @@ -111,7 +111,7 @@ func TestTrainingHumanKillsPersistRewardsAcrossAttackPaths(t *testing.T) { if attack == "unarmed" { cold.advanceNPCRespawns(cold.npcRespawns[0].at) replacement := newTestInventoryServer(t).characters[1000010] - if replacement == nil || replacement.health != 100 || replacement.corpse != nil || + if replacement == nil || replacement.health != 20 || replacement.corpse != nil || replacement.combatProfile != target.combatProfile || len(replacement.inventory.Items) != 5 || replacement.headMesh != 40252 || replacement.inventory.Items[0].ID != 0 { t.Fatal("respawn lost human appearance/profile or allocated wearable loot", replacement) diff --git a/tools/client/test_combat_facing.mjs b/tools/client/test_combat_facing.mjs @@ -45,7 +45,7 @@ try { actor(game).combatTarget === target && angle(actor(game).rotation, evidence.initial.server.rotation) > 3))); evidence.turned = await capture(); assert.deepEqual(evidence.turned.server.position, evidence.initial.server.position); - assert.equal(evidence.turned.server.targetHealth, 100); + assert.equal(evidence.turned.server.targetHealth, 20); evidence.turnMovement = owner.events.filter(event => event.sequence > attack && event.direction === 'framesent' && event.opcode === '54111123'); assert.equal(evidence.turnMovement.length, 0); @@ -93,7 +93,7 @@ try { await Promise.all(games.map(game => game.wait('releasing forward permits original combat auto-turn', () => actor(game).combatTarget === target && angle(actor(game).rotation, evidence.aligned.clients[0].rotation) > 3))); evidence.forwardTurned = await capture(); - assert.equal(evidence.forwardTurned.server.targetHealth, 100); + assert.equal(evidence.forwardTurned.server.targetHealth, 20); assert(!owner.events.some(event => event.sequence > released && event.direction === 'framesent' && event.opcode === '54111123')); await owner.key('KeyQ'); await Promise.all(games.map(game => game.wait('second real stop ends the held encounter', () => actor(game).combatTarget === 0))); diff --git a/tools/client/test_faction_progression.mjs b/tools/client/test_faction_progression.mjs @@ -44,7 +44,7 @@ try { if (!game.state.camera.firstPerson) await game.key('F8'); const initial = evidence.initial = await server(); if (initial.phase === 0) { - assert.equal(initial.targetHealth, 100); + assert.equal(initial.targetHealth, 20); assert.equal(initial.level, 1); await frame(50000, initial.target); await game.click(...await game.pick(50000, initial.target)); diff --git a/tools/client/test_fallback_placement.mjs b/tools/client/test_fallback_placement.mjs @@ -23,7 +23,7 @@ try { } const [owner] = games; evidence.initial = await state(); - assert.equal(evidence.initial.health, 100); + assert.equal(evidence.initial.health, 20); if (!owner.state.camera.firstPerson) await owner.key('F8'); // Tilt the real camera down the shore before asking the native picker to select. @@ -58,7 +58,7 @@ try { const deadline = Date.now()+12000; for (;;) { evidence.hit = await state(); - if (evidence.hit.health < 100) break; + if (evidence.hit.health < 20) break; assert(Date.now() < deadline, 'Ordinary melee did not damage the fallback'); await owner.snapshot(); } diff --git a/tools/client/test_minibull.mjs b/tools/client/test_minibull.mjs @@ -25,10 +25,10 @@ try { const server = async () => (await owner.page.request.get(url + '/test-state')).json(); evidence.initial = await server(); const npc = evidence.initial.npc; - assert.equal(evidence.initial.maximum, 150); - assert.equal(evidence.initial.health, 150); + assert.equal(evidence.initial.maximum, 40); + assert.equal(evidence.initial.health, 40); await Promise.all(games.map(game => game.wait('full-health Minibull visible to both clients', () => - actor(game, 50000, npc)?.stats[27] === 150))); + actor(game, 50000, npc)?.stats[27] === 40))); await Promise.all(games.map((game, index) => game.save(output + '/spawn-' + index))); // Deterministic incoming combat isolates the original Headbutt presentation. diff --git a/tools/client/test_npc_water.mjs b/tools/client/test_npc_water.mjs @@ -40,14 +40,14 @@ try { const [owner] = games; evidence.initial = await state(); enemy = evidence.initial.enemy; - assert.equal(evidence.initial.health, 100); + assert.equal(evidence.initial.health, 20); assert.equal((await owner.page.request.post(url+'/test-roam')).status(), 204); evidence.roaming = await observe('roaming water entry on both replicas', sample => sample.server.position[0] > 132 && sample.server.mode === 4 && sample.server.deepWater && matches(sample)); evidence.roamed = await observe('roaming stops at the native water contact', sample => !sample.server.moving && matches(sample)); assert.equal((await owner.page.request.post(url+'/test-hold-roaming')).status(), 204); assert(evidence.roamed.server.position[1] > 13.4); - assert.equal(evidence.roamed.server.health, 100); + assert.equal(evidence.roamed.server.health, 20); await owner.save(output+'/roamed'); for (const game of games) { @@ -57,12 +57,12 @@ try { } evidence.replayed = await observe('water mode and contact survive both page reloads', sample => !sample.server.moving && sample.server.mode === 4 && matches(sample)); - assert.equal(evidence.replayed.server.health, 100); + assert.equal(evidence.replayed.server.health, 20); assert.equal((await owner.page.request.post(url+'/test-return')).status(), 204); evidence.returned = await observe('return leaves water and stops near home', sample => !sample.server.returning && !sample.server.moving && !sample.server.deepWater && sample.server.mode === 2 && matches(sample)); - assert.equal(evidence.returned.server.health, 100); + assert.equal(evidence.returned.server.health, 20); await owner.save(output+'/returned'); // Frame and select with real first-person mouse input before the melee approach. @@ -92,7 +92,7 @@ try { const returned = (await state()).position; await owner.walk(returned[0]-.75, returned[2]); await owner.key('KeyQ'); - evidence.hit = await observe('ordinary melee damages the returned actor', sample => sample.server.health < 100); + evidence.hit = await observe('ordinary melee damages the returned actor', sample => sample.server.health < 20); await owner.key('KeyQ'); await owner.wait('ordinary attack stops', () => owner.local().combatTarget === 0); await owner.walk(138, 98); diff --git a/tools/client/test_starter_combat_paths.mjs b/tools/client/test_starter_combat_paths.mjs @@ -20,7 +20,7 @@ try { 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.targetHealth, 20); assert.equal(evidence.before.experience, 0); assert.equal(evidence.before.health, evidence.before.maximumHealth); diff --git a/tools/client/test_starter_equipment.mjs b/tools/client/test_starter_equipment.mjs @@ -115,8 +115,8 @@ async function fight(game, enemy, label) { const healthyEnemy = beforeFight.enemies.find(actor => actor.id === enemy.id); assert.equal(beforeFight.health, beforeFight.maximumHealth); assert.equal(game.local().stats[27], beforeFight.maximumHealth); - assert.equal(healthyEnemy.health, 100); - assert.equal(healthyEnemy.maximumHealth, 100); + assert.equal(healthyEnemy.health, 20); + assert.equal(healthyEnemy.maximumHealth, 20); await game.save(output + '/' + label + '/fight-start'); await fs.writeFile(output + '/' + label + '/fight-start/server.json', JSON.stringify(beforeFight, null, 2)); const attack = game.sequence; @@ -229,7 +229,7 @@ async function fight(game, enemy, label) { async function outdoorFight(game, level, label) { const population = await (await game.page.request.get(url + '/test-state')).json(); const position = game.local().position; - const enemies = population.enemies.filter(enemy => enemy.level === level && enemy.health === 100); + const enemies = population.enemies.filter(enemy => enemy.level === level && enemy.health === 20); enemies.sort((a, b) => Math.hypot(a.position[0] - position[0], a.position[2] - position[2]) - Math.hypot(b.position[0] - position[0], b.position[2] - position[2])); const enemy = enemies[0]; @@ -430,7 +430,7 @@ try { await owner.ready(); const entered = await (await owner.page.request.get(url + '/test-state')).json(); assert.equal(entered.enemies.length, 5); - assert(entered.enemies.every(enemy => enemy.health === 100 && enemy.maximumHealth === 100)); + assert(entered.enemies.every(enemy => enemy.health === 20 && enemy.maximumHealth === 20)); assert.equal(entered.missions[0].layout, mission.layout); mission.objective = entered.missions[0].objective; const encounters = entered.enemies.sort((a, b) => (missionReversed ? -1 : 1) * (a.position[2] - b.position[2]));