mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9780] Change CalcAbsorbResist/isBlocked to be called from target side
This commit is contained in:
parent
15dd77873e
commit
236a578d52
7 changed files with 68 additions and 68 deletions
|
|
@ -3524,7 +3524,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
|
|||
uint32 absorb = 0;
|
||||
uint32 resist = 0;
|
||||
|
||||
m_session->GetPlayer()->CalcAbsorbResist(target,schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
target->CalculateAbsorbAndResist(m_session->GetPlayer(),schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
|
||||
if (damage <= absorb + resist)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -857,9 +857,9 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
|
|||
uint32 absorb = 0;
|
||||
uint32 resist = 0;
|
||||
if (type == DAMAGE_LAVA)
|
||||
CalcAbsorbResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
CalculateAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
else if (type == DAMAGE_SLIME)
|
||||
CalcAbsorbResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
CalculateAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
|
||||
damage-=absorb+resist;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||
&Aura::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
|
||||
&Aura::HandleAuraModDisarm, // 67 SPELL_AURA_MOD_DISARM
|
||||
&Aura::HandleAuraModStalked, // 68 SPELL_AURA_MOD_STALKED
|
||||
&Aura::HandleSchoolAbsorb, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
|
||||
&Aura::HandleSchoolAbsorb, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalculateAbsorbAndResist
|
||||
&Aura::HandleUnused, // 70 SPELL_AURA_EXTRA_ATTACKS Useless, used by only one spell 41560 that has only visual effect (3.2.2a)
|
||||
&Aura::HandleModSpellCritChanceShool, // 71 SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
|
||||
&Aura::HandleModPowerCostPCT, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
|
||||
|
|
@ -131,7 +131,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||
&Aura::HandleAuraMounted, // 78 SPELL_AURA_MOUNTED
|
||||
&Aura::HandleModDamagePercentDone, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
|
||||
&Aura::HandleModPercentStat, // 80 SPELL_AURA_MOD_PERCENT_STAT
|
||||
&Aura::HandleNoImmediateEffect, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT implemented in Unit::CalcAbsorbResist
|
||||
&Aura::HandleNoImmediateEffect, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT implemented in Unit::CalculateAbsorbAndResist
|
||||
&Aura::HandleWaterBreathing, // 82 SPELL_AURA_WATER_BREATHING
|
||||
&Aura::HandleModBaseResistance, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
|
||||
&Aura::HandleModRegen, // 84 SPELL_AURA_MOD_REGEN
|
||||
|
|
@ -147,7 +147,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||
&Aura::HandleNoImmediateEffect, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::RegenerateAll
|
||||
&Aura::HandleAuraGhost, // 95 SPELL_AURA_GHOST
|
||||
&Aura::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Unit::SelectMagnetTarget
|
||||
&Aura::HandleManaShield, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
|
||||
&Aura::HandleManaShield, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalculateAbsorbAndResist
|
||||
&Aura::HandleAuraModSkill, // 98 SPELL_AURA_MOD_SKILL_TALENT
|
||||
&Aura::HandleAuraModAttackPower, // 99 SPELL_AURA_MOD_ATTACK_POWER
|
||||
&Aura::HandleUnused, //100 SPELL_AURA_AURAS_VISIBLE obsolete 3.x? all player can see all auras now, but still have 2 spells including GM-spell (1852,2855)
|
||||
|
|
@ -203,7 +203,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||
&Aura::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
|
||||
&Aura::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED
|
||||
&Aura::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
|
||||
&Aura::HandleNoImmediateEffect, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT implemented in Unit::CalcAbsorbResist
|
||||
&Aura::HandleNoImmediateEffect, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT implemented in Unit::CalculateAbsorbAndResist
|
||||
&Aura::HandleNoImmediateEffect, //154 SPELL_AURA_MOD_STEALTH_LEVEL implemented in Unit::isVisibleForOrDetect
|
||||
&Aura::HandleNoImmediateEffect, //155 SPELL_AURA_MOD_WATER_BREATHING implemented in Player::getMaxTimer
|
||||
&Aura::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN implemented in Player::CalculateReputationGain
|
||||
|
|
@ -6745,7 +6745,7 @@ void Aura::HandleModTargetResistance(bool apply, bool Real)
|
|||
// spells required only Real aura add/remove
|
||||
if(!Real)
|
||||
return;
|
||||
// applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
|
||||
// applied to damage as HandleNoImmediateEffect in Unit::CalculateAbsorbAndResist and Unit::CalcArmorReducedDamage
|
||||
|
||||
// show armor penetration
|
||||
if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL))
|
||||
|
|
@ -7101,7 +7101,7 @@ void Aura::PeriodicTick()
|
|||
if (IS_PLAYER_GUID(m_caster_guid))
|
||||
pdamage -= m_target->GetSpellDamageReduction(pdamage);
|
||||
|
||||
pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
|
||||
m_target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
|
||||
|
||||
sLog.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
|
||||
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb);
|
||||
|
|
@ -7176,7 +7176,7 @@ void Aura::PeriodicTick()
|
|||
if (IS_PLAYER_GUID(m_caster_guid))
|
||||
pdamage -= m_target->GetSpellDamageReduction(pdamage);
|
||||
|
||||
pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
|
||||
m_target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
|
||||
|
||||
if(m_target->GetHealth() < pdamage)
|
||||
pdamage = uint32(m_target->GetHealth());
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffectIndex eff_idx)
|
|||
// currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc
|
||||
damage = m_spellInfo->CalculateSimpleValue(eff_idx);
|
||||
|
||||
m_caster->CalcAbsorbResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
m_caster->CalculateAbsorbAndResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
|
||||
m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
|
|
|
|||
|
|
@ -1219,7 +1219,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S
|
|||
//Calculate damage bonus
|
||||
damage = MeleeDamageBonus(pVictim, damage, attackType, spellInfo, SPELL_DIRECT_DAMAGE);
|
||||
// Get blocked status
|
||||
blocked = isSpellBlocked(pVictim, spellInfo, attackType);
|
||||
blocked = pVictim->isSpellBlocked(this, spellInfo, attackType);
|
||||
|
||||
// if crit add critical bonus
|
||||
if (crit)
|
||||
|
|
@ -1281,7 +1281,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S
|
|||
}
|
||||
|
||||
uint32 absorb_affected_damage = CalcNotIgnoreAbsorbDamage(damage,damageSchoolMask,spellInfo);
|
||||
CalcAbsorbResist(pVictim, damageSchoolMask, SPELL_DIRECT_DAMAGE, absorb_affected_damage, &damageInfo->absorb, &damageInfo->resist, !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
|
||||
pVictim->CalculateAbsorbAndResist(this, damageSchoolMask, SPELL_DIRECT_DAMAGE, absorb_affected_damage, &damageInfo->absorb, &damageInfo->resist, !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
|
||||
damage-= damageInfo->absorb + damageInfo->resist;
|
||||
}
|
||||
else
|
||||
|
|
@ -1586,7 +1586,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||
|
||||
// Calculate absorb & resists
|
||||
uint32 absorb_affected_damage = CalcNotIgnoreAbsorbDamage(damageInfo->damage,damageInfo->damageSchoolMask);
|
||||
CalcAbsorbResist(damageInfo->target, damageInfo->damageSchoolMask, DIRECT_DAMAGE, absorb_affected_damage, &damageInfo->absorb, &damageInfo->resist, true);
|
||||
damageInfo->target->CalculateAbsorbAndResist(this, damageInfo->damageSchoolMask, DIRECT_DAMAGE, absorb_affected_damage, &damageInfo->absorb, &damageInfo->resist, true);
|
||||
damageInfo->damage-=damageInfo->absorb + damageInfo->resist;
|
||||
if (damageInfo->absorb)
|
||||
{
|
||||
|
|
@ -1824,18 +1824,18 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
|
|||
return (newdamage > 1) ? newdamage : 1;
|
||||
}
|
||||
|
||||
void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, bool canReflect)
|
||||
void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, bool canReflect)
|
||||
{
|
||||
if(!pVictim || !pVictim->isAlive() || !damage)
|
||||
if(!pCaster || !isAlive() || !damage)
|
||||
return;
|
||||
|
||||
// Magic damage, check for resists
|
||||
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL)==0)
|
||||
{
|
||||
// Get base victim resistance for school
|
||||
float tmpvalue2 = (float)pVictim->GetResistance(GetFirstSchoolInMask(schoolMask));
|
||||
float tmpvalue2 = (float)GetResistance(GetFirstSchoolInMask(schoolMask));
|
||||
// Ignore resistance by self SPELL_AURA_MOD_TARGET_RESISTANCE aura
|
||||
tmpvalue2 += (float)GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask);
|
||||
tmpvalue2 += (float)pCaster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask);
|
||||
|
||||
tmpvalue2 *= (float)(0.15f / getLevel());
|
||||
if (tmpvalue2 < 0.0f)
|
||||
|
|
@ -1867,7 +1867,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
int32 RemainingDamage = damage - *resist;
|
||||
|
||||
// Get unit state (need for some absorb check)
|
||||
uint32 unitflag = pVictim->GetUInt32Value(UNIT_FIELD_FLAGS);
|
||||
uint32 unitflag = GetUInt32Value(UNIT_FIELD_FLAGS);
|
||||
// Reflect damage spells (not cast any damage spell in aura lookup)
|
||||
uint32 reflectSpell = 0;
|
||||
int32 reflectDamage = 0;
|
||||
|
|
@ -1877,7 +1877,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
int32 preventDeathAmount = 0;
|
||||
|
||||
// full absorb cases (by chance)
|
||||
AuraList const& vAbsorb = pVictim->GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
|
||||
AuraList const& vAbsorb = GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
|
||||
for(AuraList::const_iterator i = vAbsorb.begin(); i != vAbsorb.end() && RemainingDamage > 0; ++i)
|
||||
{
|
||||
// only work with proper school mask damage
|
||||
|
|
@ -1890,7 +1890,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
if(i_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && i_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108))
|
||||
{
|
||||
int chance = 0;
|
||||
Unit::AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_ADD_PCT_MODIFIER);
|
||||
Unit::AuraList const& auras = GetAurasByType(SPELL_AURA_ADD_PCT_MODIFIER);
|
||||
for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
{
|
||||
SpellEntry const* itr_spellProto = (*itr)->GetSpellProto();
|
||||
|
|
@ -1908,7 +1908,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
RemainingDamage = 0;
|
||||
|
||||
// Frost Warding (mana regen)
|
||||
pVictim->CastCustomSpell(pVictim, 57776, &amount, NULL, NULL, true, NULL, *i);
|
||||
CastCustomSpell(this, 57776, &amount, NULL, NULL, true, NULL, *i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1921,7 +1921,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
int32 incanterAbsorption = 0;
|
||||
|
||||
// absorb without mana cost
|
||||
AuraList const& vSchoolAbsorb = pVictim->GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
|
||||
AuraList const& vSchoolAbsorb = GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
|
||||
for(AuraList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end() && RemainingDamage > 0; ++i)
|
||||
{
|
||||
Modifier* mod = (*i)->GetModifier();
|
||||
|
|
@ -1966,7 +1966,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
{
|
||||
// You have a chance equal to your Parry chance
|
||||
if (damagetype == DIRECT_DAMAGE && // Only for direct damage
|
||||
roll_chance_f(pVictim->GetUnitParryChance())) // Roll chance
|
||||
roll_chance_f(GetUnitParryChance())) // Roll chance
|
||||
RemainingDamage -= RemainingDamage * currentAbsorb / 100;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2008,8 +2008,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
{
|
||||
// Cheat Death (make less prio with Guardian Spirit case)
|
||||
if (!preventDeathSpell && spellProto->SpellIconID == 2109 &&
|
||||
pVictim->GetTypeId()==TYPEID_PLAYER && // Only players
|
||||
!((Player*)pVictim)->HasSpellCooldown(31231) &&
|
||||
GetTypeId()==TYPEID_PLAYER && // Only players
|
||||
!((Player*)this)->HasSpellCooldown(31231) &&
|
||||
// Only if no cooldown
|
||||
roll_chance_i((*i)->GetModifier()->m_amount))
|
||||
// Only if roll
|
||||
|
|
@ -2031,7 +2031,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
// Reflective Shield
|
||||
if (spellProto->SpellFamilyFlags == 0x1 && canReflect)
|
||||
{
|
||||
if (pVictim == this)
|
||||
if (pCaster == this)
|
||||
break;
|
||||
Unit* caster = (*i)->GetCaster();
|
||||
if (!caster)
|
||||
|
|
@ -2085,7 +2085,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
// This, if I'm not mistaken, shows that we get back ~2% of the absorbed damage as runic power.
|
||||
int32 absorbed = RemainingDamage * currentAbsorb / 100;
|
||||
int32 regen = absorbed * 2 / 10;
|
||||
pVictim->CastCustomSpell(pVictim, 49088, ®en, NULL, NULL, true, NULL, *i);
|
||||
CastCustomSpell(this, 49088, ®en, NULL, NULL, true, NULL, *i);
|
||||
RemainingDamage -= absorbed;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2109,8 +2109,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
RemainingDamage -= absorbed;
|
||||
|
||||
uint32 ab_damage = absorbed;
|
||||
DealDamageMods(caster,ab_damage,NULL);
|
||||
DealDamage(caster, ab_damage, NULL, damagetype, schoolMask, 0, false);
|
||||
pCaster->DealDamageMods(caster,ab_damage,NULL);
|
||||
pCaster->DealDamage(caster, ab_damage, NULL, damagetype, schoolMask, 0, false);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
@ -2147,7 +2147,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
{
|
||||
if ((*i)->GetModifier()->m_amount<=0)
|
||||
{
|
||||
pVictim->RemoveAurasDueToSpell((*i)->GetId());
|
||||
RemoveAurasDueToSpell((*i)->GetId());
|
||||
i = vSchoolAbsorb.begin();
|
||||
}
|
||||
else
|
||||
|
|
@ -2157,10 +2157,10 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
|
||||
// Cast back reflect damage spell
|
||||
if (canReflect && reflectSpell)
|
||||
pVictim->CastCustomSpell(this, reflectSpell, &reflectDamage, NULL, NULL, true, NULL, reflectTriggeredBy);
|
||||
CastCustomSpell(pCaster, reflectSpell, &reflectDamage, NULL, NULL, true, NULL, reflectTriggeredBy);
|
||||
|
||||
// absorb by mana cost
|
||||
AuraList const& vManaShield = pVictim->GetAurasByType(SPELL_AURA_MANA_SHIELD);
|
||||
AuraList const& vManaShield = GetAurasByType(SPELL_AURA_MANA_SHIELD);
|
||||
for(AuraList::const_iterator i = vManaShield.begin(), next; i != vManaShield.end() && RemainingDamage > 0; i = next)
|
||||
{
|
||||
next = i; ++next;
|
||||
|
|
@ -2177,15 +2177,15 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
|
||||
if (float manaMultiplier = (*i)->GetSpellProto()->EffectMultipleValue[(*i)->GetEffIndex()])
|
||||
{
|
||||
if(Player *modOwner = pVictim->GetSpellModOwner())
|
||||
if(Player *modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
|
||||
|
||||
int32 maxAbsorb = int32(pVictim->GetPower(POWER_MANA) / manaMultiplier);
|
||||
int32 maxAbsorb = int32(GetPower(POWER_MANA) / manaMultiplier);
|
||||
if (currentAbsorb > maxAbsorb)
|
||||
currentAbsorb = maxAbsorb;
|
||||
|
||||
int32 manaReduction = int32(currentAbsorb * manaMultiplier);
|
||||
pVictim->ApplyPowerMod(POWER_MANA, manaReduction, false);
|
||||
ApplyPowerMod(POWER_MANA, manaReduction, false);
|
||||
}
|
||||
|
||||
// Mana Shield (or Fire Ward or Frost Ward or Ice Barrier)
|
||||
|
|
@ -2196,7 +2196,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
(*i)->GetModifier()->m_amount -= currentAbsorb;
|
||||
if((*i)->GetModifier()->m_amount <= 0)
|
||||
{
|
||||
pVictim->RemoveAurasDueToSpell((*i)->GetId());
|
||||
RemoveAurasDueToSpell((*i)->GetId());
|
||||
next = vManaShield.begin();
|
||||
}
|
||||
|
||||
|
|
@ -2207,7 +2207,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
// Incanter's Absorption, if have affective absorbing
|
||||
if (incanterAbsorption)
|
||||
{
|
||||
Unit::AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
|
||||
Unit::AuraList const& auras = GetAurasByType(SPELL_AURA_DUMMY);
|
||||
for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
{
|
||||
SpellEntry const* itr_spellProto = (*itr)->GetSpellProto();
|
||||
|
|
@ -2220,20 +2220,20 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
int32 amount = int32(incanterAbsorption * (*itr)->GetModifier()->m_amount / 100);
|
||||
|
||||
// apply normalized part of already accumulated amount in aura
|
||||
if (Aura* spdAura = pVictim->GetAura(44413, EFFECT_INDEX_0))
|
||||
if (Aura* spdAura = GetAura(44413, EFFECT_INDEX_0))
|
||||
amount += spdAura->GetModifier()->m_amount * spdAura->GetAuraDuration() / spdAura->GetAuraMaxDuration();
|
||||
|
||||
// Incanter's Absorption (triggered absorb based spell power, will replace existed if any)
|
||||
pVictim->CastCustomSpell(pVictim, 44413, &amount, NULL, NULL, true);
|
||||
CastCustomSpell(this, 44413, &amount, NULL, NULL, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only split damage if not damaging yourself
|
||||
if(pVictim != this)
|
||||
if(pCaster != this)
|
||||
{
|
||||
AuraList const& vSplitDamageFlat = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT);
|
||||
AuraList const& vSplitDamageFlat = GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT);
|
||||
for(AuraList::const_iterator i = vSplitDamageFlat.begin(), next; i != vSplitDamageFlat.end() && RemainingDamage >= 0; i = next)
|
||||
{
|
||||
next = i; ++next;
|
||||
|
|
@ -2244,7 +2244,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
|
||||
// Damage can be splitted only if aura has an alive caster
|
||||
Unit *caster = (*i)->GetCaster();
|
||||
if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
|
||||
if(!caster || caster == this || !caster->IsInWorld() || !caster->isAlive())
|
||||
continue;
|
||||
|
||||
int32 currentAbsorb;
|
||||
|
|
@ -2258,15 +2258,15 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
|
||||
uint32 splitted = currentAbsorb;
|
||||
uint32 splitted_absorb = 0;
|
||||
DealDamageMods(caster,splitted,&splitted_absorb);
|
||||
pCaster->DealDamageMods(caster,splitted,&splitted_absorb);
|
||||
|
||||
SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, splitted_absorb, 0, false, 0, false);
|
||||
pCaster->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);
|
||||
pCaster->DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
|
||||
}
|
||||
|
||||
AuraList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
|
||||
AuraList const& vSplitDamagePct = GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
|
||||
for(AuraList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next)
|
||||
{
|
||||
next = i; ++next;
|
||||
|
|
@ -2277,7 +2277,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
|
||||
// Damage can be splitted only if aura has an alive caster
|
||||
Unit *caster = (*i)->GetCaster();
|
||||
if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
|
||||
if(!caster || caster == this || !caster->IsInWorld() || !caster->isAlive())
|
||||
continue;
|
||||
|
||||
uint32 splitted = uint32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
|
||||
|
|
@ -2285,17 +2285,17 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
RemainingDamage -= int32(splitted);
|
||||
|
||||
uint32 split_absorb = 0;
|
||||
DealDamageMods(caster,splitted,&split_absorb);
|
||||
pCaster->DealDamageMods(caster,splitted,&split_absorb);
|
||||
|
||||
SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false);
|
||||
pCaster->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);
|
||||
pCaster->DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply death prevention spells effects
|
||||
if (preventDeathSpell && RemainingDamage >= (int32)pVictim->GetHealth())
|
||||
if (preventDeathSpell && RemainingDamage >= (int32)GetHealth())
|
||||
{
|
||||
switch(preventDeathSpell->SpellFamilyName)
|
||||
{
|
||||
|
|
@ -2305,11 +2305,11 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
// Cheat Death
|
||||
if (preventDeathSpell->SpellIconID == 2109)
|
||||
{
|
||||
pVictim->CastSpell(pVictim,31231,true);
|
||||
((Player*)pVictim)->AddSpellCooldown(31231,0,time(NULL)+60);
|
||||
CastSpell(this,31231,true);
|
||||
((Player*)this)->AddSpellCooldown(31231,0,time(NULL)+60);
|
||||
// with health > 10% lost health until health==10%, in other case no losses
|
||||
uint32 health10 = pVictim->GetMaxHealth()/10;
|
||||
RemainingDamage = pVictim->GetHealth() > health10 ? pVictim->GetHealth() - health10 : 0;
|
||||
uint32 health10 = GetMaxHealth()/10;
|
||||
RemainingDamage = GetHealth() > health10 ? GetHealth() - health10 : 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -2319,9 +2319,9 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||
// Guardian Spirit
|
||||
if (preventDeathSpell->SpellIconID == 2873)
|
||||
{
|
||||
int32 healAmount = pVictim->GetMaxHealth() * preventDeathAmount / 100;
|
||||
pVictim->CastCustomSpell(pVictim, 48153, &healAmount, NULL, NULL, true);
|
||||
pVictim->RemoveAurasDueToSpell(preventDeathSpell->Id);
|
||||
int32 healAmount = GetMaxHealth() * preventDeathAmount / 100;
|
||||
CastCustomSpell(this, 48153, &healAmount, NULL, NULL, true);
|
||||
RemoveAurasDueToSpell(preventDeathSpell->Id);
|
||||
RemainingDamage = 0;
|
||||
}
|
||||
break;
|
||||
|
|
@ -2671,9 +2671,9 @@ void Unit::SendMeleeAttackStop(Unit* victim)
|
|||
((Creature*)victim)->AI().EnterEvadeMode(this);*/
|
||||
}
|
||||
|
||||
bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, WeaponAttackType attackType)
|
||||
bool Unit::isSpellBlocked(Unit *pCaster, SpellEntry const * /*spellProto*/, WeaponAttackType attackType)
|
||||
{
|
||||
if (pVictim->HasInArc(M_PI_F,this))
|
||||
if (HasInArc(M_PI_F,pCaster))
|
||||
{
|
||||
/* Currently not exist spells with ignore block
|
||||
// Ignore combat result aura (parry/dodge check on prepare)
|
||||
|
|
@ -2688,12 +2688,12 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, Weap
|
|||
*/
|
||||
|
||||
// Check creatures flags_extra for disable block
|
||||
if(pVictim->GetTypeId()==TYPEID_UNIT &&
|
||||
((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK )
|
||||
if(GetTypeId()==TYPEID_UNIT &&
|
||||
((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK )
|
||||
return false;
|
||||
|
||||
float blockChance = pVictim->GetUnitBlockChance();
|
||||
blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(pVictim->GetMaxSkillValueForLevel()))*0.04f;
|
||||
float blockChance = GetUnitBlockChance();
|
||||
blockChance += (int32(pCaster->GetWeaponSkillValue(attackType)) - int32(GetMaxSkillValueForLevel()))*0.04f;
|
||||
if (roll_chance_f(blockChance))
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1711,7 +1711,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim);
|
||||
uint32 SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1);
|
||||
int32 SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack = 1);
|
||||
bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK);
|
||||
bool isSpellBlocked(Unit *pCaster, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK);
|
||||
bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK);
|
||||
uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
|
||||
uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
|
||||
|
|
@ -1741,7 +1741,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
// redefined in Creature
|
||||
|
||||
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage);
|
||||
void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, bool canReflect = false);
|
||||
void CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, bool canReflect = false);
|
||||
|
||||
void UpdateWalkMode(Unit* source, bool self = true);
|
||||
void UpdateSpeed(UnitMoveType mtype, bool forced, float ratio = 1.0f);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9779"
|
||||
#define REVISION_NR "9780"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue