Skip to content

Commit

Permalink
NPCBots: Rogue: implement Disarm Trap on BWL Suppression Device
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Mar 19, 2024
1 parent 4cf6abb commit aca56bf
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
32 changes: 32 additions & 0 deletions src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3885,6 +3885,7 @@ std::tuple<Unit*, Unit*> bot_ai::_getTargets(bool byspell, bool ranged, bool &re
//Immediate targets
if (!IAmFree() && me->GetMap()->GetEntry() && !me->GetMap()->GetEntry()->IsWorldMap())
{
static const std::array WMOAreaGroupLashlayer = { 29476u }; // Halls of Strife
static const std::array WMOAreaGroupMarrowgar = { 47833u }; // The Spire
static const std::array WMOAreaGroupSindragosa = { 48066u }; // Frost Queen's Lair
static const std::array WMOAreaGroupLichKing = { 50038u, 50040u }; // The Frozen Throne
Expand All @@ -3897,6 +3898,10 @@ std::tuple<Unit*, Unit*> bot_ai::_getTargets(bool byspell, bool ranged, bool &re
return false;
};

// Blackwing Lair
if (me->GetMapId() == 469 && GetBotClass() == BOT_CLASS_ROGUE && !HasRole(BOT_ROLE_DPS) && me->HasStealthAura() && isInWMOArea(WMOAreaGroupLashlayer)) // BWL - Bloodlord Lashlayer
return { nullptr, nullptr };

// Icecrown Citadel - Lord Marrowgar
if (me->GetMapId() == 631 && isInWMOArea(WMOAreaGroupMarrowgar) && me->IsInCombat() && HasRole(BOT_ROLE_DPS) && !IsTank())
{
Expand Down Expand Up @@ -4618,6 +4623,7 @@ bool bot_ai::ProcessImmediateNonAttackTarget()
if ((me->GetMap()->GetEntry() && me->GetMap()->GetEntry()->IsWorldMap()) || IAmFree() || IsCasting())
return false;

static constexpr std::array<uint32, 1> WMOAreaGroupLashlayer = { 29476 }; // Halls of Strife
static constexpr std::array<uint32, 2> WMOAreaGroupMuru = { 41736, 42759 }; // Shrine of the Eclipse
static constexpr std::array<uint32, 2> WMOAreaGroupNajentus = { 41129, 41130 }; // Karabor Sewers
static constexpr std::array<uint32, 1> WMOAreaGroupVashj = { 37594 }; // Serpentshrine Cavern
Expand All @@ -4631,6 +4637,32 @@ bool bot_ai::ProcessImmediateNonAttackTarget()
return false;
};

if (me->GetMapId() == 469 && GetBotClass() == BOT_CLASS_ROGUE && isInWMOArea(_lastWMOAreaId, WMOAreaGroupLashlayer)) // BWL - Bloodlord Lashlayer
{
static const uint32 SPELL_DISARM_TRAP_1 = 1842u;

if (!IsCasting() && IsSpellReady(SPELL_DISARM_TRAP_1, lastdiff, false) && (me->HasAuraType(SPELL_AURA_MOD_STEALTH) || IsSpellReady(1784, lastdiff, false)) && Rand() < 20) // Stealth
{
SpellInfo const* disarmTrapSpellInfo = sSpellMgr->AssertSpellInfo(SPELL_DISARM_TRAP_1);
float max_range = disarmTrapSpellInfo->GetMaxRange();
ApplyBotSpellRangeMods(disarmTrapSpellInfo, max_range);

std::list<GameObject*> goList;
Trinity::AllGameObjectsWithEntryInRange check(me, 179784, max_range); // Suppression Device
Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(me, goList, check);
Cell::VisitAllObjects(me, searcher, max_range);

goList.remove_if([](GameObject const* gobject) { return gobject->HasFlag(GO_FLAG_NOT_SELECTABLE); });

if (GameObject* device = goList.empty() ? nullptr : goList.size() == 1u ? goList.front() : Trinity::Containers::SelectRandomContainerElement(goList))
{
if (me->HasAuraType(SPELL_AURA_MOD_STEALTH) || doCast(me, GetSpell(1784)))
me->CastSpell(device, SPELL_DISARM_TRAP_1);
return true;
}
}
}

if (me->GetMapId() == 580 && isInWMOArea(_lastWMOAreaId, WMOAreaGroupMuru)) // Sunwell - M'uru
{
static const uint32 SPELL_PURGE_1 = 370u;
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/AI/NpcBots/bot_ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ class bot_ai : public CreatureAI
uint32 GetItemSpellCooldown(uint32 spellid) const;
void CheckUsableItems(uint32 diff);

uint32 GetLastWMOArea() const { return _lastWMOAreaId; }

Player* master;
Player* _prevRRobin;
Unit* opponent;
Expand Down
9 changes: 7 additions & 2 deletions src/server/game/AI/NpcBots/bot_rogue_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ enum RogueBaseSpells
AMBUSH_1 = 8676,

DISTRACT_1 = 1725, //NYI
DISARM_TRAP_1 = 1842, //Unused, see bot_ai::ProcessImmediateNonAttackTarget()

//Poisons
CRIPPLING_POISON_1 = 3408,
Expand Down Expand Up @@ -176,7 +177,7 @@ static const uint32 Rogue_spells_cc_arr[] =
static const uint32 Rogue_spells_support_arr[] =
{ /*EXPOSE_ARMOR_1, DISTRACT_1, PICK_LOCK_1,*/ STEALTH_1, ADRENALINE_RUSH_1, BLADE_FLURRY_1, CLOAK_OF_SHADOWS_1,
COLD_BLOOD_1, DISMANTLE_1, EVASION_1, FEINT_1, HUNGER_FOR_BLOOD_1, PREMEDITATION_1, PREPARATION_1, SHADOW_DANCE_1,
SHADOWSTEP_1, SLICE_DICE_1, SPRINT_1, TRICKS_OF_THE_TRADE_1, VANISH_1, THISTLE_TEA,
SHADOWSTEP_1, SLICE_DICE_1, SPRINT_1, TRICKS_OF_THE_TRADE_1, VANISH_1, DISARM_TRAP_1, THISTLE_TEA,
/*CRIPPLING_POISON_1, INSTANT_POISON_1, DEADLY_POISON_1, WOUND_POISON_1, MIND_NUMBING_POISON_1, ANESTHETIC_POISON_1*/ };

static const std::vector<uint32> Rogue_spells_damage(FROM_ARRAY(Rogue_spells_damage_arr));
Expand Down Expand Up @@ -296,7 +297,8 @@ class rogue_bot : public CreatureScript
if (!CheckAttackTarget())
{
if (!me->IsInCombat() && Rand() < 5 && me->HasAuraType(SPELL_AURA_MOD_STEALTH) &&
!me->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_ROGUE, 0x800, 0x0, 0x0)) //vanish
!me->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_ROGUE, 0x800, 0x0, 0x0) && //vanish
!(!HasRole(BOT_ROLE_DPS) && GetLastWMOArea() == 29476))
me->RemoveAurasDueToSpell(STEALTH_1);
return;
}
Expand Down Expand Up @@ -1317,6 +1319,8 @@ class rogue_bot : public CreatureScript
//Glyph of Ambush: + 5 yd range for Ambush
if (/*lvl >= 18 && */baseId == AMBUSH_1)
flatbonus += 5.f;
if (baseId == DISARM_TRAP_1)
flatbonus += 10.f;

maxrange = maxrange * (1.0f + pctbonus) + flatbonus;
}
Expand Down Expand Up @@ -1851,6 +1855,7 @@ class rogue_bot : public CreatureScript
//InitSpellMap(EXPOSE_ARMOR_1);
InitSpellMap(DISMANTLE_1);
InitSpellMap(FEINT_1);
InitSpellMap(DISARM_TRAP_1);

InitSpellMap(BACKSTAB_1);
InitSpellMap(SINISTER_STRIKE_1);
Expand Down
5 changes: 5 additions & 0 deletions src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,11 @@ void Spell::EffectOpenLock()
return;
}
}
else if (botGoInfo->type == GAMEOBJECT_TYPE_TRAP)
{
gameObjTarget->SetLootState(GO_ACTIVATED);
return;
}

return;
}
Expand Down

0 comments on commit aca56bf

Please sign in to comment.