Skip to content

Commit

Permalink
NPCBots: Check player talents to determine tanking role
Browse files Browse the repository at this point in the history
(cherry picked from commit 30890c55098cc21458bee9f3b6b5b6550159428e)

# Conflicts:
#	src/server/game/AI/NpcBots/bot_ai.cpp
  • Loading branch information
trickerer committed Nov 21, 2024
1 parent 2152516 commit e15689c
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14675,6 +14675,28 @@ bool bot_ai::IsTank(Unit const* unit) const
if (gr->isLFGGroup() && sLFGMgr->GetRoles(unit->GetGUID()) & lfg::PLAYER_ROLE_TANK)
return true;
}
switch (player->GetClass())
{
case CLASS_WARRIOR:
if (player->GetShield() && const_cast<Player*>(player)->GetSpec(player->GetActiveSpec()) == TALENT_TREE_WARRIOR_PROTECTION)
return true;
break;
case CLASS_PALADIN:
if (player->GetShield() && const_cast<Player*>(player)->GetSpec(player->GetActiveSpec()) == TALENT_TREE_PALADIN_PROTECTION)
return true;
break;
case CLASS_DRUID:
if ((player->GetShapeshiftForm() == FORM_BEAR || player->GetShapeshiftForm() == FORM_DIREBEAR) &&
const_cast<Player*>(player)->GetSpec(player->GetActiveSpec()) == TALENT_TREE_DRUID_FERAL_COMBAT)
return true;
break;
case CLASS_DEATH_KNIGHT:
if (player->GetAuraEffect(SPELL_AURA_MOD_THREAT, SPELLFAMILY_DEATHKNIGHT, 0x8000, 0x0, 0x0) && player->GetRatingBonusValue(CR_DEFENSE_SKILL) > 0.0f)
return true;
break;
default:
break;
}
}

return false;
Expand All @@ -14700,6 +14722,28 @@ bool bot_ai::IsOffTank(Unit const* unit) const
return itr->flags & MEMBER_FLAG_MAINASSIST;
}
}
switch (player->GetClass())
{
case CLASS_WARRIOR:
if (player->GetShield() && const_cast<Player*>(player)->GetSpec(player->GetActiveSpec()) == TALENT_TREE_WARRIOR_PROTECTION)
return true;
break;
case CLASS_PALADIN:
if (player->GetShield() && const_cast<Player*>(player)->GetSpec(player->GetActiveSpec()) == TALENT_TREE_PALADIN_PROTECTION)
return true;
break;
case CLASS_DRUID:
if ((player->GetShapeshiftForm() == FORM_BEAR || player->GetShapeshiftForm() == FORM_DIREBEAR) &&
const_cast<Player*>(player)->GetSpec(player->GetActiveSpec()) == TALENT_TREE_DRUID_FERAL_COMBAT)
return true;
break;
case CLASS_DEATH_KNIGHT:
if (player->GetAuraEffect(SPELL_AURA_MOD_THREAT, SPELLFAMILY_DEATHKNIGHT, 0x8000, 0x0, 0x0) && player->GetRatingBonusValue(CR_DEFENSE_SKILL) > 0.0f)
return true;
break;
default:
break;
}
}

return false;
Expand Down

0 comments on commit e15689c

Please sign in to comment.