Fixed wand damage immunity
This commit is contained in:
parent
2590413559
commit
f36301c474
@ -3107,6 +3107,15 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* pVictim, SpellEntry const* spell)
|
|||||||
// Resist
|
// Resist
|
||||||
SpellMissInfo Unit::SpellHitResult(Unit* pVictim, SpellEntry const* spell, bool CanReflect)
|
SpellMissInfo Unit::SpellHitResult(Unit* pVictim, SpellEntry const* spell, bool CanReflect)
|
||||||
{
|
{
|
||||||
|
SpellSchoolMask schoolMask = GetSpellSchoolMask(spell);
|
||||||
|
|
||||||
|
// wand case
|
||||||
|
bool wand = spell->Id == 5019;
|
||||||
|
if (wand && !!(getClassMask() & CLASSMASK_WAND_USERS) && GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
|
schoolMask = GetSchoolMask(GetWeaponDamageSchool(RANGED_ATTACK));
|
||||||
|
}
|
||||||
|
|
||||||
// Return evade for units in evade mode
|
// Return evade for units in evade mode
|
||||||
if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||||
{
|
{
|
||||||
@ -3114,7 +3123,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* pVictim, SpellEntry const* spell, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for immune
|
// Check for immune
|
||||||
if (pVictim->IsImmuneToSpell(spell, this == pVictim) && !spell->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
if (!wand && pVictim->IsImmuneToSpell(spell, this == pVictim) && !spell->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
||||||
{
|
{
|
||||||
return SPELL_MISS_IMMUNE;
|
return SPELL_MISS_IMMUNE;
|
||||||
}
|
}
|
||||||
@ -3127,7 +3136,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* pVictim, SpellEntry const* spell, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for immune (use charges)
|
// Check for immune (use charges)
|
||||||
if (pVictim->IsImmuneToDamage(GetSpellSchoolMask(spell)) && !spell->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
if (pVictim->IsImmuneToDamage(schoolMask) && !spell->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
||||||
{
|
{
|
||||||
return SPELL_MISS_IMMUNE;
|
return SPELL_MISS_IMMUNE;
|
||||||
}
|
}
|
||||||
@ -3138,7 +3147,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* pVictim, SpellEntry const* spell, bool
|
|||||||
int32 reflectchance = pVictim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
|
int32 reflectchance = pVictim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
|
||||||
Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
|
Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
|
||||||
for (Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
|
for (Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
|
||||||
if ((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spell))
|
if ((*i)->GetModifier()->m_miscvalue & schoolMask)
|
||||||
{
|
{
|
||||||
reflectchance += (*i)->GetModifier()->m_amount;
|
reflectchance += (*i)->GetModifier()->m_amount;
|
||||||
}
|
}
|
||||||
|
@ -3453,6 +3453,10 @@ class Unit : public WorldObject
|
|||||||
float GetWeaponDamageRange(WeaponAttackType attType , WeaponDamageRange type) const;
|
float GetWeaponDamageRange(WeaponAttackType attType , WeaponDamageRange type) const;
|
||||||
void SetBaseWeaponDamage(WeaponAttackType attType , WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; }
|
void SetBaseWeaponDamage(WeaponAttackType attType , WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; }
|
||||||
|
|
||||||
|
SpellSchools GetWeaponDamageSchool(WeaponAttackType attType, uint8 index = 0) const { return m_weaponDamageInfo.weapon[attType].damage[index].school; }
|
||||||
|
void SetWeaponDamageSchool(WeaponAttackType attType, SpellSchools school, uint8 index = 0) { m_weaponDamageInfo.weapon[attType].damage[index].school = school; }
|
||||||
|
|
||||||
|
|
||||||
// Visibility system
|
// Visibility system
|
||||||
UnitVisibility GetVisibility() const { return m_Visibility; }
|
UnitVisibility GetVisibility() const { return m_Visibility; }
|
||||||
void SetVisibility(UnitVisibility x);
|
void SetVisibility(UnitVisibility x);
|
||||||
@ -3701,6 +3705,23 @@ class Unit : public WorldObject
|
|||||||
virtual bool CanFly() const = 0;
|
virtual bool CanFly() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
struct WeaponDamageInfo
|
||||||
|
{
|
||||||
|
struct Weapon
|
||||||
|
{
|
||||||
|
struct Damage
|
||||||
|
{
|
||||||
|
SpellSchools school = SPELL_SCHOOL_NORMAL;
|
||||||
|
float value[2] = { BASE_MINDAMAGE, BASE_MAXDAMAGE };
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32 lines = 1;
|
||||||
|
Damage damage[MAX_ITEM_PROTO_DAMAGES];
|
||||||
|
};
|
||||||
|
|
||||||
|
Weapon weapon[MAX_ATTACK];
|
||||||
|
};
|
||||||
|
|
||||||
explicit Unit();
|
explicit Unit();
|
||||||
|
|
||||||
void _UpdateSpells(uint32 time);
|
void _UpdateSpells(uint32 time);
|
||||||
@ -3736,6 +3757,8 @@ class Unit : public WorldObject
|
|||||||
AuraList m_modAuras[TOTAL_AURAS];
|
AuraList m_modAuras[TOTAL_AURAS];
|
||||||
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END];
|
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END];
|
||||||
float m_weaponDamage[MAX_ATTACK][2];
|
float m_weaponDamage[MAX_ATTACK][2];
|
||||||
|
WeaponDamageInfo m_weaponDamageInfo;
|
||||||
|
|
||||||
bool m_canModifyStats;
|
bool m_canModifyStats;
|
||||||
// std::list< spellEffectPair > AuraSpells[TOTAL_AURAS]; // TODO: use this if ok for mem
|
// std::list< spellEffectPair > AuraSpells[TOTAL_AURAS]; // TODO: use this if ok for mem
|
||||||
|
|
||||||
@ -3756,6 +3779,7 @@ class Unit : public WorldObject
|
|||||||
bool m_isSpawningLinked;
|
bool m_isSpawningLinked;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void CleanupDeletedAuras();
|
void CleanupDeletedAuras();
|
||||||
void UpdateSplineMovement(uint32 t_diff);
|
void UpdateSplineMovement(uint32 t_diff);
|
||||||
|
|
||||||
|
@ -333,16 +333,13 @@ Spell::Spell(Unit* caster, SpellEntry const* info, bool triggered, ObjectGuid or
|
|||||||
|
|
||||||
m_spellSchoolMask = GetSpellSchoolMask(info); // Can be override for some spell (wand shoot for example)
|
m_spellSchoolMask = GetSpellSchoolMask(info); // Can be override for some spell (wand shoot for example)
|
||||||
|
|
||||||
|
// wand case
|
||||||
if (m_attackType == RANGED_ATTACK)
|
if (m_attackType == RANGED_ATTACK)
|
||||||
{
|
{
|
||||||
// wand case
|
if (!(m_caster->getClassMask() & CLASSMASK_WAND_USERS) && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
|
m_spellSchoolMask = GetSchoolMask(m_caster->GetWeaponDamageSchool(RANGED_ATTACK));
|
||||||
{
|
|
||||||
if (Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK))
|
|
||||||
{
|
|
||||||
m_spellSchoolMask = GetSchoolMask(pItem->GetProto()->Damage[0].DamageType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Set health leech amount to zero
|
// Set health leech amount to zero
|
||||||
m_healthLeech = 0;
|
m_healthLeech = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user