Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,58 @@ bool CastAuraSpellAction::isUseful()
return CastSpellAction::isUseful() && !ai->HasAura(spell, GetTarget());
}

bool CastDebuffSpellAction::isUseful()
{
if (!CastAuraSpellAction::isUseful())
{
return false;
}

Unit* target = GetTarget();
if (!target)
{
return true;
}

Player* bot = ai->GetBot();
Group* group = bot->GetGroup();
if (!group || group->GetTargetIcon(4) != target->GetObjectGuid())
{
return true;
}

Player* tank = ai->GetGroupTank(bot);
if (!tank)
{
return true;
}

Unit* tankVictim = tank->getVictim();
if (tankVictim && tankVictim->GetObjectGuid() == target->GetObjectGuid())
{
return true;
}

uint32 spellId = AI_VALUE2(uint32, "spell id", spell);
if (spellId)
{
const SpellEntry* spellInfo = sSpellStore.LookupEntry(spellId);
if (spellInfo)
{
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
{
if (spellInfo->EffectAura[j] == SPELL_AURA_PERIODIC_DAMAGE ||
spellInfo->EffectAura[j] == SPELL_AURA_PERIODIC_DAMAGE_PERCENT)
{
return false;
}
}
}
}

return true;
}

bool CastEnchantItemAction::isUseful()
{
if (!CastSpellAction::isUseful())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ namespace ai
{
public:
CastDebuffSpellAction(PlayerbotAI* ai, string spell) : CastAuraSpellAction(ai, spell) {}
virtual bool isUseful();
};

class CastDebuffSpellOnAttackerAction : public CastAuraSpellAction
Expand Down
Loading