[Class spell] Reduce reach spell relevance

This commit is contained in:
Yunfan Li
2024-07-11 11:29:34 +08:00
parent 53c4198afd
commit c362630ce6
2 changed files with 32 additions and 32 deletions

View File

@@ -8,7 +8,7 @@
void CombatStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void CombatStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_MOVE + 11), nullptr))); triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode("invalid target", NextAction::array(0, new NextAction("drop target", 100), nullptr))); triggers.push_back(new TriggerNode("invalid target", NextAction::array(0, new NextAction("drop target", 100), nullptr)));
triggers.push_back(new TriggerNode("mounted", NextAction::array(0, new NextAction("check mount state", 54), nullptr))); triggers.push_back(new TriggerNode("mounted", NextAction::array(0, new NextAction("check mount state", 54), nullptr)));
// triggers.push_back(new TriggerNode("out of react range", NextAction::array(0, new NextAction("flee to master", 55), nullptr))); // triggers.push_back(new TriggerNode("out of react range", NextAction::array(0, new NextAction("flee to master", 55), nullptr)));
@@ -24,44 +24,44 @@ AvoidAoeStrategy::AvoidAoeStrategy(PlayerbotAI* botAI) : Strategy(botAI)
} }
class AvoidAoeStrategyMultiplier : public Multiplier // class AvoidAoeStrategyMultiplier : public Multiplier
{ // {
public: // public:
AvoidAoeStrategyMultiplier(PlayerbotAI* botAI) : Multiplier(botAI, "run away on area debuff") {} // AvoidAoeStrategyMultiplier(PlayerbotAI* botAI) : Multiplier(botAI, "run away on area debuff") {}
public: // public:
virtual float GetValue(Action* action); // virtual float GetValue(Action* action);
private: // private:
}; // };
float AvoidAoeStrategyMultiplier::GetValue(Action* action) // float AvoidAoeStrategyMultiplier::GetValue(Action* action)
{ // {
if (!action) // if (!action)
return 1.0f; // return 1.0f;
std::string name = action->getName(); // std::string name = action->getName();
if (name == "follow" || name == "co" || name == "nc" || name == "drop target") // if (name == "follow" || name == "co" || name == "nc" || name == "drop target")
return 1.0f; // return 1.0f;
uint32 spellId = AI_VALUE2(uint32, "spell id", name); // uint32 spellId = AI_VALUE2(uint32, "spell id", name);
const SpellInfo* const pSpellInfo = sSpellMgr->GetSpellInfo(spellId); // const SpellInfo* const pSpellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!pSpellInfo) return 1.0f; // if (!pSpellInfo) return 1.0f;
if (spellId && pSpellInfo->Targets & TARGET_FLAG_DEST_LOCATION) // if (spellId && pSpellInfo->Targets & TARGET_FLAG_DEST_LOCATION)
return 1.0f; // return 1.0f;
else if (spellId && pSpellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION) // else if (spellId && pSpellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION)
return 1.0f; // return 1.0f;
uint32 castTime = pSpellInfo->CalcCastTime(bot); // uint32 castTime = pSpellInfo->CalcCastTime(bot);
if (AI_VALUE2(bool, "has area debuff", "self target") && spellId && castTime > 0) // if (AI_VALUE2(bool, "has area debuff", "self target") && spellId && castTime > 0)
{ // {
return 0.0f; // return 0.0f;
} // }
return 1.0f; // return 1.0f;
} // }
NextAction** AvoidAoeStrategy::getDefaultActions() NextAction** AvoidAoeStrategy::getDefaultActions()
{ {
@@ -86,6 +86,6 @@ void AvoidAoeStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
NextAction** CombatFormationStrategy::getDefaultActions() NextAction** CombatFormationStrategy::getDefaultActions()
{ {
return NextAction::array(0, return NextAction::array(0,
new NextAction("combat formation move", ACTION_EMERGENCY), new NextAction("combat formation move", ACTION_NORMAL),
nullptr); nullptr);
} }

View File

@@ -14,7 +14,7 @@ class Unit;
class PartyMemberToDispel : public PartyMemberValue, public Qualified class PartyMemberToDispel : public PartyMemberValue, public Qualified
{ {
public: public:
PartyMemberToDispel(PlayerbotAI* botAI, std::string const name = "party member to dispel") : PartyMemberValue(botAI, name, 2 * 1000), Qualified() { } PartyMemberToDispel(PlayerbotAI* botAI, std::string const name = "party member to dispel") : PartyMemberValue(botAI, name, 1000), Qualified() { }
protected: protected:
Unit* Calculate() override; Unit* Calculate() override;