fix(Core/SmartScripts): Added new parameter onlyInCombat to `SMART_… (#13947)

* fix(Core/SmartScripts): Added new parameter `onlyInCombat` to `SMART_EVENT_FRIENDLY_MISSING_BUFF` event.

Coilfang Scale-Healer should cast Power Word: Shield only in combat.
Fixes #13838

* missing sql.
This commit is contained in:
UltraNix
2022-12-11 15:35:28 +01:00
committed by GitHub
parent 72b446fb12
commit b615ccd9e9
3 changed files with 17 additions and 9 deletions

View File

@@ -3511,16 +3511,21 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
break;
}
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
{
if (e.event.missingBuff.onlyInCombat && !me->IsEngaged())
{
std::vector<Creature*> creatures;
DoFindFriendlyMissingBuff(creatures, float(e.event.missingBuff.radius), e.event.missingBuff.spell);
if (creatures.empty())
return;
ProcessTimedAction(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax, Acore::Containers::SelectRandomContainerElement(creatures));
break;
return;
}
std::vector<Creature*> creatures;
DoFindFriendlyMissingBuff(creatures, float(e.event.missingBuff.radius), e.event.missingBuff.spell);
if (creatures.empty())
return;
ProcessTimedAction(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax, Acore::Containers::SelectRandomContainerElement(creatures));
break;
}
case SMART_EVENT_HAS_AURA:
{
if (!me)

View File

@@ -131,7 +131,7 @@ enum SMART_EVENT
SMART_EVENT_VICTIM_CASTING = 13, // RepeatMin, RepeatMax, spellid
SMART_EVENT_FRIENDLY_HEALTH = 14, // HPDeficit, Radius, RepeatMin, RepeatMax
SMART_EVENT_FRIENDLY_IS_CC = 15, // Radius, RepeatMin, RepeatMax
SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax
SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax, onlyInCombat
SMART_EVENT_SUMMONED_UNIT = 17, // CreatureId(0 all), CooldownMin, CooldownMax
SMART_EVENT_TARGET_MANA_PCT = 18, // ManaMin%, ManaMax%, RepeatMin, RepeatMax
SMART_EVENT_ACCEPTED_QUEST = 19, // QuestID (0 = any), CooldownMin, CooldownMax
@@ -301,6 +301,7 @@ struct SmartEvent
uint32 radius;
uint32 repeatMin;
uint32 repeatMax;
uint32 onlyInCombat;
} missingBuff;
struct