trickerer / Trinity-Bots

NPCBots for TrinityCore and AzerothCore 3.3.5
https://github.com/trickerer/TrinityCore-3.3.5-with-NPCBots/
465 stars 154 forks source link

Bot tank assistant #123

Closed Saiska closed 3 years ago

Saiska commented 3 years ago

Got the "problem" when i'm not tanking, i put a second bot on tank. But both tank target the tank sign, which is not the best in some case. I'm sorry i don't know how to pull code here because originally i got your project from another repo, trinity single project, so i updated the code by hand and not with repo sync... and i'm lost how to reconnect the code to your repo.

The goal is to have, as you have a "main tank", a "main assist" which focus the dps sign despite being a tank. Like /mt it's given with /ma or /mainassist in trinity its MEMBER_FLAG_MAINASSIST

i duplicated the //bool bot_ai::IsTank(Unit const* unit) const

in botai.h/cpp adding

  bool bot_ai::IsAssistTank(Unit const* unit) const
  { 

      if (HasRole(BOT_ROLE_TANK)) 
      {
          if (Player const* player = unit->ToPlayer())
          {
              if (Group const* gr = player->GetGroup())
              {
                  if (gr->isRaidGroup())
                  {
                      Group::MemberSlotList const& slots = gr->GetMemberSlots();
                      for (Group::member_citerator itr = slots.begin(); itr != slots.end(); ++itr)
                          if (itr->guid == unit->GetGUID())
                              return itr->flags & MEMBER_FLAG_MAINASSIST;
                  }
              }
          }
      }

      return false;
  }

when modified the _getTarget in botai.h/cpp

  if (gr && IsTank() )

To:

  if (gr && IsTank() && !IsAssistTank())

to ignore the tank sign as assist tank.

i put this here because i closed the issue and i don't know if maybe you missed it, but some code you may want consider adding too here :https://github.com/trickerer/Trinity-Bots/issues/120

trickerer commented 3 years ago

Any implementation with current codebase will be bad. A separate role is needed for that. This bot would be supposed to have tanking actions but dps-level target priorities.

I track notable issues in notifications, don't worry about it.

Saiska commented 3 years ago

i don't understand ?

This bot would be supposed to have tanking actions but dps-level target priorities.

that is exactly that i seek and that the code does ? the goal is to have the possibility in raid to have an offtank. Take the first encounter of trial of crusader, the Worms. They are two, and it is very difficult to make them tanked by the same bot, because one don't move. So i have one tank targeting the tank sign, and the other targeting the dps sign, either having tank action and spec. It's a tank subrole, only given by the action /ma on a tank bot.