[Spell] Handle tree of life and assist dps

This commit is contained in:
Yunfan Li
2024-10-04 01:49:57 +08:00
parent 008d098eda
commit a0dd00bba1
13 changed files with 117 additions and 67 deletions

View File

@@ -9,6 +9,8 @@
#include "BattlegroundWS.h"
#include "CreatureAI.h"
#include "GameTime.h"
#include "LastSpellCastValue.h"
#include "ObjectGuid.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h"
@@ -372,23 +374,28 @@ bool HealerShouldAttackTrigger::IsActive()
if (botAI->GetNearGroupMemberCount(sPlayerbotAIConfig->sightDistance) <= 1)
return true;
bool almostFullMana = AI_VALUE2(bool, "has mana", "self target") &&
AI_VALUE2(uint8, "mana", "self target") < 85;
// high pressure
if (AI_VALUE(uint8, "balance") <= 50 && almostFullMana)
if (AI_VALUE2(uint8, "health", "party member to heal") < sPlayerbotAIConfig->almostFullHealth)
return false;
bool highMana = AI_VALUE2(bool, "has mana", "self target") &&
AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig->highMana;
// special check for resto druid (dont remove tree of life frequently)
if (bot->GetAura(33891))
{
LastSpellCast& lastSpell = botAI->GetAiObjectContext()->GetValue<LastSpellCast&>("last spell cast")->Get();
if (lastSpell.timer + 5 > time(nullptr))
return false;
}
if (AI_VALUE(uint8, "balance") <= 100 && highMana)
return false;
bool mediumMana = AI_VALUE2(bool, "has mana", "self target") &&
AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig->mediumMana;
int manaThreshold;
int balance = AI_VALUE(uint8, "balance");
// higher threshold in higher pressure
if (balance <= 50)
manaThreshold = 85;
else if (balance <= 100)
manaThreshold = sPlayerbotAIConfig->highMana;
else
manaThreshold = sPlayerbotAIConfig->mediumMana;
if (mediumMana)
if (AI_VALUE2(bool, "has mana", "self target") && AI_VALUE2(uint8, "mana", "self target") < manaThreshold)
return false;
return true;