Improvement hunter track and spell

This commit is contained in:
Yunfan Li
2025-01-18 23:47:37 +08:00
parent 3523a65ff8
commit 006e0a03c8
5 changed files with 54 additions and 4 deletions

View File

@@ -41,8 +41,11 @@ DpsHunterStrategy::DpsHunterStrategy(PlayerbotAI* botAI) : GenericHunterStrategy
NextAction** DpsHunterStrategy::getDefaultActions() NextAction** DpsHunterStrategy::getDefaultActions()
{ {
return NextAction::array( return NextAction::array(
0, new NextAction("kill shot", ACTION_DEFAULT + 0.8f), new NextAction("chimera shot", ACTION_DEFAULT + 0.7f), 0,
new NextAction("explosive shot", ACTION_DEFAULT + 0.6f), new NextAction("aimed shot", ACTION_DEFAULT + 0.5f), new NextAction("explosive shot", ACTION_HIGH + 1.0f),
new NextAction("kill shot", ACTION_DEFAULT + 0.8f),
new NextAction("chimera shot", ACTION_DEFAULT + 0.6f),
new NextAction("aimed shot", ACTION_DEFAULT + 0.5f),
new NextAction("silencing shot", ACTION_DEFAULT + 0.4f), new NextAction("silencing shot", ACTION_DEFAULT + 0.4f),
new NextAction("kill command", ACTION_DEFAULT + 0.3f), new NextAction("kill command", ACTION_DEFAULT + 0.3f),
// new NextAction("arcane shot", ACTION_DEFAULT + 0.2f), // new NextAction("arcane shot", ACTION_DEFAULT + 0.2f),
@@ -55,7 +58,7 @@ void DpsHunterStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
GenericHunterStrategy::InitTriggers(triggers); GenericHunterStrategy::InitTriggers(triggers);
triggers.push_back( triggers.push_back(
new TriggerNode("black arrow", NextAction::array(0, new NextAction("black arrow", 15.0f), nullptr))); new TriggerNode("black arrow", NextAction::array(0, new NextAction("black arrow", 19.0f), nullptr)));
triggers.push_back( triggers.push_back(
new TriggerNode("low mana", NextAction::array(0, new NextAction("viper sting", 23.0f), nullptr))); new TriggerNode("low mana", NextAction::array(0, new NextAction("viper sting", 23.0f), nullptr)));
triggers.push_back( triggers.push_back(

View File

@@ -49,6 +49,8 @@ void GenericHunterNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& tri
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr)));
triggers.push_back( triggers.push_back(
new TriggerNode("low ammo", NextAction::array(0, new NextAction("say::low ammo", ACTION_NORMAL), nullptr))); new TriggerNode("low ammo", NextAction::array(0, new NextAction("say::low ammo", ACTION_NORMAL), nullptr)));
triggers.push_back(
new TriggerNode("no track", NextAction::array(0, new NextAction("track humanoids", ACTION_NORMAL), nullptr)));
// triggers.push_back(new TriggerNode("no ammo", NextAction::array(0, new NextAction("switch to melee", // triggers.push_back(new TriggerNode("no ammo", NextAction::array(0, new NextAction("switch to melee",
// ACTION_NORMAL + 1), new NextAction("say::no ammo", ACTION_NORMAL), nullptr))); triggers.push_back(new // ACTION_NORMAL + 1), new NextAction("say::no ammo", ACTION_NORMAL), nullptr))); triggers.push_back(new
// TriggerNode("has ammo", NextAction::array(0, new NextAction("switch to ranged", ACTION_NORMAL), nullptr))); // TriggerNode("has ammo", NextAction::array(0, new NextAction("switch to ranged", ACTION_NORMAL), nullptr)));

View File

@@ -75,6 +75,7 @@ public:
creators["aspect of the wild"] = &HunterTriggerFactoryInternal::aspect_of_the_wild; creators["aspect of the wild"] = &HunterTriggerFactoryInternal::aspect_of_the_wild;
creators["aspect of the viper"] = &HunterTriggerFactoryInternal::aspect_of_the_viper; creators["aspect of the viper"] = &HunterTriggerFactoryInternal::aspect_of_the_viper;
creators["trueshot aura"] = &HunterTriggerFactoryInternal::trueshot_aura; creators["trueshot aura"] = &HunterTriggerFactoryInternal::trueshot_aura;
creators["no track"] = &HunterTriggerFactoryInternal::no_track;
creators["serpent sting on attacker"] = &HunterTriggerFactoryInternal::serpent_sting_on_attacker; creators["serpent sting on attacker"] = &HunterTriggerFactoryInternal::serpent_sting_on_attacker;
creators["pet not happy"] = &HunterTriggerFactoryInternal::pet_not_happy; creators["pet not happy"] = &HunterTriggerFactoryInternal::pet_not_happy;
creators["concussive shot on snare target"] = &HunterTriggerFactoryInternal::concussive_shot_on_snare_target; creators["concussive shot on snare target"] = &HunterTriggerFactoryInternal::concussive_shot_on_snare_target;
@@ -99,6 +100,7 @@ private:
static Trigger* pet_not_happy(PlayerbotAI* botAI) { return new HunterPetNotHappy(botAI); } static Trigger* pet_not_happy(PlayerbotAI* botAI) { return new HunterPetNotHappy(botAI); }
static Trigger* serpent_sting_on_attacker(PlayerbotAI* botAI) { return new SerpentStingOnAttackerTrigger(botAI); } static Trigger* serpent_sting_on_attacker(PlayerbotAI* botAI) { return new SerpentStingOnAttackerTrigger(botAI); }
static Trigger* trueshot_aura(PlayerbotAI* botAI) { return new TrueshotAuraTrigger(botAI); } static Trigger* trueshot_aura(PlayerbotAI* botAI) { return new TrueshotAuraTrigger(botAI); }
static Trigger* no_track(PlayerbotAI* botAI) { return new NoTrackTrigger(botAI); }
static Trigger* aspect_of_the_viper(PlayerbotAI* botAI) { return new HunterAspectOfTheViperTrigger(botAI); } static Trigger* aspect_of_the_viper(PlayerbotAI* botAI) { return new HunterAspectOfTheViperTrigger(botAI); }
static Trigger* black_arrow(PlayerbotAI* botAI) { return new BlackArrowTrigger(botAI); } static Trigger* black_arrow(PlayerbotAI* botAI) { return new BlackArrowTrigger(botAI); }
static Trigger* NoStings(PlayerbotAI* botAI) { return new HunterNoStingsActiveTrigger(botAI); } static Trigger* NoStings(PlayerbotAI* botAI) { return new HunterNoStingsActiveTrigger(botAI); }
@@ -159,6 +161,7 @@ public:
creators["aspect of the pack"] = &HunterAiObjectContextInternal::aspect_of_the_pack; creators["aspect of the pack"] = &HunterAiObjectContextInternal::aspect_of_the_pack;
creators["aspect of the cheetah"] = &HunterAiObjectContextInternal::aspect_of_the_cheetah; creators["aspect of the cheetah"] = &HunterAiObjectContextInternal::aspect_of_the_cheetah;
creators["trueshot aura"] = &HunterAiObjectContextInternal::trueshot_aura; creators["trueshot aura"] = &HunterAiObjectContextInternal::trueshot_aura;
creators["track humanoids"] = &HunterAiObjectContextInternal::track_humanoids;
creators["feign death"] = &HunterAiObjectContextInternal::feign_death; creators["feign death"] = &HunterAiObjectContextInternal::feign_death;
creators["wing clip"] = &HunterAiObjectContextInternal::wing_clip; creators["wing clip"] = &HunterAiObjectContextInternal::wing_clip;
creators["raptor strike"] = &HunterAiObjectContextInternal::raptor_strike; creators["raptor strike"] = &HunterAiObjectContextInternal::raptor_strike;
@@ -182,6 +185,7 @@ private:
static Action* feed_pet(PlayerbotAI* botAI) { return new FeedPetAction(botAI); } static Action* feed_pet(PlayerbotAI* botAI) { return new FeedPetAction(botAI); }
static Action* feign_death(PlayerbotAI* botAI) { return new CastFeignDeathAction(botAI); } static Action* feign_death(PlayerbotAI* botAI) { return new CastFeignDeathAction(botAI); }
static Action* trueshot_aura(PlayerbotAI* botAI) { return new CastTrueshotAuraAction(botAI); } static Action* trueshot_aura(PlayerbotAI* botAI) { return new CastTrueshotAuraAction(botAI); }
static Action* track_humanoids(PlayerbotAI* botAI) { return new CastBuffSpellAction(botAI, "track humanoids"); }
static Action* auto_shot(PlayerbotAI* botAI) { return new CastAutoShotAction(botAI); } static Action* auto_shot(PlayerbotAI* botAI) { return new CastAutoShotAction(botAI); }
static Action* aimed_shot(PlayerbotAI* botAI) { return new CastAimedShotAction(botAI); } static Action* aimed_shot(PlayerbotAI* botAI) { return new CastAimedShotAction(botAI); }
static Action* chimera_shot(PlayerbotAI* botAI) { return new CastChimeraShotAction(botAI); } static Action* chimera_shot(PlayerbotAI* botAI) { return new CastChimeraShotAction(botAI); }

View File

@@ -56,7 +56,7 @@ bool HunterPetNotHappy::IsActive()
bool HunterAspectOfTheViperTrigger::IsActive() bool HunterAspectOfTheViperTrigger::IsActive()
{ {
return SpellTrigger::IsActive() && !botAI->HasAura(spell, GetTarget()) && return SpellTrigger::IsActive() && !botAI->HasAura(spell, GetTarget()) &&
AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig->lowMana; AI_VALUE2(uint8, "mana", "self target") < (sPlayerbotAIConfig->lowMana / 2);
; ;
} }
@@ -88,3 +88,36 @@ bool SwitchToMeleeTrigger::IsActive()
(target->GetVictim() == bot && (target->GetVictim() == bot &&
sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f)); sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f));
} }
bool NoTrackTrigger::IsActive()
{
std::vector<std::string> track_list = {
"track beasts",
"track demons",
"track dragonkin",
"track elementals",
"track giants",
"track hidden",
"track humanoids"
};
for (auto &track: track_list)
{
if (botAI->HasAura(track, bot))
return false;
}
return true;
}
bool SerpentStingOnAttackerTrigger::IsActive()
{
if (!DebuffOnAttackerTrigger::IsActive())
return false;
Unit* target = GetTarget();
if (!target)
{
return false;
}
return !botAI->HasAura("scorpid sting", target, false, true) &&
!botAI->HasAura("viper sting", target, false, true);
}

View File

@@ -101,10 +101,18 @@ public:
TrueshotAuraTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "trueshot aura") {} TrueshotAuraTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "trueshot aura") {}
}; };
class NoTrackTrigger : public BuffTrigger
{
public:
NoTrackTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "no track") {}
bool IsActive() override;
};
class SerpentStingOnAttackerTrigger : public DebuffOnAttackerTrigger class SerpentStingOnAttackerTrigger : public DebuffOnAttackerTrigger
{ {
public: public:
SerpentStingOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, "serpent sting", true) {} SerpentStingOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, "serpent sting", true) {}
bool IsActive() override;
}; };
BEGIN_TRIGGER(HunterPetNotHappy, Trigger) BEGIN_TRIGGER(HunterPetNotHappy, Trigger)