Remove Bot_AICheckCloseBeneficialSpells and use AttemptCloseBeneficialSpells for better performance

This commit is contained in:
nytmyr
2024-12-20 13:10:50 -06:00
parent 62111da16d
commit a46478468c
4 changed files with 71 additions and 64 deletions
+27
View File
@@ -633,6 +633,9 @@ bool Bot::AI_PursueCastCheck() {
}
auto castOrder = GetSpellTypesPrioritized(BotPriorityCategories::Pursue);
Mob* tar = nullptr;
Raid* raid = GetRaid();
std::vector<Mob*> v = GatherSpellTargets(RuleB(Bots, CrossRaidBuffingAndHealing));
for (auto& currentCast : castOrder) {
if (currentCast.priority == 0) {
@@ -650,6 +653,10 @@ bool Bot::AI_PursueCastCheck() {
result = AttemptAICastSpell(currentCast.spellType);
if (!result && IsBotSpellTypeBeneficial(currentCast.spellType)) {
result = AttemptCloseBeneficialSpells(currentCast.spellType, raid, v);
}
if (result) {
break;
}
@@ -692,6 +699,9 @@ bool Bot::AI_IdleCastCheck() {
}
auto castOrder = GetSpellTypesPrioritized(BotPriorityCategories::Idle);
Mob* tar = nullptr;
Raid* raid = GetRaid();
std::vector<Mob*> v = GatherSpellTargets(RuleB(Bots, CrossRaidBuffingAndHealing));
for (auto& currentCast : castOrder) {
if (currentCast.priority == 0) {
@@ -711,11 +721,21 @@ bool Bot::AI_IdleCastCheck() {
continue;
}
if (!IsBotSpellTypeBeneficial(currentCast.spellType)) {
continue;
}
result = AttemptAICastSpell(currentCast.spellType);
if (result) {
break;
}
result = AttemptCloseBeneficialSpells(currentCast.spellType, raid, v);
if (result) {
break;
}
}
if (!AIautocastspell_timer->Enabled()) {
@@ -746,6 +766,9 @@ bool Bot::AI_EngagedCastCheck() {
}
auto castOrder = GetSpellTypesPrioritized(BotPriorityCategories::Engaged);
Mob* tar = nullptr;
Raid* raid = GetRaid();
std::vector<Mob*> v = GatherSpellTargets(RuleB(Bots, CrossRaidBuffingAndHealing));
for (auto& currentCast : castOrder) {
if (currentCast.priority == 0) {
@@ -763,6 +786,10 @@ bool Bot::AI_EngagedCastCheck() {
result = AttemptAICastSpell(currentCast.spellType);
if (!result && IsBotSpellTypeBeneficial(currentCast.spellType)) {
result = AttemptCloseBeneficialSpells(currentCast.spellType, raid, v);
}
if (result) {
break;
}