[Spell] Healer spell enhancement

This commit is contained in:
Yunfan Li
2024-10-04 20:48:29 +08:00
parent db9b1115cb
commit 21e17e163b
15 changed files with 137 additions and 59 deletions

View File

@@ -202,9 +202,9 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
{
LogAction("A:%s - PREREQ", action->getName().c_str());
if (MultiplyAndPush(actionNode->getPrerequisites(), relevance + 0.02, false, event, "prereq"))
if (MultiplyAndPush(actionNode->getPrerequisites(), relevance + 0.002f, false, event, "prereq"))
{
PushAgain(actionNode, relevance + 0.01, event);
PushAgain(actionNode, relevance + 0.001f, event);
continue;
}
}
@@ -226,7 +226,7 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
else
{
LogAction("A:%s - FAILED", action->getName().c_str());
MultiplyAndPush(actionNode->getAlternatives(), relevance + 0.03, false, event, "alt");
MultiplyAndPush(actionNode->getAlternatives(), relevance + 0.003f, false, event, "alt");
}
}
else
@@ -246,7 +246,7 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
botAI->TellMasterNoFacing(out);
}
LogAction("A:%s - IMPOSSIBLE", action->getName().c_str());
MultiplyAndPush(actionNode->getAlternatives(), relevance + 0.03, false, event, "alt");
MultiplyAndPush(actionNode->getAlternatives(), relevance + 0.003f, false, event, "alt");
}
}
else

View File

@@ -38,7 +38,7 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
bool shouldApply = true;
// imp's spell, felhunte's intelligence, cat stealth
if (spellId == 4511 || spellId == 1742 || spellId == 54424 || spellId == 57564 || spellId == 57565 ||
spellId == 57566 || spellId == 57567 || spellId == 24450 || spellId == 53477)
spellId == 57566 || spellId == 57567 || spellId == 24450)
{
shouldApply = false;
}

View File

@@ -196,8 +196,8 @@ bool CastEnchantItemAction::isPossible()
}
CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount,
HealingManaEfficiency manaEfficiency)
: CastAuraSpellAction(botAI, spell, true), estAmount(estAmount), manaEfficiency(manaEfficiency)
HealingManaEfficiency manaEfficiency, bool isOwner)
: CastAuraSpellAction(botAI, spell, isOwner), estAmount(estAmount), manaEfficiency(manaEfficiency)
{
range = botAI->GetRange("heal");
}

View File

@@ -129,7 +129,7 @@ class CastHealingSpellAction : public CastAuraSpellAction
{
public:
CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f,
HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM);
HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM, bool isOwner = true);
std::string const GetTargetName() override { return "self target"; }
bool isUseful() override;
@@ -177,8 +177,8 @@ class HealPartyMemberAction : public CastHealingSpellAction, public PartyMemberA
{
public:
HealPartyMemberAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f,
HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM)
: CastHealingSpellAction(botAI, spell, estAmount, manaEfficiency), PartyMemberActionNameSupport(spell)
HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM, bool isOwner = true)
: CastHealingSpellAction(botAI, spell, estAmount, manaEfficiency, isOwner), PartyMemberActionNameSupport(spell)
{
}

View File

@@ -47,4 +47,35 @@ bool CastRebirthAction::isUseful()
{
return CastSpellAction::isUseful() &&
AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance;
}
Unit* CastRejuvenationOnNotFullAction::GetTarget()
{
Group* group = bot->GetGroup();
MinValueCalculator calc(100);
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
{
Player* player = gref->GetSource();
if (!player)
continue;
if (player->isDead() || player->IsFullHealth())
{
continue;
}
if (player->GetDistance2d(bot) > sPlayerbotAIConfig->spellDistance)
{
continue;
}
if (botAI->HasAura("rejuvenation", player))
{
continue;
}
calc.probe(player->GetHealthPct(), player);
}
return (Unit*)calc.param;
}
bool CastRejuvenationOnNotFullAction::isUseful()
{
return GetTarget();
}

View File

@@ -311,4 +311,16 @@ public:
CastEnrageAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "enrage") {}
};
class CastRejuvenationOnNotFullAction : public HealPartyMemberAction
{
public:
CastRejuvenationOnNotFullAction(PlayerbotAI* ai)
: HealPartyMemberAction(ai, "rejuvenation", 5.0f, HealingManaEfficiency::VERY_HIGH)
{
}
bool isUseful() override;
Unit* GetTarget() override;
};
#endif

View File

@@ -209,6 +209,7 @@ public:
creators["healing touch"] = &DruidAiObjectContextInternal::healing_touch;
creators["regrowth on party"] = &DruidAiObjectContextInternal::regrowth_on_party;
creators["rejuvenation on party"] = &DruidAiObjectContextInternal::rejuvenation_on_party;
creators["rejuvenation on not full"] = &DruidAiObjectContextInternal::rejuvenation_on_not_full;
creators["healing touch on party"] = &DruidAiObjectContextInternal::healing_touch_on_party;
creators["rebirth"] = &DruidAiObjectContextInternal::rebirth;
creators["revive"] = &DruidAiObjectContextInternal::revive;
@@ -295,6 +296,7 @@ private:
static Action* healing_touch(PlayerbotAI* botAI) { return new CastHealingTouchAction(botAI); }
static Action* regrowth_on_party(PlayerbotAI* botAI) { return new CastRegrowthOnPartyAction(botAI); }
static Action* rejuvenation_on_party(PlayerbotAI* botAI) { return new CastRejuvenationOnPartyAction(botAI); }
static Action* rejuvenation_on_not_full(PlayerbotAI* botAI) { return new CastRejuvenationOnNotFullAction(botAI); }
static Action* healing_touch_on_party(PlayerbotAI* botAI) { return new CastHealingTouchOnPartyAction(botAI); }
static Action* rebirth(PlayerbotAI* botAI) { return new CastRebirthAction(botAI); }
static Action* revive(PlayerbotAI* botAI) { return new CastReviveAction(botAI); }

View File

@@ -164,9 +164,10 @@ void DruidAssistDpsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
new NextAction("starfire", ACTION_DEFAULT),
nullptr)));
triggers.push_back(
new TriggerNode("medium aoe and healer should attack",
NextAction::array(0,
new NextAction("hurricane", ACTION_DEFAULT + 0.7f),
nullptr)));
// long cast time
// triggers.push_back(
// new TriggerNode("medium aoe and healer should attack",
// NextAction::array(0,
// new NextAction("hurricane", ACTION_DEFAULT + 0.7f),
// nullptr)));
}

View File

@@ -70,8 +70,8 @@ void HealDruidStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
NextAction::array(0,
new NextAction("tree form", ACTION_CRITICAL_HEAL + 4.1f),
new NextAction("swiftmend on party", ACTION_CRITICAL_HEAL + 4),
new NextAction("wild growth on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 2),
new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("wild growth on party", ACTION_CRITICAL_HEAL + 2),
new NextAction("nourish on party", ACTION_CRITICAL_HEAL + 1),
// new NextAction("healing touch on party", ACTION_CRITICAL_HEAL + 0),
nullptr)));
@@ -80,36 +80,46 @@ void HealDruidStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
new TriggerNode("party member critical health",
NextAction::array(0, new NextAction("nature's swiftness", ACTION_CRITICAL_HEAL + 4), nullptr)));
triggers.push_back(new TriggerNode(
"group heal setting",
NextAction::array(0,
new NextAction("tree form", ACTION_MEDIUM_HEAL + 2.3f),
new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 2.2f),
new NextAction("rejuvenation on not full", ACTION_MEDIUM_HEAL + 2.1f),
nullptr)));
triggers.push_back(
new TriggerNode("medium group heal occasion",
NextAction::array(0, new NextAction("tranquility", ACTION_CRITICAL_HEAL + 5), nullptr)));
new TriggerNode("medium group heal setting",
NextAction::array(0,
new NextAction("tree form", ACTION_CRITICAL_HEAL + 0.6f),
new NextAction("tranquility", ACTION_CRITICAL_HEAL + 0.5f), nullptr)));
// LOW
triggers.push_back(
new TriggerNode("party member low health",
NextAction::array(0, new NextAction("tree form", ACTION_MEDIUM_HEAL + 9.1f),
new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 9),
new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 8),
new NextAction("swiftmend on party", ACTION_MEDIUM_HEAL + 7),
new NextAction("nourish on party", ACTION_MEDIUM_HEAL + 6),
NextAction::array(0, new NextAction("tree form", ACTION_MEDIUM_HEAL + 1.5f),
new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 1.4f),
new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 1.3f),
new NextAction("swiftmend on party", ACTION_MEDIUM_HEAL + 1.2),
new NextAction("nourish on party", ACTION_MEDIUM_HEAL + 1.1f),
nullptr)));
// MEDIUM
triggers.push_back(
new TriggerNode("party member medium health",
NextAction::array(0,
new NextAction("tree form", ACTION_MEDIUM_HEAL + 4.1f),
new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 4),
new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 3),
new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 2),
new NextAction("nourish on party", ACTION_MEDIUM_HEAL + 1), nullptr)));
new NextAction("tree form", ACTION_MEDIUM_HEAL + 0.5f),
new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 0.4f),
new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 0.3f),
new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 0.2f),
new NextAction("nourish on party", ACTION_MEDIUM_HEAL + 0.1f), nullptr)));
// almost full
triggers.push_back(
new TriggerNode("party member almost full health",
NextAction::array(0, new NextAction("wild growth on party", ACTION_LIGHT_HEAL + 3),
new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2),
new NextAction("regrowth on party", ACTION_LIGHT_HEAL + 1), nullptr)));
NextAction::array(0, new NextAction("wild growth on party", ACTION_LIGHT_HEAL + 0.3f),
new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 0.2f),
new NextAction("regrowth on party", ACTION_LIGHT_HEAL + 0.1f), nullptr)));
triggers.push_back(
new TriggerNode("medium mana", NextAction::array(0, new NextAction("innervate", ACTION_HIGH + 5), nullptr)));

View File

@@ -49,7 +49,7 @@ void HealPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
NextAction::array(0, new NextAction("reach party member to heal", ACTION_EMERGENCY + 3), nullptr)));
triggers.push_back(
new TriggerNode("medium group heal occasion",
new TriggerNode("medium group heal setting",
NextAction::array(0, new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5),
new NextAction("avenging wrath", ACTION_HIGH + 4),
nullptr)));

View File

@@ -106,7 +106,7 @@ void TankPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode(
"righteous fury", NextAction::array(0, new NextAction("righteous fury", ACTION_HIGH + 8), nullptr)));
triggers.push_back(
new TriggerNode("medium group heal occasion",
new TriggerNode("medium group heal setting",
NextAction::array(0, new NextAction("divine sacrifice", ACTION_HIGH + 5), nullptr)));
triggers.push_back(new TriggerNode(
"enough mana", NextAction::array(0, new NextAction("consecration", ACTION_HIGH + 4), nullptr)));

View File

@@ -35,33 +35,39 @@ void HealPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode(
"group heal setting",
NextAction::array(0, new NextAction("power word: shield on almost full health below", ACTION_MEDIUM_HEAL + 7),
NextAction::array(0,
new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 8),
new NextAction("power word: shield on not full", ACTION_MEDIUM_HEAL + 7),
nullptr)));
triggers.push_back(new TriggerNode(
"medium group heal occasion",
NextAction::array(0, new NextAction("divine hymn", ACTION_CRITICAL_HEAL + 6),
new NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 5), nullptr)));
"medium group heal setting",
NextAction::array(0, new NextAction("divine hymn", ACTION_CRITICAL_HEAL + 7),
new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 6),
new NextAction("power word: shield on not full", ACTION_CRITICAL_HEAL + 5),
new NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 4),
nullptr)));
triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 6),
NextAction::array(0, new NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 5),
new NextAction("penance on party", ACTION_CRITICAL_HEAL + 4),
new NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 2), nullptr)));
new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 2),
nullptr)));
triggers.push_back(
new TriggerNode("party member low health",
NextAction::array(0, new NextAction("power word: shield on party", ACTION_MEDIUM_HEAL + 4),
new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 3),
new NextAction("penance on party", ACTION_MEDIUM_HEAL + 2),
new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 1),
new NextAction("flash heal on party", ACTION_MEDIUM_HEAL + 0), nullptr)));
triggers.push_back(
new TriggerNode("party member medium health",
NextAction::array(0, new NextAction("power word: shield on party", ACTION_LIGHT_HEAL + 9),
new NextAction("penance on party", ACTION_LIGHT_HEAL + 7),
new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 6),
new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 7),
new NextAction("penance on party", ACTION_LIGHT_HEAL + 6),
new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 5),
// new NextAction("renew on party", ACTION_LIGHT_HEAL + 8),
nullptr)));
@@ -70,7 +76,9 @@ void HealPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
new TriggerNode("party member almost full health",
NextAction::array(0,
// new NextAction("penance on party", ACTION_LIGHT_HEAL + 3),
new NextAction("renew on party", ACTION_LIGHT_HEAL + 2), NULL)));
new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 2),
new NextAction("renew on party", ACTION_LIGHT_HEAL + 1),
nullptr)));
// triggers.push_back(new TriggerNode("almost full health", NextAction::array(0, new NextAction("renew", 43.f),
// nullptr))); triggers.push_back(new TriggerNode("party member almost full health", NextAction::array(0, new

View File

@@ -64,40 +64,48 @@ void HolyHealPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(
new TriggerNode("group heal setting",
NextAction::array(0, new NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 8), nullptr)));
NextAction::array(0,
new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 9),
new NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 8), nullptr)));
triggers.push_back(new TriggerNode(
"medium group heal occasion",
NextAction::array(0, new NextAction("divine hymn", ACTION_CRITICAL_HEAL + 6),
new NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 5), nullptr)));
"medium group heal setting",
NextAction::array(0, new NextAction("divine hymn", ACTION_CRITICAL_HEAL + 7),
new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 6),
new NextAction("circle of healing on party", ACTION_CRITICAL_HEAL + 5),
new NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 4), nullptr)));
triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0,
new NextAction("guardian spirit on party", ACTION_CRITICAL_HEAL + 6),
new NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 5),
new NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 2), nullptr)));
new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 2),
new NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 1),
nullptr)));
triggers.push_back(
new TriggerNode("party member low health",
NextAction::array(0, new NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 4),
new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 3),
new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 2),
new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 3),
new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 2),
new NextAction("flash heal on party", ACTION_MEDIUM_HEAL + 1), nullptr)));
triggers.push_back(
new TriggerNode("party member medium health",
NextAction::array(0, new NextAction("circle of healing on party", ACTION_LIGHT_HEAL + 7),
new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 6),
new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 5),
new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 5),
new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 4),
// new NextAction("renew on party", ACTION_LIGHT_HEAL + 8),
nullptr)));
triggers.push_back(
new TriggerNode("party member almost full health",
NextAction::array(0, new NextAction("renew on party", ACTION_LIGHT_HEAL + 2),
// new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 1),
NextAction::array(0,
new NextAction("renew on party", ACTION_LIGHT_HEAL + 2),
new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 1),
nullptr)));
triggers.push_back(new TriggerNode(

View File

@@ -175,6 +175,8 @@ public:
creators["power word: shield on party"] = &PriestAiObjectContextInternal::power_word_shield_on_party;
creators["power word: shield on almost full health below"] =
&PriestAiObjectContextInternal::power_word_shield_on_almost_full_health_below;
creators["power word: shield on not full"] =
&PriestAiObjectContextInternal::power_word_shield_on_not_full;
creators["renew"] = &PriestAiObjectContextInternal::renew;
creators["renew on party"] = &PriestAiObjectContextInternal::renew_on_party;
creators["greater heal"] = &PriestAiObjectContextInternal::greater_heal;
@@ -285,7 +287,11 @@ private:
}
static Action* power_word_shield_on_almost_full_health_below(PlayerbotAI* ai)
{
return new CastPowerWordShieldOnAlmostFullHealthBelow(ai);
return new CastPowerWordShieldOnAlmostFullHealthBelowAction(ai);
}
static Action* power_word_shield_on_not_full(PlayerbotAI* ai)
{
return new CastPowerWordShieldOnNotFullAction(ai);
}
static Action* renew(PlayerbotAI* botAI) { return new CastRenewAction(botAI); }
static Action* renew_on_party(PlayerbotAI* botAI) { return new CastRenewOnPartyAction(botAI); }

View File

@@ -140,7 +140,7 @@ public:
creators["almost full aoe heal"] = &TriggerContext::almost_full_aoe_heal;
creators["group heal setting"] = &TriggerContext::group_heal_occasion;
creators["medium group heal occasion"] = &TriggerContext::medium_group_heal_occasion;
creators["medium group heal setting"] = &TriggerContext::medium_group_heal_occasion;
creators["invalid target"] = &TriggerContext::invalid_target;
creators["lfg proposal active"] = &TriggerContext::lfg_proposal_active;
@@ -250,7 +250,7 @@ private:
}
static Trigger* medium_group_heal_occasion(PlayerbotAI* ai)
{
return new AoeInGroupTrigger(ai, "medium group heal occasion", "medium");
return new AoeInGroupTrigger(ai, "medium group heal setting", "medium");
}
static Trigger* target_changed(PlayerbotAI* botAI) { return new TargetChangedTrigger(botAI); }
static Trigger* swimming(PlayerbotAI* botAI) { return new IsSwimmingTrigger(botAI); }