druid rebirth in combat

This commit is contained in:
Yunfan Li
2023-07-14 16:24:38 +08:00
parent 53afe66b8e
commit 01d4121ff8
7 changed files with 26 additions and 1 deletions

View File

@@ -45,3 +45,8 @@ NextAction** CastRebirthAction::getPrerequisites()
{
return NextAction::merge(NextAction::array(0, new NextAction("caster form"), nullptr), ResurrectPartyMemberAction::getPrerequisites());
}
bool CastRebirthAction::isUseful()
{
return AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance;
}

View File

@@ -75,6 +75,7 @@ class CastRebirthAction : public ResurrectPartyMemberAction
CastRebirthAction(PlayerbotAI* botAI) : ResurrectPartyMemberAction(botAI, "rebirth") { }
NextAction** getPrerequisites() override;
bool isUseful() override;
};
class CastMarkOfTheWildAction : public CastBuffSpellAction

View File

@@ -118,5 +118,5 @@ void GenericDruidBuffStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
NonCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("mark of the wild on party", NextAction::array(0, new NextAction("mark of the wild on party", 13.0f), nullptr)));
triggers.push_back(new TriggerNode("thorns on party", NextAction::array(0, new NextAction("thorns on party", 11.0f), nullptr)));
// triggers.push_back(new TriggerNode("thorns on party", NextAction::array(0, new NextAction("thorns on party", 11.0f), nullptr)));
}

View File

@@ -110,6 +110,9 @@ void GenericDruidStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
// 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 + 1), nullptr)));
// triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new NextAction("rebirth", ACTION_HIGH + 1), nullptr)));
// triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("innervate", ACTION_EMERGENCY + 5), nullptr)));
triggers.push_back(new TriggerNode(
"combat party member dead",
NextAction::array(0, new NextAction("rebirth", ACTION_HIGH + 9), NULL)));
}
void DruidCureStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)

View File

@@ -20,6 +20,11 @@ bool PartyMemberDeadTrigger::IsActive()
return GetTarget();
}
bool CombatPartyMemberDeadTrigger::IsActive()
{
return GetTarget();
}
bool DeadTrigger::IsActive()
{
return AI_VALUE2(bool, "dead", GetTargetName());

View File

@@ -7,6 +7,7 @@
#include "Trigger.h"
#include "PlayerbotAIConfig.h"
#include <stdexcept>
class PlayerbotAI;
@@ -112,6 +113,14 @@ class PartyMemberDeadTrigger : public Trigger
bool IsActive() override;
};
class CombatPartyMemberDeadTrigger : public Trigger
{
public:
CombatPartyMemberDeadTrigger(PlayerbotAI* ai) : Trigger(ai, "combat party member to resurrect", 1) {}
std::string const GetTargetName() override { return "party member to resurrect"; }
bool IsActive() override;
};
class DeadTrigger : public Trigger
{
public:

View File

@@ -98,6 +98,7 @@ class TriggerContext : public NamedObjectContext<Trigger>
creators["dead"] = &TriggerContext::Dead;
creators["corpse near"] = &TriggerContext::corpse_near;
creators["party member dead"] = &TriggerContext::PartyMemberDead;
creators["combat party member dead"] = &TriggerContext::CombatPartyMemberDead;
creators["no pet"] = &TriggerContext::no_pet;
creators["has pet"] = &TriggerContext::has_pet;
creators["has attackers"] = &TriggerContext::has_attackers;
@@ -309,6 +310,7 @@ class TriggerContext : public NamedObjectContext<Trigger>
static Trigger* Dead(PlayerbotAI* botAI) { return new DeadTrigger(botAI); }
static Trigger* corpse_near(PlayerbotAI* botAI) { return new CorpseNearTrigger(botAI); }
static Trigger* PartyMemberDead(PlayerbotAI* botAI) { return new PartyMemberDeadTrigger(botAI); }
static Trigger* CombatPartyMemberDead(PlayerbotAI* botAI) { return new CombatPartyMemberDeadTrigger(botAI); }
static Trigger* PartyMemberLowHealth(PlayerbotAI* botAI) { return new PartyMemberLowHealthTrigger(botAI); }
static Trigger* PartyMemberMediumHealth(PlayerbotAI* botAI) { return new PartyMemberMediumHealthTrigger(botAI); }
static Trigger* PartyMemberAlmostFullHealth(PlayerbotAI* botAI) { return new PartyMemberAlmostFullHealthTrigger(botAI); }