aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-06 15:21:44 -0600
committermegamage <none@none>2009-03-06 15:21:44 -0600
commit50b3095312ef01dcc748011d740a8fadfaa04b6c (patch)
tree2260ac10775016e7cc5ded834eb4754adc8aa3a2 /src/game/Unit.cpp
parent2e0af6e37b17b76651e50b24a016b045f747b658 (diff)
Implement some death related achievements
* ACHIEVEMENT_CRITERIA_TYPE_DEATH (normal and arena types counting) * ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON (instance types by man limit counting) Note: need fixed for cases when max allowed players different from recommended count. * ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM (environment damage sources by types) Fixed: * ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER - self-kill counting as death from players - same team player kill in opposition kills counter. Also cleanup in Player::EnvironmentalDamage use DBCStructure.h comment. Author: VladimirMangos --HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 60018a88a9c..da76612bec7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -728,6 +728,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->hasLootRecipient())
((Creature*)pVictim)->SetLootRecipient(this);
+
if (health <= damage)
{
DEBUG_LOG("DealDamage: victim just died");
@@ -805,12 +806,12 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
((Creature*)this)->AI()->KilledUnit(pVictim);
// achievement stuff
- if ( pVictim->GetTypeId() == TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
- if(GetTypeId() == TYPEID_UNIT)
+ if (GetTypeId() == TYPEID_UNIT)
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, GetEntry());
- else if(GetTypeId() == TYPEID_PLAYER)
- ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1);
+ else if(GetTypeId() == TYPEID_PLAYER && pVictim != this)
+ ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, ((Player*)this)->GetTeam());
}
// 10% durability loss on death
@@ -12482,14 +12483,14 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
}
}
- // achievement stuff
- if ( pVictim->GetTypeId() == TYPEID_PLAYER)
- {
- if(GetTypeId() == TYPEID_UNIT)
- ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, GetEntry());
- else if(GetTypeId() == TYPEID_PLAYER)
- ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1);
- }
+ // achievement stuff
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (GetTypeId() == TYPEID_UNIT)
+ ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, GetEntry());
+ else if(GetTypeId() == TYPEID_PLAYER && pVictim != this)
+ ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, ((Player*)this)->GetTeam());
+ }
}
void Unit::SetControlled(bool apply, UnitState state)