diff options
| author | megamage <none@none> | 2009-05-15 13:57:10 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-05-15 13:57:10 -0500 |
| commit | ff7f023ff1eb884213ca0efccf686c7387920952 (patch) | |
| tree | 10bb1c87e9eda6ffd749100245c154f1fc8c7a28 /src/game/Unit.cpp | |
| parent | e826b482a59347d55274e183125062534d0f4efb (diff) | |
| parent | bfaaa8201e6887fedd2145d668f40a484a609dac (diff) | |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d267a99b69d..9db62bf51fe 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -711,8 +711,15 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (pVictim->GetTypeId() == TYPEID_PLAYER) ((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); - if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->hasLootRecipient()) - ((Creature*)pVictim)->SetLootRecipient(this); + if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet()) + { + if(!((Creature*)pVictim)->hasLootRecipient()) + ((Creature*)pVictim)->SetLootRecipient(this); + + if(GetCharmerOrOwnerPlayerOrPlayerItself()) + ((Creature*)pVictim)->AddDamageByPlayers(health < damage ? health : damage); + } + if (health <= damage) { DEBUG_LOG("DealDamage: victim just died"); @@ -13005,11 +13012,19 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) // find player: owner of controlled `this` or `this` itself maybe Player *player = GetCharmerOrOwnerPlayerOrPlayerItself(); - if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient()) + bool bRewardIsAllowed = true; + if(pVictim->GetTypeId() == TYPEID_UNIT) + { + bRewardIsAllowed = ((Creature*)pVictim)->IsDamageEnoughForLootingAndReward(); + if(!bRewardIsAllowed) + ((Creature*)pVictim)->SetLootRecipient(NULL); + } + + if(bRewardIsAllowed && pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient()) player = ((Creature*)pVictim)->GetLootRecipient(); // Reward player, his pets, and group/raid members // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop) - if(player && player!=pVictim) + if(bRewardIsAllowed && player && player!=pVictim) { if(player->RewardPlayerAndGroupAtKill(pVictim)) player->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0); |
