diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp | 4 | ||||
-rw-r--r-- | src/game/Spell.cpp | 2 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 102 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 4 | ||||
-rw-r--r-- | src/game/Unit.cpp | 122 |
6 files changed, 145 insertions, 90 deletions
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 81d85180cb4..27f396c6926 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 @@ -267,7 +267,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, 1<<MECHANIC_BANISH, true); + m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); // changing model to bloodelf m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); @@ -288,7 +288,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, 1<<MECHANIC_BANISH, false); + m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); DoCast(m_creature, AURA_BANISH); // changing model diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c5646311c2d..7c40049fd32 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4548,7 +4548,7 @@ SpellCastResult Spell::CheckCasterAuras() const dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); } //immune movement impairment and loss of control - if(m_spellInfo->Id==(uint32)42292) + if(m_spellInfo->Id==42292 || m_spellInfo->Id==59752) mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 063450b471a..85caa4a047d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -198,7 +198,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &AuraEffect::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes &AuraEffect::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS &AuraEffect::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE - &AuraEffect::HandleModMechanicImmunity, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK + &AuraEffect::HandleModStateImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK &AuraEffect::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS &AuraEffect::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK &AuraEffect::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT @@ -1138,29 +1138,28 @@ void Aura::_RemoveAura() // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases) ((Player*)caster)->SendCooldownEvent(GetSpellProto()); } - if (m_removeMode==AURA_REMOVE_BY_EXPIRE) + uint32 id = GetId(); + // Remove Linked Auras + if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE) { - // Remove Linked Auras (on last aura remove) - uint32 id = GetId(); - if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE) - { - if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)id)) - for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) - if(*itr < 0) - m_target->RemoveAurasDueToSpell(-(*itr)); - else if(Unit* caster = GetCaster()) + if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)id)) + for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) + if(*itr < 0) + m_target->RemoveAurasDueToSpell(-(*itr)); + else if(Unit* caster = GetCaster()) + if (m_removeMode==AURA_REMOVE_BY_EXPIRE) m_target->CastSpell(m_target, *itr, true, 0, 0, caster->GetGUID()); - } - if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA) - { - if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA)) - for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) - if(*itr < 0) - m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), false); - else - m_target->RemoveAurasDueToSpell(*itr); - } } + if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA) + { + if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA)) + for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) + if(*itr < 0) + m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), false); + else + m_target->RemoveAurasDueToSpell(*itr); + } + // Proc on aura remove (only spell flags for now) if (caster) { @@ -3988,7 +3987,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) //Players on flying mounts must be immune to polymorph if (m_target->GetTypeId()==TYPEID_PLAYER) - m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,1<<MECHANIC_POLYMORPH,apply); + m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply); // Dragonmaw Illusion (overwrite mount model, mounted aura already applied) if( apply && m_target->HasAuraEffect(42016,0) && m_target->GetMountID()) @@ -4033,16 +4032,57 @@ void AuraEffect::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) /*** IMMUNITY ***/ /*********************************************************/ +void AuraEffect::HandleModStateImmunityMask(bool apply, bool Real) +{ + std::list <AuraType> immunity_list; + if (GetMiscValue() & (1<<10)) + immunity_list.push_back(SPELL_AURA_MOD_STUN); + if (GetMiscValue() & (1<<7)) + immunity_list.push_back(SPELL_AURA_MOD_DISARM); + if (GetMiscValue() & (1<<1)) + immunity_list.push_back(SPELL_AURA_MOD_TAUNT); + + // These flag can be recognized wrong: + if (GetMiscValue() & (1<<6)) + immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + if (GetMiscValue() & (1<<0)) + immunity_list.push_back(SPELL_AURA_MOD_ROOT); + if (GetMiscValue() & (1<<3)) + immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + if (GetMiscValue() & (1<<9)) + immunity_list.push_back(SPELL_AURA_MOD_FEAR); + + // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated. + // however not all mechanic specified in immunity + if (apply && GetId()==46924) + { + m_target->RemoveAurasByType(SPELL_AURA_MOD_ROOT); + m_target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); + } + + if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) + { + for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end();) + { + m_target->RemoveAurasByType(*iter); + } + } + for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end();) + { + m_target->ApplySpellImmune(GetId(),IMMUNITY_STATE,*iter,apply); + } +} + void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real) { uint32 mechanic; - if (GetSpellProto()->EffectApplyAuraName[GetEffIndex()]==SPELL_AURA_MECHANIC_IMMUNITY) - mechanic = 1 << GetMiscValue(); - else //SPELL_AURA_MECHANIC_IMMUNITY_MASK - mechanic = GetMiscValue(); + mechanic = 1 << GetMiscValue(); + //immune movement impairment and loss of control if(GetId()==42292 || GetId()==59752) mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; + if (!mechanic) + return; if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { @@ -4066,15 +4106,7 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real) } } - // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated. - // however not all mechanic specified in immunity - if (apply && GetId()==46924) - { - m_target->RemoveAurasByType(SPELL_AURA_MOD_ROOT); - m_target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); - } - - m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,mechanic,apply); + m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,GetMiscValue(),apply); // Bestial Wrath if ( GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->Id == 19574) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 64a8d14079a..dcf429d85fd 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -267,6 +267,7 @@ class TRINITY_DLL_SPEC AuraEffect void HandleFarSight(bool Apply, bool Real); void HandleModPossessPet(bool Apply, bool Real); void HandleModMechanicImmunity(bool Apply, bool Real); + void HandleModStateImmunityMask(bool apply, bool Real); void HandleAuraModSkill(bool Apply, bool Real); void HandleModDamagePercentDone(bool Apply, bool Real); void HandleModPercentStat(bool Apply, bool Real); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index a2164374c8e..8a37f3757cd 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2546,7 +2546,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/) if (AuraEffect * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID)) { addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth *= 0.25f; + addhealth *= 1.25f; // consume aura unitTarget->RemoveAura(aurEff->GetParentAura()); } @@ -5836,7 +5836,7 @@ void Spell::EffectDispelMechanic(uint32 i) Unit::AuraMap& Auras = unitTarget->GetAuras(); for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); iter++) - if(GetAllSpellMechanicMask(iter->second->GetSpellProto()) & (1<<(mechanic-1))) + if(GetAllSpellMechanicMask(iter->second->GetSpellProto()) & (1<<(mechanic))) dispel_list.push(iter->second); for(;dispel_list.size();dispel_list.pop()) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index fbb61a1e1a5..0056866bcdd 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -181,8 +181,6 @@ Unit::~Unit() } } - _DeleteAuras(); - RemoveAllGameObjects(); RemoveAllDynObjects(); @@ -5138,7 +5136,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger for(AuraMap::iterator iter = Auras.begin(); iter != Auras.end();) { SpellEntry const *spell = iter->second->GetSpellProto(); - if( GetAllSpellMechanicMask(spell) & 1<<(MECHANIC_STUN-1)) + if( GetAllSpellMechanicMask(spell) & 1<<(MECHANIC_STUN)) { pVictim->RemoveAura(iter); } @@ -8935,6 +8933,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint // Check for table values SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id); float coeff; + bool scripted = false; if (bonus) { if (damagetype == DOT) @@ -8944,57 +8943,74 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint if (bonus->ap_bonus) DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack; } + else // scripted bonus + { + // Gift of the Naaru + if (spellProto->Id==59547) + { + scripted = true; + uint32 apBonus = GetTotalAttackPowerValue(BASE_ATTACK); + if (apBonus > DoneAdvertisedBenefit) + { + DoneTotal+=apBonus * stack; + coeff = 0.0f; + } + else + coeff = 1.0f; + } + } + // Default calculation if (DoneAdvertisedBenefit || TakenAdvertisedBenefit) { - if(!bonus) + if(!bonus && !scripted) { - // Damage Done from spell damage bonus - int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if(damagetype == DOT) - { - int32 DotDuration = GetSpellDuration(spellProto); - // 200% limit - if(DotDuration > 0) + // Damage Done from spell damage bonus + int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); + // Damage over Time spells bonus calculation + float DotFactor = 1.0f; + if(damagetype == DOT) { - if(DotDuration > 30000) DotDuration = 30000; - if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f; - int x = 0; - for(int j = 0; j < 3; j++) + int32 DotDuration = GetSpellDuration(spellProto); + // 200% limit + if(DotDuration > 0) { - if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) + if(DotDuration > 30000) DotDuration = 30000; + if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f; + int x = 0; + for(int j = 0; j < 3; j++) { - x = j; - break; + if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( + spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || + spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) + { + x = j; + break; + } + } + int32 DotTicks = 6; + if(spellProto->EffectAmplitude[x] != 0) + DotTicks = DotDuration / spellProto->EffectAmplitude[x]; + if(DotTicks) + { + DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks; + TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks; } - } - int32 DotTicks = 6; - if(spellProto->EffectAmplitude[x] != 0) - DotTicks = DotDuration / spellProto->EffectAmplitude[x]; - if(DotTicks) - { - DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks; - TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks; } } - } - // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for(int j = 0; j < 3; ++j) - { - if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH ) + // Distribute Damage over multiple effects, reduce by AoE + CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); + // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing + for(int j = 0; j < 3; ++j) { - CastingTime /= 2; - break; + if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || + spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH ) + { + CastingTime /= 2; + break; + } } - } - coeff = (CastingTime / 3500.0f) * DotFactor; + coeff = (CastingTime / 3500.0f) * DotFactor; } float coeff2 = CalculateLevelPenalty(spellProto) * 1.88f * stack; @@ -9146,12 +9162,15 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo) return true; } - SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; - for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) + if (spellInfo->Mechanic) { - if(itr->type & (1<<spellInfo->Mechanic)) + SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; + for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) { - return true; + if(itr->type == spellInfo->Mechanic) + { + return true; + } } } @@ -9182,7 +9201,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 & 1<<(spellInfo->EffectMechanic[index])) + if(itr->type == spellInfo->EffectMechanic[index]) return true; } @@ -11062,6 +11081,7 @@ void Unit::CleanupsBeforeDelete() //A unit may be in removelist and not in world, but it is still in grid //and may have some references during delete RemoveAllAuras(); + _DeleteAuras(); InterruptNonMeleeSpells(true); m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList CombatStop(); @@ -11503,6 +11523,8 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag bool useCharges= i->aura->GetAuraCharges()>0; bool takeCharges = false; + SpellEntry const *spellInfo = i->aura->GetSpellProto(); + uint32 Id=i->aura->GetId(); // For players set spell cooldown if need uint32 cooldown = 0; @@ -11517,8 +11539,6 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag AuraEffect *triggeredByAura = i->aura->GetPartAura(effIndex); assert(triggeredByAura); - SpellEntry const *spellInfo = triggeredByAura->GetSpellProto(); - switch(triggeredByAura->GetAuraName()) { case SPELL_AURA_PROC_TRIGGER_SPELL: @@ -13143,7 +13163,7 @@ void Unit::AddAura(uint32 spellId, Unit* target) for(uint32 i = 0; i < 3; ++i) { - if(spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA) + if(spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || IsAreaAuraEffect(spellInfo->Effect[i])) { if(target->IsImmunedToSpellEffect(spellInfo, i)) continue; @@ -13172,6 +13192,8 @@ Aura * Unit::AddAuraEffect(uint32 spellId, uint8 effIndex, Unit* caster) if (aur) { AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, NULL, caster); + if (!aurEffect) + return aur; if (!aur->SetPartAura(aurEffect, effIndex)) delete aurEffect; } |