Files
mod-playerbots/src/strategy/priest/PriestNonCombatStrategy.cpp
ThePenguinMan96 aa6f8153a1 Tame Chat Action / Pet Chat Action (stances/commands)
Hello everyone,

I am on a quest to make bot's pets completely functional, focuses on solving issues #1351 , #1230 , and #1137 . This PR achieves the following:

1. Changes the current "pet" chat command to "tame", which is more intuitive that only hunters can use it. The modes are "tame name (name)", "tame id (id)", "tame family (family)", "tame rename (new name)", and "tame abandon". Tame abandon is new - it simply abandons the current pet. Also, now, if you type in "tame family" by itself, it will list the available families. See pictures below for examples.
2. Added new "pet" chat command, with the following modes: "pet passive", "pet aggressive", "pet defensive", "pet stance" (shows current pet stance), "pet attack", "pet follow", and "pet stay". Previously, the pet's stance was not changeable, and there were some less than desired effects from summonable pets - see the issues above.
3. New config option: AiPlayerbot.DefaultPetStance, which changes the stance that all bot's pets are summoned as. This makes sure when feral spirits or treants are summoned by shamans and druids, they are immediately set to this configured stance. Set as 1 as default, which is defensive. (0 = Passive, 1 = Defensive, 2 = Aggressive)
4. New config option: AiPlayerbot.PetChatCommandDebug, which enables debug messages for the "pet" chat command. By default it is set to 0, which is disabled, but if you would like to see when pet's stances are changed, or when you tell the pet to attack/follow/stay, and when pet spells are auto-toggled, this is an option. I made this for myself mainly to test the command - if anyone notices any wierd pet behavior, this will be an option to help them report it as well.
5. Modified FollowActions to not constantly execute the petfollow action, overriding any stay or attack commands issued.
6. Modified GenericActions to have TogglePetSpellAutoCastAction optionally log when spells are toggled based on AiPlayerbot.PetChatCommandDebug.
7. Modified PetAttackAction to not attack if the pet is set to passive, and not override the pet's stance to passive every time it was executed.
8. Modified CombatStrategy.cpp to not constantly issue the petattack command, respecting the "pet stay" and "pet follow" commands. Pets will still automatically attack the enemy if set to aggressive or defensive.
9. Warlocks, Priests, Hunters, Shamans, Mages, Druids, and DKs (all classes that have summons): Added a "new pet" trigger that executes the "set pet stance" action. The "new pet" trigger happens only once, upon summoning a pet. It sets the pet's stance from AiPlayerbot.DefaultPetStance's value.
2025-08-01 01:18:16 -07:00

96 lines
5.7 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 "PriestNonCombatStrategy.h"
#include "Playerbots.h"
#include "PriestNonCombatStrategyActionNodeFactory.h"
PriestNonCombatStrategy::PriestNonCombatStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI)
{
actionNodeFactories.Add(new PriestNonCombatStrategyActionNodeFactory());
}
void PriestNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
NonCombatStrategy::InitTriggers(triggers);
// triggers.push_back(new TriggerNode("power word: fortitude", NextAction::array(0, new NextAction("power word:
// fortitude", 12.0f), nullptr))); triggers.push_back(new TriggerNode("divine spirit", NextAction::array(0, new
// NextAction("divine spirit", 14.0f), nullptr)));
triggers.push_back(
new TriggerNode("inner fire", NextAction::array(0, new NextAction("inner fire", 10.0f), nullptr)));
// triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("greater heal", 70.0f),
// nullptr))); triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, new
// NextAction("greater heal on party", 60.0f), nullptr))); triggers.push_back(new TriggerNode("medium health",
// NextAction::array(0, new NextAction("renew", 41.0f), nullptr))); triggers.push_back(new TriggerNode("party member
// medium health", NextAction::array(0, new NextAction("renew on party", 40.0f), nullptr))); triggers.push_back(new
// TriggerNode("medium aoe heal", NextAction::array(0, new NextAction("lightwell", 42.f), nullptr)));
triggers.push_back(new TriggerNode(
"party member dead", NextAction::array(0, new NextAction("remove shadowform", ACTION_CRITICAL_HEAL + 11),
new NextAction("resurrection", ACTION_CRITICAL_HEAL + 10), nullptr)));
// triggers.push_back(new TriggerNode("swimming", NextAction::array(0, new NextAction("levitate", 1.0f), nullptr)));
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr)));
triggers.push_back(
new TriggerNode("party member critical health",
NextAction::array(0, new NextAction("renew on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("penance on party", ACTION_CRITICAL_HEAL + 2),
new NextAction("greater heal on party", ACTION_CRITICAL_HEAL + 1), NULL)));
triggers.push_back(
new TriggerNode("party member low health",
NextAction::array(0, new NextAction("renew on party", ACTION_MEDIUM_HEAL + 3),
new NextAction("penance on party", ACTION_MEDIUM_HEAL + 2),
new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 1), NULL)));
triggers.push_back(
new TriggerNode("party member medium health",
NextAction::array(0, new NextAction("renew on party", ACTION_LIGHT_HEAL + 9),
new NextAction("penance on party", ACTION_LIGHT_HEAL + 8), NULL)));
triggers.push_back(
new TriggerNode("party member almost full health",
NextAction::array(0, new NextAction("renew on party", ACTION_LIGHT_HEAL + 3), NULL)));
triggers.push_back(
new TriggerNode("group heal setting", NextAction::array(0, new NextAction("circle of healing on party", 27.0f), NULL)));
triggers.push_back(new TriggerNode("new pet",
NextAction::array(0, new NextAction("set pet stance", 10.0f), nullptr)));
}
void PriestBuffStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
NonCombatStrategy::InitTriggers(triggers);
triggers.push_back(
new TriggerNode("prayer of fortitude on party",
NextAction::array(0, new NextAction("prayer of fortitude on party", 12.0f), nullptr)));
triggers.push_back(
new TriggerNode("prayer of spirit on party",
NextAction::array(0, new NextAction("prayer of spirit on party", 14.0f), nullptr)));
triggers.push_back(
new TriggerNode("power word: fortitude on party",
NextAction::array(0, new NextAction("power word: fortitude on party", 11.0f), nullptr)));
triggers.push_back(new TriggerNode("divine spirit on party",
NextAction::array(0, new NextAction("divine spirit on party", 13.0f), nullptr)));
// triggers.push_back(new TriggerNode("fear ward", NextAction::array(0, new NextAction("fear ward", 10.0f),
// nullptr))); triggers.push_back(new TriggerNode("touch of weakness", NextAction::array(0, new NextAction("touch of
// weakness", 10.0f), nullptr))); triggers.push_back(new TriggerNode("shadowguard", NextAction::array(0, new
// NextAction("shadowguard", 10.0f), nullptr)));
}
void PriestShadowResistanceStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
NonCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("shadow protection",
NextAction::array(0, new NextAction("shadow protection", 12.0f), nullptr)));
triggers.push_back(
new TriggerNode("shadow protection on party",
NextAction::array(0, new NextAction("shadow protection on party", 11.0f), nullptr)));
// triggers.push_back(new TriggerNode("shadow protection on party", NextAction::array(0, new NextAction("shadow
// protection on party", 10.0f), nullptr)));
}