#pragma once

// -----------------------------------------------------------------------------
// flickshot.h
// -----------------------------------------------------------------------------
// Flickshot: a single press of CAPS LOCK performs one shot. The enemy
// closest to the crosshair inside the active area is aimed at on the
// currently selected aim bone, the view sweeps to it with the shared
// smoothing (fast steps, not an instant snap) and one shot is fired. The
// active area is the middle 3x3 block of a 4x4 screen grid (12.5%..87.5%
// of both axes); if it is empty nothing happens. The feature finishes
// after the click; unlike force aim it is not hold-to-work and has no
// on/off toggle.
// -----------------------------------------------------------------------------

#include "../core/memory.h"
#include "../core/offsets.h"
#include "../sdk/entitylist.h"
#include "../sdk/localplayer.h"

namespace features {

// One-shot flick on CAPS LOCK, running on its own thread.
class Flickshot
{
public:
	// Binds the memory reader, offsets, entity list and local player.
	void Initialize(const core::ProcessMemory* memory, const core::GameOffsets* offsets,
		const sdk::EntityList* entities, const sdk::LocalPlayer* player);

	// Starts the flickshot thread.
	void Start();

	// Thread entry point.
	static unsigned long __stdcall ThreadProc(void* param);

	// Performs one flick: aim at the best target and fire once.
	void ExecuteFlick();

	// Picks a random aim bone for the "Random" mode.
	int PickRandomBone();

private:
	const core::ProcessMemory* m_memory = nullptr;
	const core::GameOffsets* m_offsets = nullptr;
	const sdk::EntityList* m_entities = nullptr;
	const sdk::LocalPlayer* m_player = nullptr;
	bool m_lastDown = false;
};

} // namespace features
