Skip to content

Commit

Permalink
Warrior: Proper stance logic for Sweeping Strikes (#128)
Browse files Browse the repository at this point in the history
* Warrior: Prebuilt arms weapon specialization talents

* Warrior: Proper stance logic for Sweeping Strikes

Stance Dance:
Arms Warrior pools rage in Battle Stance until Sweeping Strikes is castable until returning back to Berserk Stance

* PvE/PvP/Raid logic + Code cleanup

* Ignore mortal strike and heroic strike while pooling rage

* Update ArmsWarriorStrategy.cpp

* Disable Battle Stance spam if SS is on cooldown
  • Loading branch information
ileboii authored Jan 21, 2025
1 parent c4db64c commit d8b897d
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 1 deletion.
114 changes: 113 additions & 1 deletion playerbot/strategy/warrior/ArmsWarriorStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,4 +1033,116 @@ void ArmsWarriorCcRaidStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& t
WarriorCcRaidStrategy::InitNonCombatTriggers(triggers);
}

#endif
#endif

class WarriorSweepingStrikesPveMultiplier : public Multiplier
{
public:
WarriorSweepingStrikesPveMultiplier(PlayerbotAI* ai) : Multiplier(ai, "aoe arms pve") {}

float GetValue(Action* action) override
{
// Disable Berserker Stance
const std::string& actionName = action->getName();
if ((actionName == "berserker stance" ||
actionName == "whirlwind" ||
actionName == "mortal strike" ||
actionName == "heroic strike" ||
actionName == "cleave") &&
AI_VALUE2(bool, "trigger active", "melee light aoe") &&
bot->HasSpell(12292) &&
bot->IsSpellReady(12292) &&
!bot->HasAura(12292))
{
return 0.0f;
}

// Disable Battle Stance spam if SS is on CD
if ((actionName == "battle stance") &&
AI_VALUE2(bool, "trigger active", "melee light aoe") &&
bot->HasSpell(12292) &&
!bot->IsSpellReady(12292))
{
return 0.0f;
}

return 1.0f;
}
};

class WarriorSweepingStrikesRaidMultiplier : public Multiplier
{
public:
WarriorSweepingStrikesRaidMultiplier(PlayerbotAI* ai) : Multiplier(ai, "aoe arms raid") {}

float GetValue(Action* action) override
{
// Disable Berserker Stance
const std::string& actionName = action->getName();
if ((actionName == "berserker stance" ||
actionName == "whirlwind" ||
actionName == "mortal strike" ||
actionName == "heroic strike" ||
actionName == "cleave") &&
AI_VALUE2(bool, "trigger active", "melee light aoe") &&
bot->HasSpell(12292) &&
bot->IsSpellReady(12292) &&
!bot->HasAura(12292))
{
return 0.0f;
}

// Disable Battle Stance spam if SS is on CD
if ((actionName == "battle stance") &&
AI_VALUE2(bool, "trigger active", "melee light aoe") &&
bot->HasSpell(12292) &&
!bot->IsSpellReady(12292))
{
return 0.0f;
}

return 1.0f;
}
};

class WarriorSweepingStrikesPvpMultiplier : public Multiplier
{
public:
WarriorSweepingStrikesPvpMultiplier(PlayerbotAI* ai) : Multiplier(ai, "aoe arms pvp") {}

float GetValue(Action* action) override
{
// Disable Berserker Stance
const std::string& actionName = action->getName();
if ((actionName == "berserker stance" ||
actionName == "whirlwind" ||
actionName == "mortal strike" ||
actionName == "heroic strike" ||
actionName == "cleave") &&
AI_VALUE2(bool, "trigger active", "melee light aoe") &&
bot->HasSpell(12292) &&
bot->IsSpellReady(12292) &&
!bot->HasAura(12292))
{
return 0.0f;
}

// Disable Battle Stance spam if SS is on CD
if ((actionName == "battle stance") &&
AI_VALUE2(bool, "trigger active", "melee light aoe") &&
bot->HasSpell(12292) &&
!bot->IsSpellReady(12292))
{
return 0.0f;
}

return 1.0f;
}
};

void ArmsWarriorAoeStrategy::InitCombatMultipliers(std::list<Multiplier*>& multipliers)
{
multipliers.push_back(new WarriorSweepingStrikesPveMultiplier(ai));
multipliers.push_back(new WarriorSweepingStrikesRaidMultiplier(ai));
multipliers.push_back(new WarriorSweepingStrikesPvpMultiplier(ai));
}
1 change: 1 addition & 0 deletions playerbot/strategy/warrior/ArmsWarriorStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ namespace ai

protected:
virtual void InitCombatTriggers(std::list<TriggerNode*>& triggers) override;
void InitCombatMultipliers(std::list<Multiplier*>& multipliers);

This comment has been minimized.

Copy link
@Exxenoz

Exxenoz Jan 21, 2025

Member

Missing virtual ... override?

This comment has been minimized.

Copy link
@ileboii

ileboii Jan 21, 2025

Author Contributor

This is how multipliers was done for other classes too and the system works. But I will consult other mangosbot devs about this.

This comment has been minimized.

Copy link
@ileboii

ileboii Jan 21, 2025

Author Contributor

All right, I got a quick reply from mostlikely who's been insanely helpful helping me learning coding the whole time. He recommened adding virtual + override as well. I will do another PR shortly and fix this stuff for other classes' multipliers if needed as well.

virtual void InitNonCombatTriggers(std::list<TriggerNode*>& triggers) override;
};

Expand Down

0 comments on commit d8b897d

Please sign in to comment.