From a38297f28f8a8341967fa8fe5b0919b6d6aa04fc Mon Sep 17 00:00:00 2001 From: QAston Date: Fri, 6 Feb 2009 23:01:07 +0100 Subject: *Handle aura SPELL_AURA_MECHANIC_IMMUNITY_MASK. *Fix a typo in ap bonus from stat calculation-thanks to megamage for pointing this. --HG-- branch : trunk --- .../serpent_shrine/boss_leotheras_the_blind.cpp | 4 ++-- src/game/SpellAuraDefines.h | 2 +- src/game/SpellAuras.cpp | 13 ++++++++----- src/game/StatSystem.cpp | 21 +++++++++++++++++---- src/game/Unit.cpp | 6 ++++-- 5 files changed, 32 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index e4e0e12a0cd..adb892e6624 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -277,7 +277,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI m_creature->RemoveAurasDueToSpell(AURA_BANISH); // Leotheras is getting immune again - m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); + m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, 1<SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); @@ -298,7 +298,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI { // channelers != 0 apply banish aura // removing Leotheras banish immune to apply AURA_BANISH - m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); + m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, 1<GetTypeId()==TYPEID_PLAYER) - m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply); + m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,1<HasAura(42016,0) && m_target->GetMountID()) @@ -3658,8 +3658,11 @@ void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) void Aura::HandleModMechanicImmunity(bool apply, bool Real) { - uint32 mechanic = 1 << m_modifier.m_miscvalue; - + uint32 mechanic; + if (GetSpellProto()->EffectApplyAuraName[GetEffIndex()]==SPELL_AURA_MECHANIC_IMMUNITY) + mechanic = 1 << m_modifier.m_miscvalue; + else //SPELL_AURA_MECHANIC_IMMUNITY_MASK + mechanic = m_modifier.m_miscvalue; //immune movement impairment and loss of control if(GetId()==42292) mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; @@ -3688,7 +3691,7 @@ void Aura::HandleModMechanicImmunity(bool apply, bool Real) } } - m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,m_modifier.m_miscvalue,apply); + m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,mechanic,apply); // Bestial Wrath if ( GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->Id == 19574) diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index df0e677f0c2..3a98e215da7 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -72,12 +72,25 @@ bool Player::UpdateStats(Stats stat) break; } - - // Need update (exist AP from stat auras) - if (HasAuraTypeWithMiscvalue(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, stat)) + if (stat == STAT_STRENGTH) + { + UpdateAttackPowerAndDamage(false); + if (HasAuraTypeWithMiscvalue(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, stat)) + UpdateAttackPowerAndDamage(true); + } + else if (stat == STAT_AGILITY) + { UpdateAttackPowerAndDamage(false); - if (HasAuraTypeWithMiscvalue(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, stat)) UpdateAttackPowerAndDamage(true); + } + else + { + // Need update (exist AP from stat auras) + if (HasAuraTypeWithMiscvalue(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, stat)) + UpdateAttackPowerAndDamage(false); + if (HasAuraTypeWithMiscvalue(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, stat)) + UpdateAttackPowerAndDamage(true); + } UpdateSpellDamageAndHealingBonus(); UpdateManaRegen(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9d50436d6be..98f66f09711 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8783,7 +8783,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo) SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) { - if(itr->type == spellInfo->Mechanic) + if(itr->type & (1<Mechanic)) { return true; } @@ -8803,6 +8803,8 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo) bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const { + if (!spellInfo) + return false; //If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effect[index]; SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT]; @@ -8814,7 +8816,7 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) - if(itr->type == mechanic) + if(itr->type & 1<<(spellInfo->EffectMechanic[index])) return true; } -- cgit v1.2.3