# Utility
# Description
The Utility namespace provides some common utility functions, including delayed operations, collision detection, skill hit detection, minion position prediction, and other features.
# How to Use
// Using delayed actions
Utility::DelayAction::Add(1000, &OnDelayedAction);
// Check for collisions
if (!Utility::CollisionEnemyYasuoW(myPosition, targetPosition)) {
// Cast skill...
}
// Get the best farm location
FarmLocation bestLocation = Utility::GetBestCircularFarmLocation(minionPositions, 250.0f, 800.0f);
# AllyYasuoInGame
bool AllyYasuoInGame
Whether there is an allied Yasuo in the game.
if (Utility::AllyYasuoInGame) {
// Specific logic for when an allied Yasuo exists
}
# CanHitSkillShot
bool CanHitSkillShot(AIBaseClient* target, Vector const& Start, Vector const& End, float LineWidth)
Determines if a target can potentially be hit by a line skillshot.
Parameter Name | Parameter Type | Description |
---|---|---|
target | AIBaseClient* | Target unit |
Start | Vector const& | Skill starting point |
End | Vector const& | Skill ending point |
LineWidth | float | Skill width |
auto target = TargetSelector::GetTarget(1000.0f, eDamageType::Magical);
Vector playerPos = ObjectManager::Player()->ServerPosition();
Vector castPos = playerPos.Extend(target->ServerPosition(), 1000.0f);
if (target && Utility::CanHitSkillShot(target, playerPos, castPos, 80.0f)) {
// Skill can potentially hit the target
}
# CollisionAllyYasuoW
bool CollisionAllyYasuoW(Vector const& from, Vector const& to)
Checks if the path from the starting point to the ending point will collide with an allied Yasuo's wind wall.
Parameter Name | Parameter Type | Description |
---|---|---|
from | Vector const& | Starting position |
to | Vector const& | Ending position |
Vector myPosition = ObjectManager::Player()->ServerPosition();
auto target = TargetSelector::GetTarget(1000.0f, eDamageType::Magical);
if (target && !Utility::CollisionAllyYasuoW(myPosition, target->ServerPosition())) {
// Path will not collide with allied Yasuo wind wall
}
# CollisionEnemyYasuoW
bool CollisionEnemyYasuoW(Vector const& from, Vector const& to)
Checks if the path from the starting point to the ending point will collide with an enemy Yasuo's wind wall.
Parameter Name | Parameter Type | Description |
---|---|---|
from | Vector const& | Starting position |
to | Vector const& | Ending position |
Vector myPosition = ObjectManager::Player()->ServerPosition();
auto target = TargetSelector::GetTarget(1000.0f, eDamageType::Magical);
if (target && !Utility::CollisionEnemyYasuoW(myPosition, target->ServerPosition())) {
// Path will not collide with enemy Yasuo wind wall
}
# DelayAction.Add
void DelayAction::Add(int time, void* fun)
Adds a delayed execution operation.
Parameter Name | Parameter Type | Description |
---|---|---|
time | int | Delay execution time (milliseconds) |
fun | void* | Function pointer to execute |
void OnDelayedAction() {
// Delayed execution logic
}
// Execute OnDelayedAction function after 1000 milliseconds
Utility::DelayAction::Add(1000, &OnDelayedAction);
# EnemyYasuoInGame
bool EnemyYasuoInGame
Whether there is an enemy Yasuo in the game.
if (Utility::EnemyYasuoInGame) {
// Specific logic for when an enemy Yasuo exists
}
# GetBestCircularFarmLocation
FarmLocation GetBestCircularFarmLocation(const std::vector<Vector>& minionPositions, float width, float range)
Gets the best position for a circular skill to farm minions.
Parameter Name | Parameter Type | Description |
---|---|---|
minionPositions | const std::vector<Vector>& | List of minion positions |
width | float | Radius of the circular skill |
range | float | Maximum skill range |
std::vector<Vector> minionPositions;
for (auto minion : ObjectManager::GetEnemyMinions()) {
if (minion->IsValidTarget()) {
minionPositions.push_back(minion->ServerPosition());
}
}
FarmLocation bestLocation = Utility::GetBestCircularFarmLocation(minionPositions, 250.0f, 800.0f);
if (bestLocation.MinionsHit > 2) {
// Use bestLocation.Position to cast circular skill
}
# GetBestLineFarmLocation
FarmLocation GetBestLineFarmLocation(const std::vector<Vector>& minionPositions, float width, float range)
Gets the best position for a line skill to farm minions.
Parameter Name | Parameter Type | Description |
---|---|---|
minionPositions | const std::vector<Vector>& | List of minion positions |
width | float | Width of the line skill |
range | float | Maximum skill range |
std::vector<Vector> minionPositions;
for (auto minion : ObjectManager::GetEnemyMinions()) {
if (minion->IsValidTarget()) {
minionPositions.push_back(minion->ServerPosition());
}
}
FarmLocation bestLocation = Utility::GetBestLineFarmLocation(minionPositions, 80.0f, 1000.0f);
if (bestLocation.MinionsHit > 3) {
// Use bestLocation.Position to cast line skill
}
# GetMinionsPredictedPositions
void GetMinionsPredictedPositions(std::vector<Vector>& Output, const std::vector<AIBaseClient*>& minions, float delay, float width, float speed, Vector from, float range, bool collision, eSkillshotType stype, Vector rangeCheckFrom = Vector::Zero)
Gets the predicted positions of minions.
Parameter Name | Parameter Type | Description |
---|---|---|
Output | std::vector<Vector>& | Output list of predicted positions |
minions | const std::vector<AIBaseClient*>& | List of minions |
delay | float | Skill cast delay |
width | float | Skill width |
speed | float | Skill travel speed |
from | Vector | Skill cast position |
range | float | Maximum skill range |
collision | bool | Whether to consider collision |
stype | eSkillshotType | Skill type |
rangeCheckFrom | Vector | Range check starting point (optional) |
std::vector<Vector> predictedPositions;
auto minions = ObjectManager::GetEnemyMinions();
Vector playerPos = ObjectManager::Player()->ServerPosition();
Utility::GetMinionsPredictedPositions(predictedPositions, minions, 0.25f, 80.0f, 1600.0f, playerPos, 1000.0f, false, eSkillshotType::SkillshotLine);
// Use predicted positions to calculate the best farm location
FarmLocation bestLocation = Utility::GetBestLineFarmLocation(predictedPositions, 80.0f, 1000.0f);
# IsSpellHeroCollision
bool IsSpellHeroCollision(AIBaseClient* t, Spell const& QWER, int extraWith = 50)
Determines if a collision will occur between a skill and a hero.
Parameter Name | Parameter Type | Description |
---|---|---|
t | AIBaseClient* | Target hero |
QWER | Spell const& | Skill object |
extraWith | int | Extra width (optional) |
Spell Q(eSpellSlot::Q, 900.0f);
Q.SetSkillshot(0.25f, 80.0f, 1600.0f, true, eSkillshotType::SkillshotLine);
auto target = TargetSelector::GetTarget(900.0f, eDamageType::Magical);
if (target && !Utility::IsSpellHeroCollision(target, Q)) {
// Skill will not collide with other heroes
Q.Cast(target);
}