# Evade

# Description

The Evade namespace provides skill dodging functionality, used to detect dangerous skills and calculate safe evasion paths.

# How to Use

// Check if current position is safe
bool isSafe = Evade::IsSafePosition(myHero.GetPosition());

// Get the nearest safe position
Vector3 safePos = Evade::GetNearestSafePosition(myHero.GetPosition());

// Register dangerous skill
Evade::RegisterSpell("EzrealQ", 1000.0f, 0.25f, 60.0f, 2000.0f, SkillshotType::Linear);

# IsSafePosition

bool IsSafePosition(Vector3 const& position, float extraRadius = 0.0f)

Checks if a specified position is safe (not within the range of any dangerous skills).

Parameter Type Description
position Vector3 const& Position coordinates to check
extraRadius float Additional safety radius, defaults to 0
// Check if current position is safe
Vector3 currentPos = myHero.GetPosition();
bool isSafe = Evade::IsSafePosition(currentPos);

// Check if position is safe with an additional 50 units of safety distance
bool isVerySafe = Evade::IsSafePosition(currentPos, 50.0f);

# GetNearestSafePosition

Vector3 GetNearestSafePosition(Vector3 const& startPosition, float maxDistance = 500.0f)

Gets the nearest safe position from the starting position.

Parameter Type Description
startPosition Vector3 const& Starting position coordinates
maxDistance float Maximum distance to search for a safe position, defaults to 500
// Get the nearest safe position
Vector3 heroPos = myHero.GetPosition();
Vector3 safePos = Evade::GetNearestSafePosition(heroPos);

// Search for a safe position in a larger range
Vector3 farSafePos = Evade::GetNearestSafePosition(heroPos, 1000.0f);

# RegisterSpell

void RegisterSpell(const char* spellName, float range, float castTime, float radius, float speed, SkillshotType type)

Registers a dangerous skill that needs to be evaded.

Parameter Type Description
spellName const char* Skill name
range float Skill range
castTime float Skill cast time (seconds)
radius float Skill radius or width
speed float Skill projectile speed, 0 means instant effect
type SkillshotType Skill type (linear, circular, cone, etc.)
// Register a linear skill
Evade::RegisterSpell("EzrealQ", 1000.0f, 0.25f, 60.0f, 2000.0f, SkillshotType::Linear);

// Register a circular skill
Evade::RegisterSpell("ZiggsR", 5000.0f, 0.375f, 525.0f, 1750.0f, SkillshotType::Circular);

# IsEvading

bool IsEvading()

Checks if the hero is currently evading a skill.

// Check if currently evading
if (Evade::IsEvading())
{
    // Don't use movement commands during evasion
    return;
}

# SetEvadeEnabled

void SetEvadeEnabled(bool enabled)

Enables or disables the evasion system.

Parameter Type Description
enabled bool Whether to enable the evasion system
// Disable the evasion system
Evade::SetEvadeEnabled(false);

// Re-enable the evasion system
Evade::SetEvadeEnabled(true);

# SetSpellEnabled

void SetSpellEnabled(const char* spellName, bool enabled)

Sets whether to evade a specific skill.

Parameter Type Description
spellName const char* Skill name
enabled bool Whether to enable evasion for this skill
// Disable evasion for a specific skill
Evade::SetSpellEnabled("EzrealR", false);

// Re-enable evasion for a specific skill
Evade::SetSpellEnabled("EzrealR", true);