Files
mod-playerbots/src/strategy/rogue/RogueTriggers.cpp
avirar 739a0df44c Warrior strategy update (#838)
* Enraged regen at critial health

* Enraged regen action context

* Enraged regen on critical health trigger

* Enraged regen on critical health trigger

* Added logic for Arms to use Retaliation

* Added logic for Arms to use Retaliation

* Used correct class enums for !players

* Retaliation on medium health

* Removed temp line

* Added check for attacker->GetVictim() != bot

* Adjusted triggers for emergency actions

* Added Shattering Throw logic

* Added Shattering Throw logic

* Added Shattering Throw logic

* Added Shattering Throw logic

* Added Shattering Throw logic

* Added Shattering Throw logic

* Fixed ActionNode for Shattering Throw

* Added debug logging

* More debug logs

* Better debug logs

* Adjusted range on action

* Adjusted priorities

* More logging

* Update WarriorActions.cpp

* Update WarriorActions.h

* Changed trigger name for differentiation

* Updated to new shattering throw trigger name

* Update WarriorTriggers.h with new ST name

* Update ArmsWarriorStrategy.cpp

* Changed priority

* Shattering Throw and Retaliation stance reqs

Battlestance needed for Shattering Throw and Retaliation

* Created isUseful for Shattering Throw

* Created isUseful for Shattering Throw

* GetTarget instead of GetTargetValue

* Changed to GetTarget instead of GetTargetValue

* Commented out Execute function

* Commented out Execute function

* isPossible was failing, created basic isPossible

IsImmuneToSpell was returning true for Shattering Throw

2 DAYS! :(

* isPossible was failing, created basic isPossible

* Added some more isPossible checks

* Update WarriorActions.cpp

* Missing )

* Missing !

* Removed logging

* Removed logging

* Clean up

* Cleanup

* Corrected logic for Rogue's Expose Armor trigger

Logic was checking the Rogue, not the Rogue's target, for Sunder Armor before casting Expose Armor.
2025-01-03 16:06:47 +01:00

128 lines
3.8 KiB
C++

/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "RogueTriggers.h"
#include "GenericTriggers.h"
#include "Playerbots.h"
#include "ServerFacade.h"
// bool AdrenalineRushTrigger::isPossible()
// {
// return !botAI->HasAura("stealth", bot);
// }
bool UnstealthTrigger::IsActive()
{
if (!botAI->HasAura("stealth", bot))
return false;
return botAI->HasAura("stealth", bot) && !AI_VALUE(uint8, "attacker count") &&
(AI_VALUE2(bool, "moving", "self target") &&
((botAI->GetMaster() &&
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "master target"), 10.0f) &&
AI_VALUE2(bool, "moving", "master target")) ||
!AI_VALUE(uint8, "attacker count")));
}
bool StealthTrigger::IsActive()
{
if (botAI->HasAura("stealth", bot) || bot->IsInCombat() || bot->HasSpellCooldown(1784))
return false;
float distance = 30.f;
Unit* target = AI_VALUE(Unit*, "enemy player target");
if (target && !target->IsInWorld())
{
return false;
}
if (!target)
target = AI_VALUE(Unit*, "grind target");
if (!target)
target = AI_VALUE(Unit*, "dps target");
if (!target)
return false;
if (target && target->GetVictim())
distance -= 10;
if (target->isMoving() && target->GetVictim())
distance -= 10;
if (bot->InBattleground())
distance += 15;
if (bot->InArena())
distance += 15;
return target && sServerFacade->GetDistance2d(bot, target) < distance;
}
bool SapTrigger::IsPossible() { return bot->GetLevel() > 10 && bot->HasSpell(6770) && !bot->IsInCombat(); }
bool SprintTrigger::IsPossible() { return bot->HasSpell(2983); }
bool SprintTrigger::IsActive()
{
if (bot->HasSpellCooldown(2983))
return false;
float distance = botAI->GetMaster() ? 45.0f : 35.0f;
if (botAI->HasAura("stealth", bot))
distance -= 10;
bool targeted = false;
Unit* dps = AI_VALUE(Unit*, "dps target");
Unit* enemyPlayer = AI_VALUE(Unit*, "enemy player target");
if (enemyPlayer && !enemyPlayer->IsInWorld())
{
return false;
}
if (dps)
targeted = (dps == AI_VALUE(Unit*, "current target"));
if (enemyPlayer && !targeted)
targeted = (enemyPlayer == AI_VALUE(Unit*, "current target"));
if (!targeted)
return false;
if ((dps && dps->IsInCombat()) || enemyPlayer)
distance -= 10;
return AI_VALUE2(bool, "moving", "self target") &&
(AI_VALUE2(bool, "moving", "dps target") || AI_VALUE2(bool, "moving", "enemy player target")) && targeted &&
(sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), distance) ||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), distance));
}
bool ExposeArmorTrigger::IsActive()
{
Unit* target = AI_VALUE(Unit*, "current target"); // Get the bot's current target
return DebuffTrigger::IsActive() && !botAI->HasAura("sunder armor", target, false, false, -1, true) &&
AI_VALUE2(uint8, "combo", "current target") <= 3;
}
bool MainHandWeaponNoEnchantTrigger::IsActive()
{
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return false;
return true;
}
bool OffHandWeaponNoEnchantTrigger::IsActive()
{
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return false;
return true;
}