aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp1
-rw-r--r--src/game/Creature.cpp1
-rw-r--r--src/game/Creature.h12
-rw-r--r--src/game/Unit.cpp4
4 files changed, 12 insertions, 6 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.cpp b/src/game/Creature.cpp
index b3e735aa2de..7f249b36fbd 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -154,7 +154,6 @@ m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL), m_summo
m_unit_movement_flags = MOVEMENTFLAG_WALK_MODE;
DisableReputationGain = false;
ResetDamageByPlayers();
- m_MinPlayerDamageReq = (uint32)(m_creature->GetHealth / m_creature->GetMaxHealth * 50);
}
Creature::~Creature()
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 13e6479cf0d..ec02eb41742 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -722,10 +722,14 @@ class TRINITY_DLL_SPEC Creature : public Unit
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
bool IsReputationGainDisabled() { return DisableReputationGain; }
- bool IsDamageEnoughForLootingAndReward() { return m_unDamageByPlayers >= m_MinPlayerDamageReq; }
- void AddDamageByPlayers(uint32 unDamage) { m_unDamageByPlayers += unDamage; }
- void ResetDamageByPlayers() { m_unDamageByPlayers = 0; }
- uint32 m_MinPlayerDamageReq;
+ 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; }
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 79e31ce6dce..7704e4e0daa 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)