aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorWyrserth <wyrserth@protonmail.com>2019-06-26 18:08:19 +0200
committerGitHub <noreply@github.com>2019-06-26 18:08:19 +0200
commit7a71127da92bd833caf4188aee2d5e88c61ae772 (patch)
tree6601010e7f424952c6f559899a6122fe77071d79 /src/server/game/AI/SmartScripts
parent8967cc96df4c1c5c7465e9fd1fa66400f3e992b3 (diff)
Core/SAI: allow creatures to handle gameobject spellhit SAI events. (#23492)
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp10
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 7165abdc8f2..2856a55a245 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -609,11 +609,21 @@ void SmartAI::SpellHit(Unit* unit, SpellInfo const* spellInfo)
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, unit, 0, 0, false, spellInfo);
}
+void SmartAI::SpellHitByGameObject(GameObject* object, SpellInfo const* spellInfo)
+{
+ GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, nullptr, 0, 0, false, spellInfo, object);
+}
+
void SmartAI::SpellHitTarget(Unit* target, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, spellInfo);
}
+void SmartAI::SpellHitTargetGameObject(GameObject* target, SpellInfo const* spellInfo)
+{
+ GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, nullptr, 0, 0, false, spellInfo, target);
+}
+
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index fa3af7b9549..2cf6c0e6b2a 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -99,9 +99,11 @@ class TC_GAME_API SmartAI : public CreatureAI
// Called when hit by a spell
void SpellHit(Unit* unit, SpellInfo const* spellInfo) override;
+ void SpellHitByGameObject(GameObject* object, SpellInfo const* spellInfo) override;
// Called when spell hits a target
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override;
+ void SpellHitTargetGameObject(GameObject* object, SpellInfo const* spellInfo) override;
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit* doneBy, uint32& damage) override;