Check debuff owner on target

This commit is contained in:
郑佩茹
2023-03-21 13:25:41 -06:00
parent ab2420d89a
commit 5d17dfb2fe
5 changed files with 42 additions and 9 deletions

View File

@@ -33,9 +33,12 @@ class CastSpellAction : public Action
class CastAuraSpellAction : public CastSpellAction
{
public:
CastAuraSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) { }
CastAuraSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false) : CastSpellAction(botAI, spell) { this->isOwner = isOwner; }
bool isUseful() override;
protected:
bool isOwner;
};
class CastMeleeSpellAction : public CastSpellAction
@@ -47,13 +50,13 @@ class CastMeleeSpellAction : public CastSpellAction
class CastDebuffSpellAction : public CastAuraSpellAction
{
public:
CastDebuffSpellAction(PlayerbotAI* botAI, std::string const spell) : CastAuraSpellAction(botAI, spell) { }
CastDebuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false) : CastAuraSpellAction(botAI, spell, isOwner) { }
};
class CastDebuffSpellOnAttackerAction : public CastAuraSpellAction
{
public:
CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell) : CastAuraSpellAction(botAI, spell) { }
CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false) : CastAuraSpellAction(botAI, spell, isOwner) { }
Value<Unit*>* GetTargetValue() override;
std::string const getName() override { return spell + " on attacker"; }

View File

@@ -102,7 +102,7 @@ bool OutNumberedTrigger::IsActive()
bool BuffTrigger::IsActive()
{
Unit* target = GetTarget();
return SpellTrigger::IsActive() && !botAI->HasAura(spell, target, true);
return SpellTrigger::IsActive() && !botAI->HasAura(spell, target, false, checkIsOwner);
}
Value<Unit*>* BuffOnPartyTrigger::GetTargetValue()

View File

@@ -243,11 +243,14 @@ class HighAoeTrigger : public AoeTrigger
class BuffTrigger : public SpellTrigger
{
public:
BuffTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1) : SpellTrigger(botAI, spell, checkInterval) { }
BuffTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1, bool checkIsOwner = false) : SpellTrigger(botAI, spell, checkInterval) { this->checkIsOwner = checkIsOwner; }
public:
std::string const GetTargetName() override { return "self target"; }
bool IsActive() override;
protected:
bool checkIsOwner;
};
class BuffOnPartyTrigger : public BuffTrigger
@@ -303,7 +306,7 @@ class TargetInSightTrigger : public Trigger
class DebuffTrigger : public BuffTrigger
{
public:
DebuffTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1) : BuffTrigger(botAI, spell, checkInterval) { }
DebuffTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1, bool checkIsOwner = false) : BuffTrigger(botAI, spell, checkInterval, checkIsOwner) { }
std::string const GetTargetName() override { return "current target"; }
bool IsActive() override;