Skip to content

Commit

Permalink
Fix druids not shapeshifting correctly when casting healing spells an…
Browse files Browse the repository at this point in the history
…d fixed strategies
  • Loading branch information
davidonete committed Jul 26, 2023
1 parent f67a3b1 commit 9072672
Show file tree
Hide file tree
Showing 10 changed files with 405 additions and 96 deletions.
2 changes: 1 addition & 1 deletion playerbot/strategy/actions/GenericSpellActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ NextAction** CastSpellAction::getPrerequisites()
}
}

return nullptr;
return Action::getPrerequisites();
}

void CastSpellAction::SetSpellName(const string& name, string spellIDContextName /*= "spell id"*/)
Expand Down
72 changes: 69 additions & 3 deletions playerbot/strategy/druid/BalanceDruidStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ void BalanceDruidStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers)
{
DruidStrategy::InitCombatTriggers(triggers);

triggers.push_back(new TriggerNode(
"rebirth on party",
NextAction::array(0, new NextAction("rebirth", ACTION_EMERGENCY), NULL)));

triggers.push_back(new TriggerNode(
"critical health",
NextAction::array(0, new NextAction("regrowth", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch on party", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"low health",
NextAction::array(0, new NextAction("regrowth", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"almost full health",
NextAction::array(0, new NextAction("rejuvenation", ACTION_LIGHT_HEAL), NULL)));
Expand Down Expand Up @@ -221,7 +243,7 @@ void BalanceDruidBuffStrategy::InitCombatTriggers(std::list<TriggerNode*>& trigg

triggers.push_back(new TriggerNode(
"moonkin form",
NextAction::array(0, new NextAction("moonkin form", ACTION_EMERGENCY), NULL)));
NextAction::array(0, new NextAction("moonkin form", ACTION_MOVE), NULL)));
}

void BalanceDruidBuffStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& triggers)
Expand Down Expand Up @@ -432,6 +454,28 @@ void BalanceDruidStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers)
{
DruidStrategy::InitCombatTriggers(triggers);

triggers.push_back(new TriggerNode(
"rebirth on party",
NextAction::array(0, new NextAction("rebirth", ACTION_EMERGENCY), NULL)));

triggers.push_back(new TriggerNode(
"critical health",
NextAction::array(0, new NextAction("regrowth", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch on party", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"low health",
NextAction::array(0, new NextAction("regrowth", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"almost full health",
NextAction::array(0, new NextAction("rejuvenation", ACTION_LIGHT_HEAL), NULL)));
Expand Down Expand Up @@ -605,7 +649,7 @@ void BalanceDruidBuffStrategy::InitCombatTriggers(std::list<TriggerNode*>& trigg

triggers.push_back(new TriggerNode(
"moonkin form",
NextAction::array(0, new NextAction("moonkin form", ACTION_EMERGENCY), NULL)));
NextAction::array(0, new NextAction("moonkin form", ACTION_MOVE), NULL)));
}

void BalanceDruidBuffStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& triggers)
Expand Down Expand Up @@ -816,6 +860,28 @@ void BalanceDruidStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers)
{
DruidStrategy::InitCombatTriggers(triggers);

triggers.push_back(new TriggerNode(
"rebirth on party",
NextAction::array(0, new NextAction("rebirth", ACTION_EMERGENCY), NULL)));

triggers.push_back(new TriggerNode(
"critical health",
NextAction::array(0, new NextAction("regrowth", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch on party", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"low health",
NextAction::array(0, new NextAction("regrowth", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"almost full health",
NextAction::array(0, new NextAction("rejuvenation", ACTION_LIGHT_HEAL), NULL)));
Expand Down Expand Up @@ -997,7 +1063,7 @@ void BalanceDruidBuffStrategy::InitCombatTriggers(std::list<TriggerNode*>& trigg

triggers.push_back(new TriggerNode(
"moonkin form",
NextAction::array(0, new NextAction("moonkin form", ACTION_EMERGENCY), NULL)));
NextAction::array(0, new NextAction("moonkin form", ACTION_MOVE), NULL)));
}

void BalanceDruidBuffStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& triggers)
Expand Down
72 changes: 69 additions & 3 deletions playerbot/strategy/druid/DpsFeralDruidStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,28 @@ void DpsFeralDruidStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers
{
DruidStrategy::InitCombatTriggers(triggers);

triggers.push_back(new TriggerNode(
"rebirth on party",
NextAction::array(0, new NextAction("rebirth", ACTION_EMERGENCY), NULL)));

triggers.push_back(new TriggerNode(
"critical health",
NextAction::array(0, new NextAction("regrowth", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch on party", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"low health",
NextAction::array(0, new NextAction("regrowth", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"faerie fire (feral)",
NextAction::array(0, new NextAction("faerie fire (feral)", ACTION_NORMAL + 5), NULL)));
Expand Down Expand Up @@ -281,7 +303,7 @@ void DpsFeralDruidBuffStrategy::InitCombatTriggers(std::list<TriggerNode*>& trig

triggers.push_back(new TriggerNode(
"cat form",
NextAction::array(0, new NextAction("cat form", ACTION_EMERGENCY), NULL)));
NextAction::array(0, new NextAction("cat form", ACTION_MOVE), NULL)));

triggers.push_back(new TriggerNode(
"tiger's fury",
Expand Down Expand Up @@ -567,6 +589,28 @@ void DpsFeralDruidStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers
{
DruidStrategy::InitCombatTriggers(triggers);

triggers.push_back(new TriggerNode(
"rebirth on party",
NextAction::array(0, new NextAction("rebirth", ACTION_EMERGENCY), NULL)));

triggers.push_back(new TriggerNode(
"critical health",
NextAction::array(0, new NextAction("regrowth", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch on party", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"low health",
NextAction::array(0, new NextAction("regrowth", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"faerie fire (feral)",
NextAction::array(0, new NextAction("faerie fire (feral)", ACTION_HIGH + 2), NULL)));
Expand Down Expand Up @@ -775,7 +819,7 @@ void DpsFeralDruidBuffStrategy::InitCombatTriggers(std::list<TriggerNode*>& trig

triggers.push_back(new TriggerNode(
"cat form",
NextAction::array(0, new NextAction("cat form", ACTION_EMERGENCY), NULL)));
NextAction::array(0, new NextAction("cat form", ACTION_MOVE), NULL)));

triggers.push_back(new TriggerNode(
"tiger's fury",
Expand Down Expand Up @@ -1061,6 +1105,28 @@ void DpsFeralDruidStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers
{
DruidStrategy::InitCombatTriggers(triggers);

triggers.push_back(new TriggerNode(
"rebirth on party",
NextAction::array(0, new NextAction("rebirth", ACTION_EMERGENCY), NULL)));

triggers.push_back(new TriggerNode(
"critical health",
NextAction::array(0, new NextAction("regrowth", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch on party", ACTION_CRITICAL_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"low health",
NextAction::array(0, new NextAction("regrowth", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0, new NextAction("regrowth on party", ACTION_MEDIUM_HEAL), NULL)));

triggers.push_back(new TriggerNode(
"enemy out of melee",
NextAction::array(0, new NextAction("feral charge - cat", ACTION_MOVE), NULL)));
Expand Down Expand Up @@ -1273,7 +1339,7 @@ void DpsFeralDruidBuffStrategy::InitCombatTriggers(std::list<TriggerNode*>& trig

triggers.push_back(new TriggerNode(
"cat form",
NextAction::array(0, new NextAction("cat form", ACTION_EMERGENCY), NULL)));
NextAction::array(0, new NextAction("cat form", ACTION_MOVE), NULL)));

triggers.push_back(new TriggerNode(
"tiger's fury",
Expand Down
5 changes: 0 additions & 5 deletions playerbot/strategy/druid/DruidActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ namespace ai
{
public:
CastRebirthAction(PlayerbotAI* ai) : ResurrectPartyMemberAction(ai, "rebirth") {}

virtual NextAction** getPrerequisites()
{
return NextAction::merge( NextAction::array(0, new NextAction("caster form"), NULL), ResurrectPartyMemberAction::getPrerequisites());
}
};

BUFF_ACTION(CastMarkOfTheWildAction, "mark of the wild");
Expand Down
4 changes: 4 additions & 0 deletions playerbot/strategy/druid/DruidAiObjectContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ namespace ai
creators["no stealth"] = &TriggerFactoryInternal::no_stealth;
creators["stealth"] = &TriggerFactoryInternal::stealth;
creators["powershift"] = &TriggerFactoryInternal::powershift;
creators["rebirth on party"] = &TriggerFactoryInternal::rebirth_on_party;
creators["innervate self"] = &TriggerFactoryInternal::innervate_self;
}

private:
Expand Down Expand Up @@ -371,6 +373,8 @@ namespace ai
static Trigger* no_stealth(PlayerbotAI* ai) { return new NoStealthTrigger(ai); }
static Trigger* stealth(PlayerbotAI* ai) { return new StealthTrigger(ai); }
static Trigger* powershift(PlayerbotAI* ai) { return new PowershiftTrigger(ai); }
static Trigger* rebirth_on_party(PlayerbotAI* ai) { return new RebirthOnPartyTrigger(ai); }
static Trigger* innervate_self(PlayerbotAI* ai) { return new InnervateSelfTrigger(ai); }
};

class AiObjectContextInternal : public NamedObjectContext<Action>
Expand Down
Loading

0 comments on commit 9072672

Please sign in to comment.