diff --git a/playerbot/PlayerbotAI.cpp b/playerbot/PlayerbotAI.cpp index bd431f2c..cb4aaeec 100644 --- a/playerbot/PlayerbotAI.cpp +++ b/playerbot/PlayerbotAI.cpp @@ -2898,12 +2898,12 @@ bool PlayerbotAI::HasSpell(uint32 spellid) const return false; } -bool PlayerbotAI::CanCastSpell(std::string name, Unit* target, uint8 effectMask, Item* itemTarget, bool ignoreRange, bool ignoreInCombat) +bool PlayerbotAI::CanCastSpell(std::string name, Unit* target, uint8 effectMask, Item* itemTarget, bool ignoreRange, bool ignoreInCombat, bool ignoreMount) { - return CanCastSpell(aiObjectContext->GetValue("spell id", name)->Get(), target, 0, true, itemTarget, ignoreRange, ignoreInCombat); + return CanCastSpell(aiObjectContext->GetValue("spell id", name)->Get(), target, 0, true, itemTarget, ignoreRange, ignoreInCombat, ignoreMount); } -bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, uint8 effectMask, bool checkHasSpell, Item* itemTarget, bool ignoreRange, bool ignoreInCombat) +bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, uint8 effectMask, bool checkHasSpell, Item* itemTarget, bool ignoreRange, bool ignoreInCombat, bool ignoreMount) { if (!spellid) return false; @@ -3027,12 +3027,14 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, uint8 effectMask, b return ignoreReagents; case SPELL_FAILED_AFFECTING_COMBAT: return ignoreInCombat; + case SPELL_FAILED_NOT_MOUNTED: + return ignoreMount; default: return false; } } -bool PlayerbotAI::CanCastSpell(uint32 spellid, GameObject* goTarget, uint8 effectMask, bool checkHasSpell, bool ignoreRange, bool ignoreInCombat) +bool PlayerbotAI::CanCastSpell(uint32 spellid, GameObject* goTarget, uint8 effectMask, bool checkHasSpell, bool ignoreRange, bool ignoreInCombat, bool ignoreMount) { if (!spellid) return false; @@ -3103,12 +3105,14 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, GameObject* goTarget, uint8 effec return ignoreReagents; case SPELL_FAILED_AFFECTING_COMBAT: return ignoreInCombat; + case SPELL_FAILED_NOT_MOUNTED: + return ignoreMount; default: return false; } } -bool PlayerbotAI::CanCastSpell(uint32 spellid, float x, float y, float z, uint8 effectMask, bool checkHasSpell, Item* itemTarget, bool ignoreRange, bool ignoreInCombat) +bool PlayerbotAI::CanCastSpell(uint32 spellid, float x, float y, float z, uint8 effectMask, bool checkHasSpell, Item* itemTarget, bool ignoreRange, bool ignoreInCombat, bool ignoreMount) { if (!spellid) return false; @@ -3166,6 +3170,8 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, float x, float y, float z, uint8 return ignoreReagents; case SPELL_FAILED_AFFECTING_COMBAT: return ignoreInCombat; + case SPELL_FAILED_NOT_MOUNTED: + return ignoreMount; default: return false; } diff --git a/playerbot/PlayerbotAI.h b/playerbot/PlayerbotAI.h index c2965a9a..31dd73ae 100644 --- a/playerbot/PlayerbotAI.h +++ b/playerbot/PlayerbotAI.h @@ -393,10 +393,10 @@ class PlayerbotAI : public PlayerbotAIBase Aura* GetAura(std::string spellName, Unit* player, bool checkOwner = false); std::vector GetAuras(Unit* player); - virtual bool CanCastSpell(std::string name, Unit* target, uint8 effectMask, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false); - bool CanCastSpell(uint32 spellid, Unit* target, uint8 effectMask, bool checkHasSpell = true, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false); - bool CanCastSpell(uint32 spellid, GameObject* goTarget, uint8 effectMask, bool checkHasSpell = true, bool ignoreRange = false, bool ignoreInCombat = false); - bool CanCastSpell(uint32 spellid, float x, float y, float z, uint8 effectMask, bool checkHasSpell = true, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false); + virtual bool CanCastSpell(std::string name, Unit* target, uint8 effectMask, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false, bool ignoreMount = false); + bool CanCastSpell(uint32 spellid, Unit* target, uint8 effectMask, bool checkHasSpell = true, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false, bool ignoreMount = false); + bool CanCastSpell(uint32 spellid, GameObject* goTarget, uint8 effectMask, bool checkHasSpell = true, bool ignoreRange = false, bool ignoreInCombat = false, bool ignoreMount = false); + bool CanCastSpell(uint32 spellid, float x, float y, float z, uint8 effectMask, bool checkHasSpell = true, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false, bool ignoreMount = false); bool CanCastVehicleSpell(uint32 spellid, Unit* target); virtual bool CastSpell(std::string name, Unit* target, Item* itemTarget = NULL, bool waitForSpell = true, uint32* outSpellDuration = NULL, bool canUseReagentCheat = true); diff --git a/playerbot/strategy/actions/ReachTargetActions.h b/playerbot/strategy/actions/ReachTargetActions.h index 61e63846..a394a6cc 100644 --- a/playerbot/strategy/actions/ReachTargetActions.h +++ b/playerbot/strategy/actions/ReachTargetActions.h @@ -84,7 +84,7 @@ namespace ai if (!bot->IsNonMeleeSpellCasted(true, false, true)) { // Check if the spell for which the reach action is used for can be casted - if (!spellName.empty() && !ai->CanCastSpell(spellName, target, true, nullptr, true, true)) + if (!spellName.empty() && !ai->CanCastSpell(spellName, target, true, nullptr, true, true, true)) { return false; }