Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(NpcBots/bot_ai): Change ranged bots to run to a tank or to their master when they have aggro #7

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

atrapalis
Copy link

@atrapalis atrapalis commented Jul 26, 2024

Changes Proposed:

This commit improves positioning for ranged bots which have aggro from the player's target. Previously bots would always keep a distance from their master which means they were effectively running away. With the changes proposed here, ranged bots will run to their master or to a bot tank/offtank when they get aggro - which is what you would expect a player to do. This will only be triggered if the player is targeting the creature which is attacking the ranged bot.

Overall this should improve crowd-control in dungeons and raids.

This PR proposes changes to:

  • Core (units, players, creatures, game systems).
  • Scripts (bosses, spell scripts, creature scripts).
  • Database (SAI, creatures, etc).

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

How to Test the Changes:

  • This pull request can be tested by following the reproduction steps provided in the linked issue
  • This pull request requires further testing. Provide steps to test your changes. If it requires any specific setup e.g multiple players please specify it as well.
  1. Summon a ranged bot (and optionally a tank bot).
  2. Body pull at least two creatures.
  3. Allow the ranged bot to get aggro from one of the two creatures (e.g. by healing or attacking).
  4. Target the creature which is now attacking the ranged bot. The ranged bot should move to the player, or to the tank bot if it was summoned in step 1.

Known Issues and TODO List:

  • Do we need to consider impact for PvP gameplay? Perhaps this bot tactic would be counter-productive in PvP.

@trickerer
Copy link
Owner

The location for this code is right but could you please try to make bot move towards the selected target (ideally slightly past their front) instead of onto it?

P.S.

Man this AC PR template is kinda excessive for the bots huh

@atrapalis
Copy link
Author

@trickerer That's a good point, I addressed this in 35130d5 just now. I set the radius to be 1.5 and randomised whether the bot should stop past or before the target - it should be well within melee range in either case.

// Look for a tank in the master's bots
BotMap const* map = master->GetBotMgr()->GetBotMap();
for (BotMap::const_iterator itr = map->begin(); itr != map->end(); ++itr)
if (itr->second && (IsTank(itr->second) || IsOffTank(itr->second)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsOffTank() check is redundant here, off-tank bot automatically has tanking role enabled

@trickerer trickerer merged commit c54569d into trickerer:npcbots_3.3.5 Aug 13, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants