if (this(p) existBaseMaterialOf player) {
  val aroundTiles = Direction.all.map(_.p + p).filter(_.within(radius)).map(apply)
  1 + aroundTiles.count(tile => tile.ownedBy(player) && tile.installation.exists(_ == Installation.pit))
} else {
  0
}

でどうでしょ？