[Avoid aoe] Fix avoid aoe position

This commit is contained in:
Yunfan Li
2024-06-26 23:44:40 +08:00
parent e91debc330
commit d8badd4532
2 changed files with 5 additions and 6 deletions

View File

@@ -1711,13 +1711,11 @@ Position AvoidAoeAction::BestPositionForRanged(Position pos, float radius)
Position fleePos{bot->GetPositionX() + cos(angle) * fleeDis, Position fleePos{bot->GetPositionX() + cos(angle) * fleeDis,
bot->GetPositionY() + sin(angle) * fleeDis, bot->GetPositionY() + sin(angle) * fleeDis,
bot->GetPositionZ()}; bot->GetPositionZ()};
// backward, flee if (currentTarget // && (angle == angleToTarget + M_PI || angle == angleFleeFromCenter)
if (currentTarget && (angle == angleToTarget + M_PI || angle == angleFleeFromCenter)
&& fleePos.GetExactDist(currentTarget) > sPlayerbotAIConfig->spellDistance) { && fleePos.GetExactDist(currentTarget) > sPlayerbotAIConfig->spellDistance) {
continue; continue;
} }
// forward, flee if (currentTarget // && (angle == angleToTarget || angle == angleFleeFromCenter)
if (currentTarget && (angle == angleToTarget || angle == angleFleeFromCenter)
&& fleePos.GetExactDist(currentTarget) < (sPlayerbotAIConfig->tooCloseDistance + 5.0f)) { && fleePos.GetExactDist(currentTarget) < (sPlayerbotAIConfig->tooCloseDistance + 5.0f)) {
continue; continue;
} }
@@ -1737,7 +1735,7 @@ bool AvoidAoeAction::FleePosition(Position pos, float radius, std::string name)
Position bestPos; Position bestPos;
if (botAI->IsMelee(bot)) { if (botAI->IsMelee(bot)) {
bestPos = BestPositionForMelee(pos, radius); bestPos = BestPositionForMelee(pos, radius);
} else if (botAI->IsRanged(bot)) { } else {
bestPos = BestPositionForRanged(pos, radius); bestPos = BestPositionForRanged(pos, radius);
} }
if (bestPos != Position()) { if (bestPos != Position()) {

View File

@@ -125,7 +125,8 @@ Aura* AreaDebuffValue::Calculate()
Unit::AuraEffectList const& aurasPeriodicDamagePercent = bot->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); Unit::AuraEffectList const& aurasPeriodicDamagePercent = bot->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
Unit::AuraEffectList const& aurasPeriodicTriggerSpell = bot->GetAuraEffectsByType(SPELL_AURA_PERIODIC_TRIGGER_SPELL); Unit::AuraEffectList const& aurasPeriodicTriggerSpell = bot->GetAuraEffectsByType(SPELL_AURA_PERIODIC_TRIGGER_SPELL);
Unit::AuraEffectList const& aurasPeriodicTriggerWithValueSpell = bot->GetAuraEffectsByType(SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE); Unit::AuraEffectList const& aurasPeriodicTriggerWithValueSpell = bot->GetAuraEffectsByType(SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE);
for (const Unit::AuraEffectList& list : {aurasPeriodicDamage, aurasPeriodicDamagePercent, aurasPeriodicTriggerSpell, aurasPeriodicTriggerWithValueSpell}) { Unit::AuraEffectList const& aurasDummy = bot->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (const Unit::AuraEffectList& list : {aurasPeriodicDamage, aurasPeriodicDamagePercent, aurasPeriodicTriggerSpell, aurasPeriodicTriggerWithValueSpell, aurasDummy}) {
for (auto i = list.begin(); i != list.end(); ++i) for (auto i = list.begin(); i != list.end(); ++i)
{ {
AuraEffect* aurEff = *i; AuraEffect* aurEff = *i;