Some simple improvements to Karazhan strategies (#2173)

# Pull Request

I've made a few simple changes to the Karazhan strategies that should
result in notable improvements in game.

- **Attumen**: I was using a GetExactDist2d() check for phase 2 when
bots stack behind him. That resulted in ranged bots being too close to
attack. It's now switched to the correct GetDistance2d() check to
account for the hitbox.
- **Maiden of Virtue**: The tank continuously ran side-to-side when
trying to tank her because it was trying to turn the boss with
TankFaceAction but not being able to due to being required to be within
a short distance of a set waypoint. I didn't understand the cause when I
was originally working on Karazhan. To fix this, a new multiplier
disables CombatFormationMoveAction (the "co+ disperse" strategy) and its
inherited classes, except for SetBehindTargetAction. The only other
class that inherits from CombatFormationMoveAction is TankFaceAction. I
disabled the parent class also because the ranged bots have a coded
positioning strategy and should not observe the co+ disperse strategy.
- **The Curator**: Same deal as Maiden with a new multiplier.
- **Nightbane**: Same deal as Maiden with a new multiplier.
- **Malchezaar**: Infernal avoidance for non-enfeebled bots had movement
priority set to MOVEMENT_FORCED. This was not good because it made bots
refuse to cross Hellfire so if you got unlucky, they could be stuck on
the other side of an Infernal from the boss and completely out of the
fight. MOVEMENT_FORCED needs to be reserved for situations in which the
bot absolutely cannot step in the AoE at all, and that's not the case
for non-Enfeebled bots here. Priority is now changed to MOVEMENT_COMBAT.

---

## Feature Evaluation

Please answer the following:

- Describe the **minimum logic** required to achieve the intended
behavior?
- Describe the **cheapest implementation** that produces an acceptable
result?
- Describe the **runtime cost** when this logic executes across many
bots?

No additional complication in logic from these changes, and additional
performance impact is exceedingly small (just a few more multipliers
with inexpensive checks that would apply only in Karazhan).

---

## How to Test the Changes

- Step-by-step instructions to test the change
- Any required setup (e.g. multiple players, bots, specific
configuration)
- Expected behavior and how to verify it

Should be straightforward. Engage the above-mentioned bosses in Karazhan
and observe the mechanics. I did test all of them.

## Complexity & Impact

Does this change add new decision branches?
- - [X] No
- - [ ] Yes (**explain below**)

Does this change increase per-bot or per-tick processing?
- - [ ] No
- - [X] Yes (**describe and justify impact**)

Barely due to the additional multipliers.

Could this logic scale poorly under load?
- - [X] No
- - [ ] Yes (**explain why**)
---

## Defaults & Configuration

Does this change modify default bot behavior?
- - [X] No
- - [ ] Yes (**explain why**)

If this introduces more advanced or AI-heavy logic:
- - [X] Lightweight mode remains the default
- - [ ] More complex behavior is optional and thereby configurable
---

## AI Assistance

Was AI assistance (e.g. ChatGPT or similar tools) used while working on
this change?
- - [X] No
- - [ ] Yes (**explain below**)

---

## Final Checklist

- - [X] Stability is not compromised
- - [X] Performance impact is understood, tested, and acceptable
- - [X] Added logic complexity is justified and explained
- - [X] Documentation updated if needed

---

## Notes for Reviewers

Anything that significantly improves realism at the cost of stability or
performance should be carefully discussed
before merging.

---------

Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com>
Co-authored-by: bash <hermensb@gmail.com>
Co-authored-by: Revision <tkn963@gmail.com>
This commit is contained in:
Crow
2026-03-06 09:58:02 -06:00
committed by GitHub
parent 18bd655869
commit 80860d72a3
5 changed files with 52 additions and 15 deletions

View File

@@ -116,9 +116,9 @@ bool AttumenTheHuntsmanStackBehindAction::Execute(Event /*event*/)
float rearX = attumenMounted->GetPositionX() + std::cos(orientation) * distanceBehind;
float rearY = attumenMounted->GetPositionY() + std::sin(orientation) * distanceBehind;
if (bot->GetExactDist2d(rearX, rearY) > 1.0f)
if (bot->GetDistance2d(rearX, rearY) > 1.0f)
{
return MoveTo(KARAZHAN_MAP_ID, rearX, rearY, attumenMounted->GetPositionZ(), false, false, false, false,
return MoveTo(KARAZHAN_MAP_ID, rearX, rearY, bot->GetPositionZ(), false, false, false, false,
MovementPriority::MOVEMENT_FORCED, true, false);
}
@@ -1178,7 +1178,7 @@ bool PrinceMalchezaarNonTankAvoidInfernalAction::Execute(Event /*event*/)
bot->AttackStop();
bot->InterruptNonMeleeSpells(true);
return MoveTo(KARAZHAN_MAP_ID, bestDestX, bestDestY, bestDestZ, false, false, false, false,
MovementPriority::MOVEMENT_FORCED, true, false);
MovementPriority::MOVEMENT_COMBAT, true, false);
}
}
@@ -1244,7 +1244,7 @@ bool PrinceMalchezaarMainTankMovementAction::Execute(Event /*event*/)
{
bot->AttackStop();
return MoveTo(KARAZHAN_MAP_ID, bestDestX, bestDestY, bestDestZ, false, false, false, false,
MovementPriority::MOVEMENT_FORCED, true, false);
MovementPriority::MOVEMENT_COMBAT, true, true);
}
}

View File

@@ -80,6 +80,19 @@ float AttumenTheHuntsmanWaitForDpsMultiplier::GetValue(Action* action)
return 1.0f;
}
// Disables co +disperse and co +tank face
float MaidenOfVirtueDisableCombatFormationMoveMultiplier::GetValue(Action* action)
{
if (!AI_VALUE2(Unit*, "find target", "maiden of virtue"))
return 1.0f;
if (dynamic_cast<CombatFormationMoveAction*>(action) &&
!dynamic_cast<SetBehindTargetAction*>(action))
return 0.0f;
return 1.0f;
}
// The assist tank should stay on the boss to be 2nd on aggro and tank Hateful Bolts
float TheCuratorDisableTankAssistMultiplier::GetValue(Action* action)
{
@@ -93,6 +106,19 @@ float TheCuratorDisableTankAssistMultiplier::GetValue(Action* action)
return 1.0f;
}
// Disables co +disperse and co +tank face
float TheCuratorDisableCombatFormationMoveMultiplier::GetValue(Action* action)
{
if (!AI_VALUE2(Unit*, "find target", "the curator"))
return 1.0f;
if (dynamic_cast<CombatFormationMoveAction*>(action) &&
!dynamic_cast<SetBehindTargetAction*>(action))
return 0.0f;
return 1.0f;
}
// Save Bloodlust/Heroism for Evocation (100% increased damage)
float TheCuratorDelayBloodlustAndHeroismMultiplier::GetValue(Action* action)
{
@@ -350,17 +376,11 @@ float NightbaneDisableMovementMultiplier::GetValue(Action* action)
if (dynamic_cast<CastBlinkBackAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<FleeAction*>(action))
return 0.0f;
// Disable CombatFormationMoveAction for all bots except:
// (1) main tank and (2) only during the ground phase, other melee
if (botAI->IsRanged(bot) ||
(botAI->IsMelee(bot) && !botAI->IsMainTank(bot) &&
nightbane->GetPositionZ() > NIGHTBANE_FLIGHT_Z))
dynamic_cast<FleeAction*>(action) ||
(dynamic_cast<CombatFormationMoveAction*>(action) &&
!dynamic_cast<SetBehindTargetAction*>(action)))
{
if (dynamic_cast<CombatFormationMoveAction*>(action))
return 0.0f;
return 0.0f;
}
return 1.0f;

View File

@@ -27,6 +27,14 @@ public:
virtual float GetValue(Action* action);
};
class MaidenOfVirtueDisableCombatFormationMoveMultiplier : public Multiplier
{
public:
MaidenOfVirtueDisableCombatFormationMoveMultiplier(
PlayerbotAI* botAI) : Multiplier(botAI, "maiden of virtue disable combat formation move multiplier") {}
virtual float GetValue(Action* action);
};
class TheCuratorDisableTankAssistMultiplier : public Multiplier
{
public:
@@ -35,6 +43,14 @@ public:
virtual float GetValue(Action* action);
};
class TheCuratorDisableCombatFormationMoveMultiplier : public Multiplier
{
public:
TheCuratorDisableCombatFormationMoveMultiplier(
PlayerbotAI* botAI) : Multiplier(botAI, "the curator disable combat formation move multiplier") {}
virtual float GetValue(Action* action);
};
class TheCuratorDelayBloodlustAndHeroismMultiplier : public Multiplier
{
public:

View File

@@ -146,7 +146,9 @@ void RaidKarazhanStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers
multipliers.push_back(new AttumenTheHuntsmanDisableTankAssistMultiplier(botAI));
multipliers.push_back(new AttumenTheHuntsmanStayStackedMultiplier(botAI));
multipliers.push_back(new AttumenTheHuntsmanWaitForDpsMultiplier(botAI));
multipliers.push_back(new MaidenOfVirtueDisableCombatFormationMoveMultiplier(botAI));
multipliers.push_back(new TheCuratorDisableTankAssistMultiplier(botAI));
multipliers.push_back(new TheCuratorDisableCombatFormationMoveMultiplier(botAI));
multipliers.push_back(new TheCuratorDelayBloodlustAndHeroismMultiplier(botAI));
multipliers.push_back(new ShadeOfAranArcaneExplosionDisableChargeMultiplier(botAI));
multipliers.push_back(new ShadeOfAranFlameWreathDisableMovementMultiplier(botAI));

View File

@@ -62,7 +62,6 @@ namespace KarazhanHelpers
NPC_ATTUMEN_THE_HUNTSMAN_MOUNTED = 16152,
// Terestian Illhoof
NPC_TERESTIAN_ILLHOOF = 15688,
NPC_DEMON_CHAINS = 17248,
NPC_KILREK = 17229,