Jump to content

[PATCH] Target Avoided Normal Melee Hit


Guest DaC

Recommended Posts

What bug does the patch fix? What features does the patch add?

This will provide a function for SD2 to catch an avoid of a melee hit. This should be at least used for Zul'Aman's last encounter Zul'Jin - Spell Overpower.

He casts this spell when his target dodges one of his melee attacks.

Warrior's Overpower for players is handled in a special way with combopoints, which do not exist for creatures. (and Zul'Jin's spell does not have combopoint flag)

For which repository revision was the patch created?

MaNGOS One - some before latest revision

Who has been writing this patch? Please include either forum user names or email addresses.

me

From 96ec132991775707a0bf1d602c4d774b9d9f2b61 Mon Sep 17 00:00:00 2001
From: DaC <[email protected]>
Date: Thu, 22 Sep 2011 00:08:41 +0200
Subject: [PATCH] Implement CreatureAI function for avoided melee damage

---
src/game/CreatureAI.h |    3 +++
src/game/Unit.cpp     |    5 +++++
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h
index 2a49d50..1056421 100644
--- a/src/game/CreatureAI.h
+++ b/src/game/CreatureAI.h
@@ -109,6 +109,9 @@ class MANGOS_DLL_SPEC CreatureAI
        // Called when owner of m_creature (if m_creature is PROTECTOR_PET) kills a unit
        virtual void OwnerKilledUnit(Unit *) {}

+        // Called when the creatures target avoids a normal meleehit
+        virtual void TargetAvoidedNormalMeleeHit(uint32 /*MeleeHitOutcome*/) {}
+
        // Called when the creature summon successfully other creature
        virtual void JustSummoned(Creature* ) {}

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 50c1ef0..beda809 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -555,6 +555,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
            pVictim->SetStandState(UNIT_STAND_STATE_STAND);
    }

+    // call TargetAvoidedNormalMeleeHit for unit
+    if (cleanDamage && (cleanDamage->hitOutCome != MELEE_HIT_NORMAL))
+        if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
+            ((Creature*)this)->AI()->TargetAvoidedNormalMeleeHit(cleanDamage->hitOutCome);
+
    if(!damage)
    {
        // Rage from physical damage received .
-- 
1.7.1

greetings, DaC

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use