# TargetSelector

# Description

The TargetSelector namespace provides target selection functionality, allowing you to select the best attack target based on different conditions and strategies.

# How to Use

// Get the best attack target
AIBaseClient* target = TargetSelector::GetTarget(900.0f, eDamageType::Magical);
if (target && target->IsValidTarget()) {
    // Use the target...
}

// Set target selection mode
TargetSelector::SetMode(eTargetingMode::AutoPriority);

// Check if the target is immune to damage
if (!TargetSelector::IsInvulnerable(target, eDamageType::Magical)) {
    // Cast skill...
}

# GetMode

eTargetingMode GetMode()

Gets the current target selection mode.

eTargetingMode mode = TargetSelector::GetMode();
if (mode == eTargetingMode::LowHP) {
    // Current mode is low health priority
}

# GetPriority

float GetPriority(AIBaseClient* hero)

Gets the priority of a hero.

Parameter Name Parameter Type Description
hero AIBaseClient* Target hero
auto enemy = ObjectManager::GetEnemies()[0];
float priority = TargetSelector::GetPriority(enemy);

# GetSelectedTarget

AIBaseClient* GetSelectedTarget()

Gets the target manually selected by the player.

AIBaseClient* target = TargetSelector::GetSelectedTarget();
if (target && target->IsValidTarget()) {
    // Use the player-selected target
}

# GetTarget

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

Gets the best target according to the set target selection mode.

Parameter Name Parameter Type Description
range float Selection range
damageType eDamageType Damage type
ignoreShieldSpells bool Whether to ignore shield spells
TargetBoundingRadius bool Whether to consider target collision volume
ignoredChamps std::vector<AIBaseClient*> const& List of ignored heroes
rangeCheckFrom Vector Range check starting point
AIBaseClient* target = TargetSelector::GetTarget(900.0f, eDamageType::Magical);
if (target) {
    // Use the selected target
}

# GetTarget

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

Gets the best target from the position of a specified hero.

Parameter Name Parameter Type Description
champion AIBaseClient* Reference hero
range float Selection range
damageType eDamageType Damage type
ignoreShieldSpells bool Whether to ignore shield spells
TargetBoundingRadius bool Whether to consider target collision volume
ignoredChamps std::vector<AIBaseClient*> const& List of ignored heroes
rangeCheckFrom Vector Range check starting point
auto ally = ObjectManager::GetAllies()[0];
AIBaseClient* target = TargetSelector::GetTarget(ally, 800.0f, eDamageType::Physical);
if (target) {
    // Use the selected target
}

# IsInvulnerable

bool IsInvulnerable(AIBaseClient* target, eDamageType damageType, bool ignoreShields = true)

Determines if the target is invulnerable or immune to a specific damage type.

Parameter Name Parameter Type Description
target AIBaseClient* Target unit
damageType eDamageType Damage type
ignoreShields bool Whether to ignore shields
auto target = TargetSelector::GetTarget(900.0f, eDamageType::Magical);
if (target && !TargetSelector::IsInvulnerable(target, eDamageType::Magical)) {
    // Target can take magical damage
}

# SetMenu_OnlyAttackSelectedTarget

void SetMenu_OnlyAttackSelectedTarget(bool v)

Sets whether to only attack the selected target.

Parameter Name Parameter Type Description
v bool Whether to enable
// Enable only attacking selected target
TargetSelector::SetMenu_OnlyAttackSelectedTarget(true);

// Disable only attacking selected target
TargetSelector::SetMenu_OnlyAttackSelectedTarget(false);

# SetMode

void SetMode(eTargetingMode mode)

Sets the target selection mode.

Parameter Name Parameter Type Description
mode eTargetingMode Target selection mode
// Set to auto priority mode
TargetSelector::SetMode(eTargetingMode::AutoPriority);

// Set to closest distance mode
TargetSelector::SetMode(eTargetingMode::Closest);

# SetTarget

void SetTarget(AIBaseClient* hero)

Manually sets the target selector's target.

Parameter Name Parameter Type Description
hero AIBaseClient* Target hero
auto enemy = ObjectManager::GetEnemies()[0];
TargetSelector::SetTarget(enemy);