package gen

import (
	"fmt"

	"tinyadventure/internal/model"
)

func hilltop(m *model.Map, c [2]int) bool {
	return m.Hex(c[0], c[1])[0] == model.ShapeHill && summit(m, c)
}

func placeLandmarks(p *placer) []model.Landmark {
	var out []model.Landmark
	add := func(kind string, cs [][2]int) {
		for _, c := range cs {
			out = append(out, model.Landmark{ID: fmt.Sprintf("lm%d", len(out)+1), Kind: kind, X: c[0], Y: c[1]})
		}
	}
	add("lookout", p.take(5, 8, func(c [2]int) bool { return hilltop(p.m, c) }))
	add("shrine", p.take(3, 10, func([2]int) bool { return true }))
	add("cache", p.take(5, 6, func([2]int) bool { return true }))
	return out
}
