mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +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
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue