diff --git a/src/strategy/actions/GenericSpellActions.cpp b/src/strategy/actions/GenericSpellActions.cpp index 8b53ec7b..ec12a965 100644 --- a/src/strategy/actions/GenericSpellActions.cpp +++ b/src/strategy/actions/GenericSpellActions.cpp @@ -292,3 +292,7 @@ Value* BuffOnMainTankAction::GetTargetValue() return context->GetValue("main tank", spell); } +bool CastDebuffSpellAction::isUseful() +{ + return CastAuraSpellAction::isUseful() && GetTarget() && (GetTarget()->GetHealth() / AI_VALUE(float, "expected group dps")) >= needLifeTime; +} \ No newline at end of file diff --git a/src/strategy/actions/GenericSpellActions.h b/src/strategy/actions/GenericSpellActions.h index 21743d2c..bbe1b480 100644 --- a/src/strategy/actions/GenericSpellActions.h +++ b/src/strategy/actions/GenericSpellActions.h @@ -50,13 +50,16 @@ class CastMeleeSpellAction : public CastSpellAction class CastDebuffSpellAction : public CastAuraSpellAction { public: - CastDebuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false) : CastAuraSpellAction(botAI, spell, isOwner) { } + CastDebuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false, float needLifeTime = 8.0f) : CastAuraSpellAction(botAI, spell, isOwner), needLifeTime(needLifeTime) { } + bool isUseful() override; + private: + float needLifeTime; }; -class CastDebuffSpellOnAttackerAction : public CastAuraSpellAction +class CastDebuffSpellOnAttackerAction : public CastDebuffSpellAction { public: - CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true) : CastAuraSpellAction(botAI, spell, isOwner) { } + CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true, float needLifeTime = 8.0f) : CastDebuffSpellAction(botAI, spell, isOwner, needLifeTime) { } Value* GetTargetValue() override; std::string const getName() override { return spell + " on attacker"; } diff --git a/src/strategy/hunter/HunterTriggers.cpp b/src/strategy/hunter/HunterTriggers.cpp index 94b7589d..db6c7795 100644 --- a/src/strategy/hunter/HunterTriggers.cpp +++ b/src/strategy/hunter/HunterTriggers.cpp @@ -3,6 +3,7 @@ */ #include "HunterTriggers.h" +#include "GenericTriggers.h" #include "HunterActions.h" #include "Playerbots.h" #include "ServerFacade.h" @@ -18,7 +19,7 @@ bool HunterAspectOfTheHawkTrigger::IsActive() bool HunterNoStingsActiveTrigger::IsActive() { Unit* target = AI_VALUE(Unit*, "current target"); - return target && AI_VALUE2(uint8, "health", "current target") > 15 && + return DebuffTrigger::IsActive() && target && !botAI->HasAura("serpent sting", target, false, true) && !botAI->HasAura("scorpid sting", target, false, true) && !botAI->HasAura("viper sting", target, false, true); diff --git a/src/strategy/hunter/HunterTriggers.h b/src/strategy/hunter/HunterTriggers.h index 2d43b311..d1eace38 100644 --- a/src/strategy/hunter/HunterTriggers.h +++ b/src/strategy/hunter/HunterTriggers.h @@ -11,10 +11,10 @@ class PlayerbotAI; -class HunterNoStingsActiveTrigger : public Trigger +class HunterNoStingsActiveTrigger : public DebuffTrigger { public: - HunterNoStingsActiveTrigger(PlayerbotAI* botAI): Trigger(botAI, "no stings") {} + HunterNoStingsActiveTrigger(PlayerbotAI* botAI): DebuffTrigger(botAI, "no stings") {} bool IsActive() override; }; diff --git a/src/strategy/triggers/GenericTriggers.h b/src/strategy/triggers/GenericTriggers.h index 7b6bc339..c529f4f0 100644 --- a/src/strategy/triggers/GenericTriggers.h +++ b/src/strategy/triggers/GenericTriggers.h @@ -333,7 +333,7 @@ class DebuffOnBossTrigger : public DebuffTrigger class DebuffOnAttackerTrigger : public DebuffTrigger { public: - DebuffOnAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true, float needLifeTime = 8000.0f) : DebuffTrigger(botAI, spell, 1, checkIsOwner, needLifeTime) { } + DebuffOnAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true, float needLifeTime = 8.0f) : DebuffTrigger(botAI, spell, 1, checkIsOwner, needLifeTime) { } Value* GetTargetValue() override; std::string const getName() override { return spell + " on attacker"; } diff --git a/src/strategy/warlock/WarlockActions.h b/src/strategy/warlock/WarlockActions.h index 58f329fa..3b5f177e 100644 --- a/src/strategy/warlock/WarlockActions.h +++ b/src/strategy/warlock/WarlockActions.h @@ -141,7 +141,7 @@ class CastBanishAction : public CastBuffSpellAction class CastSeedOfCorruptionAction : public CastDebuffSpellAction { public: - CastSeedOfCorruptionAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "seed of corruption", true) { } + CastSeedOfCorruptionAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "seed of corruption", true, 0) { } }; class CastRainOfFireAction : public CastSpellAction