mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
[Bots] Fix AE range calculation (#4683)
- Certain AE types weren't properly calculating their AE range and would base off the actual AE range for targeted types rather than the spells range itself
This commit is contained in:
parent
3b399dfac5
commit
02e2f6771c
23
zone/bot.cpp
23
zone/bot.cpp
@ -9708,6 +9708,7 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spell_type, bool precheck
|
||||
}
|
||||
//LogBotSpellChecksDetail("{} says, 'Doing CanCastSpellType checks of {} on {}.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName());
|
||||
if (!CanCastSpellType(spell_type, spell_id, tar)) {
|
||||
LogBotSpellChecksDetail("{} says, 'Cancelling cast of {} on {} due to CanCastSpellType.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -11994,7 +11995,7 @@ bool Bot::HasRequiredLoSForPositioning(Mob* tar) {
|
||||
|
||||
bool Bot::HasValidAETarget(Bot* caster, uint16 spell_id, uint16 spell_type, Mob* tar) {
|
||||
int spell_range = caster->GetActSpellRange(spell_id, spells[spell_id].range);
|
||||
int spell_ae_range = caster->GetActSpellRange(spell_id, spells[spell_id].aoe_range);
|
||||
int spell_ae_range = caster->GetAOERange(spell_id);
|
||||
int target_count = 0;
|
||||
|
||||
for (auto& close_mob : caster->m_close_mobs) {
|
||||
@ -12005,6 +12006,18 @@ bool Bot::HasValidAETarget(Bot* caster, uint16 spell_id, uint16 spell_type, Mob*
|
||||
}
|
||||
|
||||
switch (spell_type) {
|
||||
case BotSpellTypes::AELull:
|
||||
if (m->GetSpecialAbility(SpecialAbility::PacifyImmunity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
case BotSpellTypes::AEMez:
|
||||
if (m->GetSpecialAbility(SpecialAbility::MesmerizeImmunity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
case BotSpellTypes::AEDispel:
|
||||
if (m->GetSpecialAbility(SpecialAbility::DispellImmunity)) {
|
||||
continue;
|
||||
@ -13134,11 +13147,9 @@ bool Bot::IsImmuneToBotSpell(uint16 spell_id, Mob* caster) {
|
||||
(
|
||||
IsEffectInSpell(spell_id, SE_Root) ||
|
||||
IsEffectInSpell(spell_id, SE_MovementSpeed)
|
||||
)
|
||||
) {
|
||||
if (GetSpecialAbility(SpecialAbility::SnareImmunity)) {
|
||||
return true;
|
||||
}
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsLifetapSpell(spell_id)) {
|
||||
|
||||
@ -1068,10 +1068,8 @@ std::vector<BotSpell_wPriority> Bot::GetPrioritizedBotSpellsBySpellType(Bot* cas
|
||||
if (
|
||||
caster->IsCommandedSpell() ||
|
||||
!AE ||
|
||||
(
|
||||
BotSpellTypeRequiresAEChecks(spell_type) &&
|
||||
caster->HasValidAETarget(caster, bot_spell_list[i].spellid, spell_type, tar)
|
||||
)
|
||||
!BotSpellTypeRequiresAEChecks(spell_type) ||
|
||||
caster->HasValidAETarget(caster, bot_spell_list[i].spellid, spell_type, tar)
|
||||
) {
|
||||
BotSpell_wPriority bot_spell;
|
||||
bot_spell.SpellId = bot_spell_list[i].spellid;
|
||||
@ -1433,7 +1431,8 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* caster, int16 spell_id, uint16 spell_typ
|
||||
Mob* result = nullptr;
|
||||
|
||||
if (caster && caster->GetOwner()) {
|
||||
int spell_range = (!AE ? caster->GetActSpellRange(spell_id, spells[spell_id].range) : caster->GetActSpellRange(spell_id, spells[spell_id].aoe_range));
|
||||
int spell_range = caster->GetActSpellRange(spell_id, spells[spell_id].range);
|
||||
int spell_ae_range = caster->GetAOERange(spell_id);
|
||||
int buff_count = 0;
|
||||
NPC* npc = nullptr;
|
||||
|
||||
@ -1464,7 +1463,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* caster, int16 spell_id, uint16 spell_typ
|
||||
}
|
||||
|
||||
if (IsPBAESpell(spell_id)) {
|
||||
if (spell_range < Distance(caster->GetPosition(), m->GetPosition())) {
|
||||
if (spell_ae_range < Distance(caster->GetPosition(), m->GetPosition())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -2732,7 +2731,11 @@ bool Bot::IsValidSpellRange(uint16 spell_id, Mob* tar) {
|
||||
|
||||
float range = spells[spell_id].range + GetRangeDistTargetSizeMod(tar);
|
||||
|
||||
if (IsAnyAESpell(spell_id)) {
|
||||
if (
|
||||
spells[spell_id].target_type != ST_AETargetHateList &&
|
||||
!IsTargetableAESpell(spell_id) &&
|
||||
IsAnyAESpell(spell_id)
|
||||
) {
|
||||
range = GetAOERange(spell_id);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user