# LockedTargetSelector

# Description

The LockedTargetSelector namespace provides locked target selector functionality, allowing players to lock onto a specific target and maintain that lock until the target is unlocked or no longer valid. This is particularly useful in team fights or combos, ensuring that skills and attacks are focused on the same target.

# How to Use

#include "Noble.h"

void OnGameUpdate()
{
    // Get the locked target within 800 range (if one is locked)
    AIBaseClient* target = LockedTargetSelector::GetTarget(800, eDamageType::Physical);
    
    if (target)
    {
        // There is a locked target, use skills to attack
        if (ObjectManager::Player()->GetSpell(eSpellSlot::Q)->IsReady())
        {
            // Use Q skill to attack the locked target
            ObjectManager::Player()->GetSpell(eSpellSlot::Q)->CastOnUnit(target);
        }
    }
    else
    {
        // No locked target, can use regular target selector to get a target
        target = TargetSelector::GetTarget(800, eDamageType::Physical);
        if (target)
        {
            // Found a target, can consider locking it (through other methods or features)
            Console::Add("Found a target: %s", target->ChampionName());
        }
    }
}

# GetTarget

AIBaseClient* LockedTargetSelector::GetTarget(float range, eDamageType damageType, bool ignoreShieldSpells = true, bool TargetBoundingRadius = false, std::vector<AIBaseClient*>const& ignoredChamps = {}, Vector rangeCheckFrom = Vector::Zero)

Gets the currently locked target, returns nullptr if the target is invalid or out of range.

Parameter Name Parameter Type Description
range float Check range
damageType eDamageType Damage type (physical, magical, or true damage)
ignoreShieldSpells bool Whether to ignore shield spells
TargetBoundingRadius bool Whether to consider the target's bounding radius
ignoredChamps std::vector<AIBaseClient*>const& List of champions to ignore
rangeCheckFrom Vector Starting position for range check, defaults to player position
// Get the locked target of physical damage type, considering a 900 unit range
AIBaseClient* lockedTarget = LockedTargetSelector::GetTarget(900, eDamageType::Physical);

if (lockedTarget)
{
    Console::Add("Current locked target: %s, health: %.1f", 
                 lockedTarget->ChampionName(), 
                 lockedTarget->Health());
}
else
{
    Console::Add("No locked target or target is out of range");
}

# UnlockTarget

void LockedTargetSelector::UnlockTarget()

Unlocks the currently locked target, allowing regular target selection to be used again.

// Unlock the current target
LockedTargetSelector::UnlockTarget();
Console::Add("Target unlocked");