aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp1
-rw-r--r--src/game/Creature.h13
-rw-r--r--src/game/Unit.cpp4
3 files changed, 13 insertions, 5 deletions
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp
index 599767b591f..66b99a98f9e 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp
@@ -62,6 +62,7 @@ struct TRINITY_DLL_DECL boss_murmurAI : public Scripted_NoMovementAI
//database should have `RegenHealth`=0 to prevent regen
uint32 hp = (m_creature->GetMaxHealth()*40)/100;
if (hp) m_creature->SetHealth(hp);
+ m_creature->ResetDamageByPlayers();
}
void SonicBoomEffect()
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 155ba3e8dd8..4249e497c4b 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -722,10 +722,15 @@ class TRINITY_DLL_SPEC Creature : public Unit
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
bool IsReputationGainDisabled() { return DisableReputationGain; }
- bool IsDamageEnoughForLootingAndReward() { return m_unDamageByPlayers >= (uint32)(GetMaxHealth() / 2); }
- void AddDamageByPlayers(uint32 unDamage) { m_unDamageByPlayers += unDamage; }
- void ResetDamageByPlayers() { m_unDamageByPlayers = 0; }
-
+ bool IsDamageEnoughForLootingAndReward() { return m_PlayerDamageReq == 0; }
+ void AddDamageByPlayers(uint32 unDamage)
+ {
+ if(m_PlayerDamageReq > 0)
+ m_PlayerDamageReq > unDamage ? m_PlayerDamageReq -= unDamage : m_PlayerDamageReq = 0;
+ }
+ void ResetDamageByPlayers() { m_PlayerDamageReq = (uint32)(GetHealth() *50 / GetMaxHealth()); }
+ uint32 m_PlayerDamageReq;
+
void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; }
protected:
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f014448bdb5..39a14825573 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -586,8 +586,10 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
{
if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsAIEnabled)
+ {
((Creature*)pVictim)->AI()->DamageTaken(this, damage);
-
+ ((Creature*)pVictim)->AddDamageByPlayers(damage);
+ }
if (damagetype != NODAMAGE)
{
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)