Add biome revisions readable content and visible projectile outcomes

This commit is contained in:
dingo
2026-09-09 08:27:32 -04:00
parent 4a7979e32f
commit 70d08b0d32
24 changed files with 703 additions and 128 deletions
+29
View File
@@ -250,3 +250,32 @@ func TestRegionalSpawnsRespectExploredBiomeAndPlayerDistance(t *testing.T) {
t.Fatal("regional slot was missing or duplicated")
}
}
func TestProjectileSpeedSampleAndShortFlightEvents(t *testing.T) {
w, c, m := combatFixture(t)
dex, str := float64(2), float64(1)
weapon := &c.View.Items[len(c.View.Items)-1]
weapon.Attack.DexteritySpeed = &dex
weapon.Attack.StrengthSpeed = &str
c.View.Stats["dexterity"] = p.StatValue{Final: 5}
c.View.Stats["strength"] = p.StatValue{Final: 3}
m.Entity.Position = w.terrain.Position(2, 0)
if err := w.attack(c, m.Entity.ID); err != nil {
t.Fatal(err)
}
if len(w.ProjectileVisuals) != 1 || w.ProjectileVisuals[0].Phase != "launch" || w.ProjectileVisuals[0].Speed != 48 {
t.Fatal("wrong launch speed/event")
}
c.View.Stats["dexterity"] = p.StatValue{Final: 100}
w.updateCombat(.1)
if len(w.Projectiles) != 0 || len(w.ProjectileVisuals) != 2 || w.ProjectileVisuals[1].Outcome != "hit" {
t.Fatal("short flight lost its hit")
}
if w.ProjectileVisuals[1].Speed != 48 {
t.Fatal("stat change altered in-flight speed")
}
snapshot := w.Snapshot(c.View.Entity.ID, map[string]bool{})
if len(snapshot.ProjectileVisuals) != 2 {
t.Fatal("flight between snapshots became invisible")
}
}