# FarmLocation

# Description

A structure used to represent the optimal skill cast position to maximize minion kills.

# How to Use

// Get list of minion positions
std::vector<Vector> minionPositions;
auto minions = ObjectManager::Get_EnemyMinions();

for (auto minion : minions)
{
    if (minion->IsValid() && minion->IsVisible() && minion->IsTargetable() && 
        minion->Position().Distance(ObjectManager::Player()->Position()) <= 900.f)
    {
        minionPositions.push_back(minion->Position());
    }
}

// Get the best circular skill cast position
float spellRadius = 250.f;
float spellRange = 900.f;
FarmLocation bestCircularLocation = Utility::GetBestCircularFarmLocation(minionPositions, spellRadius, spellRange);

// Get the best linear skill cast position
float spellWidth = 80.f;
FarmLocation bestLineLocation = Utility::GetBestLineFarmLocation(minionPositions, spellWidth, spellRange);

// Use the results
if (bestCircularLocation.MinionsHit >= 3)
{
    // Cast circular skill at the best position
    ObjectManager::Player()->CastSpell(eSpellSlot::W, bestCircularLocation.Position);
}

if (bestLineLocation.MinionsHit >= 4)
{
    // Cast linear skill at the best position
    ObjectManager::Player()->CastSpell(eSpellSlot::Q, bestLineLocation.Position);
}

# Properties

Property Type Description
MinionsHit int Number of minions that can be hit
Position Vector Optimal cast position