mod-playerbots/src/Ai/Class/Druid/Action/DruidShapeshiftActions.cpp
kadeshar 98395a1090
Added cancellation druid form actions (#2194)
# Pull Request

Added new (for now manual) actions to cancel druid forms. 
Resolve: https://github.com/mod-playerbots/mod-playerbots/issues/1788

---

## Feature Evaluation

Please answer the following:

- order bot enter some form like `do travel form`
- order bot cancel form like `do cancel travel form`

---

## How to Test the Changes

- order bot enter some form like `do travel form`
- order bot cancel form like `do cancel travel form`

## Complexity & Impact

Does this change add new decision branches?
- - [x] No
- - [ ] Yes (**explain below**)

Does this change increase per-bot or per-tick processing?
- - [x] No
- - [ ] Yes (**describe and justify impact**)

Could this logic scale poorly under load?
- - [x] No
- - [ ] Yes (**explain why**)
---

## Defaults & Configuration

Does this change modify default bot behavior?
- - [x] No
- - [ ] Yes (**explain why**)
- 
---

## AI Assistance

Was AI assistance (e.g. ChatGPT or similar tools) used while working on
this change?
- - [x] No
- - [ ] Yes (**explain below**)

---

## Final Checklist

- - [x] Stability is not compromised
- - [x] Performance impact is understood, tested, and acceptable
- - [x] Added logic complexity is justified and explained
- - [x] Documentation updated if needed

---
2026-03-20 20:42:22 +01:00

59 lines
1.7 KiB
C++

/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#include "DruidShapeshiftActions.h"
#include "Playerbots.h"
bool CastBearFormAction::isUseful()
{
return CastBuffSpellAction::isUseful() && !botAI->HasAura("dire bear form", GetTarget());
}
bool CastBearFormAction::isPossible()
{
return CastBuffSpellAction::isPossible() && !botAI->HasAura("dire bear form", GetTarget());
}
std::vector<NextAction> CastDireBearFormAction::getAlternatives()
{
return NextAction::merge({NextAction("bear form")}, CastSpellAction::getAlternatives());
}
bool CastTravelFormAction::isUseful()
{
bool firstmount = bot->GetLevel() >= 20;
// useful if no mount or with wsg flag
return !bot->IsMounted() && (!firstmount || (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976))) &&
!botAI->HasAura("dash", bot);
}
bool CastCasterFormAction::Execute(Event /*event*/)
{
botAI->RemoveShapeshift();
return true;
}
bool CastCasterFormAction::isUseful()
{
return botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form",
"flight form", "swift flight form", "moonkin form", nullptr) &&
AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig.mediumHealth;
}
bool CastCancelDruidAction::Execute(Event /*event*/)
{
botAI->RemoveAura(auraName);
return true;
}
bool CastCancelDruidAction::isUseful() { return botAI->HasAura(auraId, bot); }
bool CastTreeFormAction::isUseful()
{
return GetTarget() && CastSpellAction::isUseful() && !botAI->HasAura(33891, bot);
}