mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Merge commit 'origin/master' into 310
This commit is contained in:
commit
3c43e9dd52
14 changed files with 153 additions and 52 deletions
|
|
@ -374,10 +374,15 @@ void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage)
|
|||
RemoveSpellsCausingAura(auraType);
|
||||
}
|
||||
|
||||
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
|
||||
void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
|
||||
{
|
||||
if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
return 0;
|
||||
{
|
||||
if(absorb)
|
||||
absorb += damage;
|
||||
damage = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
//You don't lose health from damage taken from another player while in a sanctuary
|
||||
//You still see it in the combat log though
|
||||
|
|
@ -385,9 +390,28 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
{
|
||||
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
||||
if(area && area->flags & AREA_FLAG_SANCTUARY) //sanctuary
|
||||
return 0;
|
||||
{
|
||||
if(absorb)
|
||||
absorb += damage;
|
||||
damage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 originalDamage = damage;
|
||||
|
||||
//Script Event damage Deal
|
||||
if( GetTypeId()== TYPEID_UNIT && ((Creature *)this)->AI())
|
||||
((Creature *)this)->AI()->DamageDeal(pVictim, damage);
|
||||
//Script Event damage taken
|
||||
if( pVictim->GetTypeId()== TYPEID_UNIT && ((Creature *)pVictim)->AI() )
|
||||
((Creature *)pVictim)->AI()->DamageTaken(this, damage);
|
||||
|
||||
if(absorb && originalDamage > damage)
|
||||
absorb += (originalDamage - damage);
|
||||
}
|
||||
|
||||
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
|
||||
{
|
||||
// remove affects from victim (including from 0 damage and DoTs)
|
||||
if(pVictim != this)
|
||||
pVictim->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
|
|
@ -405,13 +429,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
pVictim->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
}
|
||||
|
||||
//Script Event damage Deal
|
||||
if( GetTypeId()== TYPEID_UNIT && ((Creature *)this)->AI())
|
||||
((Creature *)this)->AI()->DamageDeal(pVictim, damage);
|
||||
//Script Event damage taken
|
||||
if( pVictim->GetTypeId()== TYPEID_UNIT && ((Creature *)pVictim)->AI() )
|
||||
((Creature *)pVictim)->AI()->DamageTaken(this, damage);
|
||||
|
||||
if(!damage)
|
||||
{
|
||||
// Rage from physical damage received .
|
||||
|
|
@ -985,6 +1002,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage
|
|||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID);
|
||||
SpellNonMeleeDamage damageInfo(this, pVictim, spellInfo->Id, spellInfo->SchoolMask);
|
||||
CalculateSpellDamage(&damageInfo, damage, spellInfo);
|
||||
DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb);
|
||||
SendSpellNonMeleeDamageLog(&damageInfo);
|
||||
DealSpellDamage(&damageInfo, true);
|
||||
return damageInfo.damage;
|
||||
|
|
@ -1514,6 +1532,8 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||
//CalcAbsorbResist(pVictim, SpellSchools(spellProto->School), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
//damage-=absorb + resist;
|
||||
|
||||
pVictim->DealDamageMods(this,damage,NULL);
|
||||
|
||||
WorldPacket data(SMSG_SPELLDAMAGESHIELD,(8+8+4+4+4+4));
|
||||
data << uint64(pVictim->GetGUID());
|
||||
data << uint64(GetGUID());
|
||||
|
|
@ -1809,8 +1829,12 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
int32 canabsorb = caster->GetHealth();
|
||||
if (canabsorb < absorbed)
|
||||
absorbed = canabsorb;
|
||||
DealDamage(caster, absorbed, NULL, damagetype, schoolMask, 0, false);
|
||||
|
||||
RemainingDamage -= absorbed;
|
||||
|
||||
uint32 ab_damage = absorbed;
|
||||
DealDamageMods(caster,ab_damage,NULL);
|
||||
DealDamage(caster, ab_damage, NULL, damagetype, schoolMask, 0, false);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1914,10 +1938,15 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
|
||||
RemainingDamage -= currentAbsorb;
|
||||
|
||||
SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, currentAbsorb, schoolMask, 0, 0, false, 0, false);
|
||||
|
||||
CleanDamage cleanDamage = CleanDamage(currentAbsorb, BASE_ATTACK, MELEE_HIT_NORMAL);
|
||||
DealDamage(caster, currentAbsorb, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
|
||||
uint32 splitted = currentAbsorb;
|
||||
uint32 splitted_absorb = 0;
|
||||
DealDamageMods(caster,splitted,&splitted_absorb);
|
||||
|
||||
SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, splitted_absorb, 0, false, 0, false);
|
||||
|
||||
CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
|
||||
DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
|
||||
}
|
||||
|
||||
AuraList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
|
||||
|
|
@ -1934,11 +1963,14 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
|
||||
continue;
|
||||
|
||||
int32 splitted = int32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
|
||||
uint32 splitted = uint32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
|
||||
|
||||
RemainingDamage -= splitted;
|
||||
RemainingDamage -= int32(splitted);
|
||||
|
||||
SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, 0, 0, false, 0, false);
|
||||
uint32 split_absorb = 0;
|
||||
DealDamageMods(caster,splitted,&split_absorb);
|
||||
|
||||
SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false);
|
||||
|
||||
CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
|
||||
DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
|
||||
|
|
@ -2028,6 +2060,7 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
|||
CalcDamageInfo damageInfo;
|
||||
CalculateMeleeDamage(pVictim, 0, &damageInfo, attType);
|
||||
// Send log damage message to client
|
||||
DealDamageMods(pVictim,damageInfo.damage,&damageInfo.absorb);
|
||||
SendAttackStateUpdate(&damageInfo);
|
||||
ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType);
|
||||
DealMeleeDamage(&damageInfo,true);
|
||||
|
|
@ -10656,6 +10689,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
|||
sLog.outDebug("ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", auraModifier->m_amount, spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
|
||||
SpellNonMeleeDamage damageInfo(this, pTarget, spellInfo->Id, spellInfo->SchoolMask);
|
||||
CalculateSpellDamage(&damageInfo, auraModifier->m_amount, spellInfo);
|
||||
DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb);
|
||||
SendSpellNonMeleeDamageLog(&damageInfo);
|
||||
DealSpellDamage(&damageInfo, true);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue