Fix melee consecration

This commit is contained in:
Yunfan Li
2024-03-12 19:10:52 +08:00
parent 4ba809946e
commit 04745b23e8
4 changed files with 17 additions and 8 deletions

View File

@@ -43,7 +43,6 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
creators["taunt spell"] = &hand_of_reckoning; creators["taunt spell"] = &hand_of_reckoning;
creators["righteous defense"] = &righteous_defense; creators["righteous defense"] = &righteous_defense;
creators["avenger's shield"] = &avengers_shield; creators["avenger's shield"] = &avengers_shield;
creators["melee consecration"] = &melee_consecration;
} }
private: private:
static ActionNode* blessing_of_sanctuary(PlayerbotAI* ai) static ActionNode* blessing_of_sanctuary(PlayerbotAI* ai)
@@ -235,13 +234,6 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL), /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* melee_consecration([[maybe_unused]] PlayerbotAI* botAI)
{
return new ActionNode ("consecration",
/*P*/ NextAction::array(0, new NextAction("reach melee"), nullptr),
/*A*/ nullptr,
/*C*/ nullptr);
}
}; };
#endif #endif

View File

@@ -6,6 +6,7 @@
#include "AiFactory.h" #include "AiFactory.h"
#include "Event.h" #include "Event.h"
#include "PlayerbotAI.h" #include "PlayerbotAI.h"
#include "PlayerbotAIConfig.h"
#include "PlayerbotFactory.h" #include "PlayerbotFactory.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "SharedDefines.h" #include "SharedDefines.h"
@@ -146,4 +147,11 @@ Unit* CastRighteousDefenseAction::GetTarget()
return NULL; return NULL;
} }
return current_target->GetVictim(); return current_target->GetVictim();
}
bool CastMeleeConsecrationAction::isUseful()
{
Unit* target = GetTarget();
// float dis = distance + CONTACT_DISTANCE;
return target && bot->IsWithinCombatRange(target, sPlayerbotAIConfig->meleeDistance); // sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance);
} }

View File

@@ -44,6 +44,13 @@ HEAL_PARTY_ACTION(CastHolyShockOnPartyAction, "holy shock");
// consecration // consecration
MELEE_ACTION(CastConsecrationAction, "consecration"); MELEE_ACTION(CastConsecrationAction, "consecration");
class CastMeleeConsecrationAction : public CastSpellAction
{
public:
CastMeleeConsecrationAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "consecration") {}
bool isUseful() override;
};
// repentance // repentance
SNARE_ACTION(CastRepentanceSnareAction, "repentance"); SNARE_ACTION(CastRepentanceSnareAction, "repentance");
DEBUFF_ACTION(CastRepentanceAction, "repentance"); DEBUFF_ACTION(CastRepentanceAction, "repentance");

View File

@@ -207,6 +207,7 @@ class PaladinAiObjectContextInternal : public NamedObjectContext<Action>
creators["concentration aura"] = &PaladinAiObjectContextInternal::concentration_aura; creators["concentration aura"] = &PaladinAiObjectContextInternal::concentration_aura;
creators["holy wrath"] = &PaladinAiObjectContextInternal::holy_wrath; creators["holy wrath"] = &PaladinAiObjectContextInternal::holy_wrath;
creators["consecration"] = &PaladinAiObjectContextInternal::consecration; creators["consecration"] = &PaladinAiObjectContextInternal::consecration;
creators["melee consecration"] = &PaladinAiObjectContextInternal::melee_consecration;
creators["cleanse disease"] = &PaladinAiObjectContextInternal::cleanse_disease; creators["cleanse disease"] = &PaladinAiObjectContextInternal::cleanse_disease;
creators["cleanse poison"] = &PaladinAiObjectContextInternal::cleanse_poison; creators["cleanse poison"] = &PaladinAiObjectContextInternal::cleanse_poison;
creators["cleanse magic"] = &PaladinAiObjectContextInternal::cleanse_magic; creators["cleanse magic"] = &PaladinAiObjectContextInternal::cleanse_magic;
@@ -288,6 +289,7 @@ class PaladinAiObjectContextInternal : public NamedObjectContext<Action>
static Action* concentration_aura(PlayerbotAI* botAI) { return new CastConcentrationAuraAction(botAI); } static Action* concentration_aura(PlayerbotAI* botAI) { return new CastConcentrationAuraAction(botAI); }
static Action* holy_wrath(PlayerbotAI* botAI) { return new CastHolyWrathAction(botAI); } static Action* holy_wrath(PlayerbotAI* botAI) { return new CastHolyWrathAction(botAI); }
static Action* consecration(PlayerbotAI* botAI) { return new CastConsecrationAction(botAI); } static Action* consecration(PlayerbotAI* botAI) { return new CastConsecrationAction(botAI); }
static Action* melee_consecration(PlayerbotAI* botAI) { return new CastMeleeConsecrationAction(botAI); }
static Action* cleanse_poison(PlayerbotAI* botAI) { return new CastCleansePoisonAction(botAI); } static Action* cleanse_poison(PlayerbotAI* botAI) { return new CastCleansePoisonAction(botAI); }
static Action* cleanse_disease(PlayerbotAI* botAI) { return new CastCleanseDiseaseAction(botAI); } static Action* cleanse_disease(PlayerbotAI* botAI) { return new CastCleanseDiseaseAction(botAI); }
static Action* cleanse_magic(PlayerbotAI* botAI) { return new CastCleanseMagicAction(botAI); } static Action* cleanse_magic(PlayerbotAI* botAI) { return new CastCleanseMagicAction(botAI); }