You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
705 B
Go

package game
import (
"testing"
"time"
"github.com/denisovdennis/autohero/internal/tuning"
)
func TestAttackIntervalRespectsMinimumCap(t *testing.T) {
got := attackInterval(10.0)
cfg := tuning.Get()
want := time.Duration(cfg.MinAttackIntervalMs) * time.Millisecond * time.Duration(cfg.CombatPaceMultiplier)
if got != want {
t.Fatalf("expected min interval %s, got %s", want, got)
}
}
func TestAttackIntervalForNormalSpeed(t *testing.T) {
got := attackInterval(2.0)
// 1/2 s per attack at 2 APS, scaled by combatPaceMultiplier
cfg := tuning.Get()
want := 500 * time.Millisecond * time.Duration(cfg.CombatPaceMultiplier)
if got != want {
t.Fatalf("expected %s, got %s", want, got)
}
}