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)
	}
}
