# FarmLocation
# 说明
用于表示最佳的技能施放位置以获得最大的小兵击杀数的结构体。
# 如何使用
// 获取小兵位置列表
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());
}
}
// 获取最佳的圆形技能施放位置
float spellRadius = 250.f;
float spellRange = 900.f;
FarmLocation bestCircularLocation = Utility::GetBestCircularFarmLocation(minionPositions, spellRadius, spellRange);
// 获取最佳的线性技能施放位置
float spellWidth = 80.f;
FarmLocation bestLineLocation = Utility::GetBestLineFarmLocation(minionPositions, spellWidth, spellRange);
// 使用结果
if (bestCircularLocation.MinionsHit >= 3)
{
// 施放圆形技能到最佳位置
ObjectManager::Player()->CastSpell(eSpellSlot::W, bestCircularLocation.Position);
}
if (bestLineLocation.MinionsHit >= 4)
{
// 施放线性技能到最佳位置
ObjectManager::Player()->CastSpell(eSpellSlot::Q, bestLineLocation.Position);
}
# Properties
属性名 | 类型 | 描述 |
---|---|---|
MinionsHit | int | 可以击中的小兵数量 |
Position | Vector | 最佳施放位置 |