Core/Spells: add SPELL_ATTR_CU_IGNORE_ARMOR to the avalible custom attribute list, make some spells use the attribute. Research made with JohnHoliver and Shauren

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-18 19:26:07 +02:00
parent b8a613647f
commit 2ffe785765
6 changed files with 42 additions and 9 deletions
+1 -1
View File
@@ -3992,7 +3992,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
if (schoolmask & SPELL_SCHOOL_MASK_NORMAL)
if (Unit::IsDamageReducedByArmor(schoolmask))
damage = m_session->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
char* spellStr = strtok((char*)NULL, " ");
+21 -2
View File
@@ -1041,7 +1041,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
uint32 crTypeMask = pVictim->GetCreatureTypeMask();
if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
if (IsDamageReducedByArmor(damageSchoolMask, spellInfo))
damage = CalcArmorReducedDamage(pVictim, damage, spellInfo, attackType);
bool blocked = false;
@@ -1252,7 +1252,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
MeleeDamageBonus(damageInfo->target, &damage, damageInfo->attackType);
// Calculate armor reduction
if (damageInfo->damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask)))
{
damageInfo->damage = CalcArmorReducedDamage(damageInfo->target, damage, NULL , damageInfo->attackType);
damageInfo->cleanDamage += damage - damageInfo->damage;
@@ -1565,6 +1565,25 @@ void Unit::HandleEmoteCommand(uint32 anim_id)
SendMessageToSet(&data, true);
}
bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellEntry const *spellInfo, uint8 effIndex)
{
// only physical spells damage gets reduced by armor
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
return false;
if (spellInfo)
{
// there are spells with no specific attribute but they have "ignores armor" in tooltip
if (sSpellMgr.GetSpellCustomAttr(spellInfo->Id) & SPELL_ATTR_CU_IGNORE_ARMOR)
return false;
// bleeding effects are not reduced by armor
if (effIndex != MAX_SPELL_EFFECTS && spellInfo->EffectApplyAuraName[effIndex] == SPELL_AURA_PERIODIC_DAMAGE)
if (GetSpellMechanicMask(spellInfo, effIndex) & MECHANIC_BLEED)
return false;
}
return true;
}
uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType /*attackType*/)
{
uint32 newdamage = 0;
+1
View File
@@ -1851,6 +1851,7 @@ class Unit : public WorldObject
virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
// redefined in Creature
uint32 CalcNotIgnoreDamageRedunction(uint32 damage, SpellSchoolMask damageSchoolMask);
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellEntry const *spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS);
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const *spellInfo = NULL);
void CalcHealAbsorb(Unit *pVictim, const SpellEntry *spellProto, uint32 &healAmount, uint32 &absorb);
@@ -1271,10 +1271,8 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
{
damage = caster->SpellDamageBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount());
// Calculate armor mitigation if it is a physical spell
// But not for bleed mechanic spells
if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL &&
GetEffectMechanic(GetSpellProto(), m_effIndex) != MECHANIC_BLEED)
// Calculate armor mitigation
if (Unit::IsDamageReducedByArmor(GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), m_effIndex))
{
uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellProto());
cleanDamage.mitigated_damage += damage - damageReductedArmor;
@@ -1384,8 +1382,8 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
if (crit)
damage = caster->SpellCriticalDamageBonus(m_spellProto, damage, target);
//Calculate armor mitigation if it is a physical spell
if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL)
// Calculate armor mitigation
if (Unit::IsDamageReducedByArmor(GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), m_effIndex))
{
uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellProto());
cleanDamage.mitigated_damage += damage - damageReductedArmor;
+14
View File
@@ -3853,6 +3853,20 @@ void SpellMgr::LoadSpellCustomAttr()
spellInfo->EffectRadiusIndex[0] = 12;
count++;
break;
case 18500: // Wing Buffet
case 33086: // Wild Bite
case 49749: // Piercing Blow
case 53454: // Impale
case 59446: // Impale
case 62383: // Shatter
case 64777: // Machine Gun
case 65239: // Machine Gun
case 65919: // Pursuing Spikes
case 69293: // Wing Buffet
case 74439: // Machine Gun
mSpellCustomAttr[i] |= SPELL_ATTR_CU_IGNORE_ARMOR;
count++;
break;
default:
break;
}
+1
View File
@@ -880,6 +880,7 @@ inline bool IsProfessionSkill(uint32 skill)
#define SPELL_ATTR_CU_NEGATIVE_EFF1 0x00020000
#define SPELL_ATTR_CU_NEGATIVE_EFF2 0x00040000
#define SPELL_ATTR_CU_NEGATIVE 0x00070000
#define SPELL_ATTR_CU_IGNORE_ARMOR 0x00080000
typedef std::vector<uint32> SpellCustomAttribute;
typedef std::vector<bool> EnchantCustomAttribute;