# Evade 命名空间

# 说明

Evade命名空间提供了技能躲避相关的功能,用于检测危险技能并计算安全躲避路径。

# 如何使用

// 检查当前位置是否安全
bool isSafe = Evade::IsSafePosition(myHero.GetPosition());

// 获取最近的安全位置
Vector3 safePos = Evade::GetNearestSafePosition(myHero.GetPosition());

// 注册危险技能
Evade::RegisterSpell("EzrealQ", 1000.0f, 0.25f, 60.0f, 2000.0f, SkillshotType::Linear);

# IsSafePosition

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

检查指定位置是否安全(不在任何危险技能的范围内)。

参数名字 参数类型 描述
position Vector3 const& 要检查的位置坐标
extraRadius float 额外的安全半径,默认为0
// 检查当前位置是否安全
Vector3 currentPos = myHero.GetPosition();
bool isSafe = Evade::IsSafePosition(currentPos);

// 检查位置是否安全,并额外增加50单位的安全距离
bool isVerySafe = Evade::IsSafePosition(currentPos, 50.0f);

# GetNearestSafePosition

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

获取距离起始位置最近的安全位置。

参数名字 参数类型 描述
startPosition Vector3 const& 起始位置坐标
maxDistance float 寻找安全位置的最大距离,默认为500
// 获取最近的安全位置
Vector3 heroPos = myHero.GetPosition();
Vector3 safePos = Evade::GetNearestSafePosition(heroPos);

// 在较大范围内寻找安全位置
Vector3 farSafePos = Evade::GetNearestSafePosition(heroPos, 1000.0f);

# RegisterSpell

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

注册一个需要躲避的危险技能。

参数名字 参数类型 描述
spellName const char* 技能名称
range float 技能射程
castTime float 技能施法时间(秒)
radius float 技能半径或宽度
speed float 技能飞行速度,0表示即时生效
type SkillshotType 技能类型(线性、圆形、锥形等)
// 注册一个线性技能
Evade::RegisterSpell("EzrealQ", 1000.0f, 0.25f, 60.0f, 2000.0f, SkillshotType::Linear);

// 注册一个圆形技能
Evade::RegisterSpell("ZiggsR", 5000.0f, 0.375f, 525.0f, 1750.0f, SkillshotType::Circular);

# IsEvading

bool IsEvading()

检查英雄当前是否正在躲避技能。

// 检查是否正在躲避
if (Evade::IsEvading())
{
    // 在躲避过程中不要使用移动命令
    return;
}

# SetEvadeEnabled

void SetEvadeEnabled(bool enabled)

启用或禁用躲避系统。

参数名字 参数类型 描述
enabled bool 是否启用躲避系统
// 禁用躲避系统
Evade::SetEvadeEnabled(false);

// 重新启用躲避系统
Evade::SetEvadeEnabled(true);

# SetSpellEnabled

void SetSpellEnabled(const char* spellName, bool enabled)

设置是否对特定技能进行躲避。

参数名字 参数类型 描述
spellName const char* 技能名称
enabled bool 是否启用对该技能的躲避
// 禁用对特定技能的躲避
Evade::SetSpellEnabled("EzrealR", false);

// 重新启用对特定技能的躲避
Evade::SetSpellEnabled("EzrealR", true);