mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
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.
113 lines
6.1 KiB
C++
113 lines
6.1 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 "GenericPriestStrategy.h"
|
|
|
|
#include "GenericPriestStrategyActionNodeFactory.h"
|
|
#include "HealPriestStrategy.h"
|
|
#include "Playerbots.h"
|
|
|
|
GenericPriestStrategy::GenericPriestStrategy(PlayerbotAI* botAI) : RangedCombatStrategy(botAI)
|
|
{
|
|
actionNodeFactories.Add(new GenericPriestStrategyActionNodeFactory());
|
|
}
|
|
|
|
void GenericPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
{
|
|
CombatStrategy::InitTriggers(triggers);
|
|
|
|
// triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("greater heal", 25.0f),
|
|
// nullptr))); triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("power word:
|
|
// shield", 61.0f), new NextAction("greater heal", 60.0f), nullptr))); triggers.push_back(new TriggerNode("critical
|
|
// health", NextAction::array(0, new NextAction("remove shadowform", 72.0f), new NextAction("power word:
|
|
// shield", 71.0f), new NextAction("flash heal", 70.0f), nullptr))); triggers.push_back(new TriggerNode("party
|
|
// member critical health", NextAction::array(0, new NextAction("remove shadowform", 62.0f), new NextAction("power
|
|
// word: shield on party", 61.0f), new NextAction("flash heal on party", 60.0f), nullptr)));
|
|
triggers.push_back(new TriggerNode("medium threat", NextAction::array(0, new NextAction("fade", 55.0f), nullptr)));
|
|
// triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("psychic
|
|
// scream", 50.0f), nullptr))); triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new
|
|
// NextAction("inner focus", 42.0f), nullptr))); triggers.push_back(new TriggerNode("medium mana",
|
|
// NextAction::array(0, new NextAction("symbol of hope", ACTION_EMERGENCY), nullptr))); triggers.push_back(new
|
|
// TriggerNode("low mana", NextAction::array(0, new NextAction("consume magic", 10.0f), nullptr)));
|
|
// triggers.push_back(
|
|
// new TriggerNode("inner focus", NextAction::array(0, new NextAction("inner focus", 42.0f), nullptr)));
|
|
triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("desperate prayer",
|
|
ACTION_HIGH + 5), nullptr)));
|
|
// triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new
|
|
// NextAction("elune's grace", ACTION_EMERGENCY), nullptr))); triggers.push_back(new TriggerNode("chastise",
|
|
// NextAction::array(0, new NextAction("chastise", ACTION_INTERRUPT), nullptr)));
|
|
triggers.push_back(new TriggerNode(
|
|
"critical health", NextAction::array(0, new NextAction("power word: shield", ACTION_NORMAL), NULL)));
|
|
|
|
triggers.push_back(
|
|
new TriggerNode("low health", NextAction::array(0, new NextAction("power word: shield", ACTION_HIGH), NULL)));
|
|
|
|
triggers.push_back(
|
|
new TriggerNode("medium mana",
|
|
NextAction::array(0,
|
|
new NextAction("shadowfiend", ACTION_HIGH + 2),
|
|
new NextAction("inner focus", ACTION_HIGH + 1), nullptr)));
|
|
|
|
triggers.push_back(
|
|
new TriggerNode("low mana", NextAction::array(0, new NextAction("hymn of hope", ACTION_HIGH), NULL)));
|
|
|
|
triggers.push_back(new TriggerNode("enemy too close for spell",
|
|
NextAction::array(0, new NextAction("flee", ACTION_MOVE + 9), nullptr)));
|
|
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr)));
|
|
triggers.push_back(new TriggerNode("being attacked",
|
|
NextAction::array(0, new NextAction("power word: shield", ACTION_HIGH + 1), nullptr)));
|
|
triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr)));
|
|
}
|
|
|
|
PriestCureStrategy::PriestCureStrategy(PlayerbotAI* botAI) : Strategy(botAI)
|
|
{
|
|
actionNodeFactories.Add(new CurePriestStrategyActionNodeFactory());
|
|
}
|
|
|
|
void PriestCureStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
{
|
|
triggers.push_back(
|
|
new TriggerNode("dispel magic", NextAction::array(0, new NextAction("dispel magic", 41.0f), nullptr)));
|
|
triggers.push_back(new TriggerNode("dispel magic on party",
|
|
NextAction::array(0, new NextAction("dispel magic on party", 40.0f), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("cure disease", NextAction::array(0, new NextAction("abolish disease", 31.0f), nullptr)));
|
|
triggers.push_back(new TriggerNode(
|
|
"party member cure disease", NextAction::array(0, new NextAction("abolish disease on party", 30.0f), nullptr)));
|
|
}
|
|
|
|
void PriestBoostStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
{
|
|
triggers.push_back(
|
|
new TriggerNode("power infusion", NextAction::array(0, new NextAction("power infusion", 41.0f), nullptr)));
|
|
triggers.push_back(new TriggerNode("boost", NextAction::array(0, new NextAction("shadowfiend", 20.0f), nullptr)));
|
|
}
|
|
|
|
void PriestCcStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
{
|
|
triggers.push_back(
|
|
new TriggerNode("shackle undead", NextAction::array(0, new NextAction("shackle undead", 31.0f), nullptr)));
|
|
}
|
|
|
|
void PriestHealerDpsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
{
|
|
triggers.push_back(
|
|
new TriggerNode("healer should attack",
|
|
NextAction::array(0,
|
|
new NextAction("shadow word: pain", ACTION_DEFAULT + 0.5f),
|
|
new NextAction("holy fire", ACTION_DEFAULT + 0.4f),
|
|
new NextAction("smite", ACTION_DEFAULT + 0.3f),
|
|
new NextAction("mind blast", ACTION_DEFAULT + 0.2f),
|
|
new NextAction("shoot", ACTION_DEFAULT),
|
|
nullptr)));
|
|
|
|
triggers.push_back(
|
|
new TriggerNode("medium aoe and healer should attack",
|
|
NextAction::array(0,
|
|
new NextAction("mind sear", ACTION_DEFAULT + 0.5f),
|
|
nullptr)));
|
|
}
|
|
|