[Assist Dps] Healer assist dps strats

This commit is contained in:
Yunfan Li
2024-10-03 22:35:26 +08:00
parent 11ce70635d
commit 008d098eda
31 changed files with 253 additions and 68 deletions

View File

@@ -76,7 +76,7 @@ bool AlmostFullManaTrigger::IsActive()
bool EnoughManaTrigger::IsActive()
{
return AI_VALUE2(bool, "has mana", "self target") && AI_VALUE2(uint8, "mana", "self target") > 65;
return AI_VALUE2(bool, "has mana", "self target") && AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig->highMana;
}
bool RageAvailable::IsActive() { return AI_VALUE2(uint8, "rage", "self target") >= amount; }
@@ -366,6 +366,34 @@ bool GenericBoostTrigger::IsActive()
return AI_VALUE(uint8, "balance") <= balance;
}
bool HealerShouldAttackTrigger::IsActive()
{
// nobody can help me
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)
return false;
bool highMana = AI_VALUE2(bool, "has mana", "self target") &&
AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig->highMana;
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;
if (mediumMana)
return false;
return true;
}
bool ItemCountTrigger::IsActive() { return AI_VALUE2(uint32, "item count", item) < count; }
bool InterruptSpellTrigger::IsActive()

View File

@@ -459,6 +459,16 @@ protected:
float balance;
};
class HealerShouldAttackTrigger : public Trigger
{
public:
HealerShouldAttackTrigger(PlayerbotAI* botAI)
: Trigger(botAI, "healer should attack", 1)
{
}
bool IsActive() override;
};
class RandomTrigger : public Trigger
{

View File

@@ -24,7 +24,18 @@ bool AoeHealTrigger::IsActive() { return AI_VALUE2(uint8, "aoe heal", type) >= c
bool AoeInGroupTrigger::IsActive()
{
Group* group = bot->GetGroup();
return group && group->GetMembersCount() >= 5 &&
AI_VALUE2(uint8, "aoe heal", type) >= (group->GetMembersCount() * ratio);
int32 member = botAI->GetNearGroupMemberCount();
if (member < 5)
return false;
int threshold = member * 0.5;
if (member <= 5)
threshold = 3;
else if (member <= 10)
threshold = std::min(threshold, 5);
else if (member <= 25)
threshold = std::min(threshold, 10);
else
threshold = std::min(threshold, 15);
return AI_VALUE2(uint8, "aoe heal", type) >= threshold;
}

View File

@@ -186,14 +186,13 @@ protected:
class AoeInGroupTrigger : public Trigger
{
public:
AoeInGroupTrigger(PlayerbotAI* ai, std::string name, std::string type, float ratio)
: Trigger(ai, name), ratio(ratio), type(type)
AoeInGroupTrigger(PlayerbotAI* ai, std::string name, std::string type)
: Trigger(ai, name), type(type)
{
}
bool IsActive() override;
protected:
float ratio;
std::string type;
};

View File

@@ -48,6 +48,7 @@ public:
creators["almost full mana"] = &TriggerContext::AlmostFullMana;
creators["enough mana"] = &TriggerContext::EnoughMana;
creators["party member critical health"] = &TriggerContext::PartyMemberCriticalHealth;
creators["party member low health"] = &TriggerContext::PartyMemberLowHealth;
creators["party member medium health"] = &TriggerContext::PartyMemberMediumHealth;
@@ -83,6 +84,9 @@ public:
creators["medium aoe"] = &TriggerContext::MediumAoe;
creators["high aoe"] = &TriggerContext::HighAoe;
creators["healer should attack"] = &TriggerContext::healer_should_attack;
creators["medium aoe and healer should attack"] = &TriggerContext::medium_aoe_and_healer_should_attack;
creators["has area debuff"] = &TriggerContext::HasAreaDebuff;
creators["enemy out of melee"] = &TriggerContext::EnemyOutOfMelee;
@@ -242,11 +246,11 @@ private:
}
static Trigger* group_heal_occasion(PlayerbotAI* ai)
{
return new AoeInGroupTrigger(ai, "group heal occasion", "almost full", 0.6);
return new AoeInGroupTrigger(ai, "group heal occasion", "almost full");
}
static Trigger* medium_group_heal_occasion(PlayerbotAI* ai)
{
return new AoeInGroupTrigger(ai, "group heal occasion", "medium", 0.6);
return new AoeInGroupTrigger(ai, "medium group heal occasion", "medium");
}
static Trigger* target_changed(PlayerbotAI* botAI) { return new TargetChangedTrigger(botAI); }
static Trigger* swimming(PlayerbotAI* botAI) { return new IsSwimmingTrigger(botAI); }
@@ -265,6 +269,8 @@ private:
static Trigger* LightAoe(PlayerbotAI* botAI) { return new LightAoeTrigger(botAI); }
static Trigger* MediumAoe(PlayerbotAI* botAI) { return new MediumAoeTrigger(botAI); }
static Trigger* HighAoe(PlayerbotAI* botAI) { return new HighAoeTrigger(botAI); }
static Trigger* healer_should_attack(PlayerbotAI* botAI) { return new HealerShouldAttackTrigger(botAI); }
static Trigger* medium_aoe_and_healer_should_attack(PlayerbotAI* botAI) { return new TwoTriggers(botAI, "medium aoe", "healer should attack"); }
static Trigger* HasAreaDebuff(PlayerbotAI* botAI) { return new HasAreaDebuffTrigger(botAI); }
static Trigger* LoseAggro(PlayerbotAI* botAI) { return new LoseAggroTrigger(botAI); }
static Trigger* HasAggro(PlayerbotAI* botAI) { return new HasAggroTrigger(botAI); }