[Bots] Line of Sight and Mez optimizations and cleanup (#4746)

* [Bots] Line of Sight and Mez optimizations and cleanup

- Renames `Map:CheckForLoSCheat` to `Map:CheckForDoorLoSCheat` to better reflect what it does.
- Renames `Map:RangeCheckForLoSCheat` to `Map:RangeCheckForDoorLoSCheat` to better reflect what it does.
- Adds the rule `Pets:PetsRequireLoS` to determine whether or not commanded pet attacks require an addition layer of LoS checks for edge-cases.
- Adds the rule `Bots:BotsRequireLoS` to determine whether or not bots require LoS to `^attack`, `^pull` and `^precombat`.
- Adds the rule `Map:ZonesToCheckDoorCheat` to control what if any zones will be checked..
- Corrects, removes and adds LoS checks where necessary.
- Improves door checking logic for locked or triggered doors that could be blocking LoS.
- Cleans up false positives for door cheat checks.
- Adds `drawbox` option to `#door` command. This will spawn points at the center and each corner of the door's "box". It will also spawn points at your and your target's location.
- Improves Mez and AE Mez logic
- Adds more details to the rule `Bots:EpicPetSpellName`

* Remove leftover debugging

* Change return to continue for GetFirstIncomingMobToMez checks

* Move mez chance fail to beginning of cast process
This commit is contained in:
nytmyr
2025-03-29 16:01:31 -05:00
committed by GitHub
parent d554eb3423
commit 444d688ad2
17 changed files with 265 additions and 153 deletions
+7 -10
View File
@@ -2314,7 +2314,7 @@ void Bot::AI_Process()
if (PULLING_BOT || RETURNING_BOT) {
if (!TargetValidation(tar)) { return; }
if (!DoLosChecks(tar)) {
if (RuleB(Bots, BotsRequireLoS) && !HasLoS()) {
return;
}
@@ -3175,14 +3175,17 @@ bool Bot::IsValidTarget(
return false;
}
SetHasLoS(DoLosChecks(tar));
bool invalid_target_state = false;
if (HOLDING ||
!tar->IsNPC() ||
(tar->IsMezzed() && !HasBotAttackFlag(tar)) ||
(!Charmed() && tar->GetUltimateOwner()->IsOfClientBotMerc()) ||
lo_distance > leash_distance ||
tar_distance > leash_distance ||
(!GetAttackingFlag() && !CheckLosCheat(tar) && !leash_owner->CheckLosCheat(tar)) ||
(!GetAttackingFlag() && !HasLoS()) ||
!IsAttackAllowed(tar)
) {
invalid_target_state = true;
@@ -11413,7 +11416,7 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool is_disc) {
return false;
}
if (!DoLosChecks(tar)) {
if (!HasLoS() && !DoLosChecks(tar)) {
return false;
}
@@ -12197,7 +12200,7 @@ bool Bot::HasRequiredLoSForPositioning(Mob* tar) {
return true;
}
if (RequiresLoSForPositioning() && !DoLosChecks(tar)) {
if (RequiresLoSForPositioning() && !HasLoS()) {
return false;
}
@@ -12212,10 +12215,6 @@ bool Bot::HasValidAETarget(Bot* caster, uint16 spell_id, uint16 spell_type, Mob*
for (auto& close_mob : caster->m_close_mobs) {
Mob* m = close_mob.second;
if (tar == m) {
continue;
}
switch (spell_type) {
case BotSpellTypes::AELull:
if (m->GetSpecialAbility(SpecialAbility::PacifyImmunity)) {
@@ -12307,8 +12306,6 @@ bool Bot::HasValidAETarget(Bot* caster, uint16 spell_id, uint16 spell_type, Mob*
return false;
}
SetHasLoS(true);
return true;
}