From d65458b0de821e2d22923581af7b9dca2c2ec554 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 5 Jan 2009 01:44:27 +0300 Subject: [PATCH] [7025] Restore work/add new spell post effects Signed-off-by: DiSlord --- src/game/Spell.cpp | 72 +++++++++++++++++++++++++++++++++++++-- src/game/SpellEffects.cpp | 19 ----------- src/game/Unit.cpp | 4 +-- src/shared/revision_nr.h | 2 +- 4 files changed, 73 insertions(+), 24 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e164eee93..afdaf7bfb 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2670,6 +2670,68 @@ void Spell::finish(bool ok) ((Player*)m_caster)->ClearComboPoints(); } + // Post effects apply on spell targets in some spells + if(!m_UniqueTargetInfo.empty()) + { + uint32 spellId = 0; + switch(m_spellInfo->SpellFamilyName) + { + case SPELLFAMILY_GENERIC: + { + if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages + spellId = 11196; // Recently Bandaged + else if(m_spellInfo->SpellIconID == 1662 && m_spellInfo->AttributesEx & 0x20) // Blood Fury (Racial) + spellId = 23230; // Blood Fury - Healing Reduction + break; + } + case SPELLFAMILY_MAGE: + { + if (m_spellInfo->SpellFamilyFlags&0x0000008000000000LL) // Ice Block + spellId = 41425; // Hypothermia + break; + } + case SPELLFAMILY_PRIEST: + { + if (m_spellInfo->Mechanic == MECHANIC_SHIELD && + m_spellInfo->SpellIconID == 566) // Power Word: Shield + spellId = 6788; // Weakened Soul + break; + } + case SPELLFAMILY_PALADIN: + { + if (m_spellInfo->SpellFamilyFlags&0x0000000000400080LL) // Divine Shield, Divine Protection or Hand of Protection + spellId = 25771; // Forbearance + break; + } + case SPELLFAMILY_SHAMAN: + { + if (m_spellInfo->Id == 2825) // Bloodlust + spellId = 57724; // Sated + else if (m_spellInfo->Id == 32182) // Heroism + spellId = 57723; // Exhaustion + break; + } + default: + break; + } + if (spellId) + { + for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + { + Unit* unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + if (unit) + { +// TODO: fix me use cast spell (now post spell can immune by this spell) +// m_caster->CastSpell(unit, spellId, true, m_CastItem); + SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(spellId); + if (!AdditionalSpellInfo) + continue; + Aura* AdditionalAura = CreateAura(AdditionalSpellInfo, 0, &m_currentBasePoints[0], unit, m_caster, m_CastItem); + unit->AddAura(AdditionalAura); + } + } + } + } // call triggered spell only at successful cast (after clear combo points -> for add some if need) if(!m_TriggerSpells.empty()) TriggerSpell(); @@ -3817,7 +3879,7 @@ uint8 Spell::CanCast(bool strict) } } - if(!m_triggeredByAuraSpell) + if(!m_IsTriggeredSpell) if(uint8 castResult = CheckRange(strict)) return castResult; @@ -3826,7 +3888,7 @@ uint8 Spell::CanCast(bool strict) return castResult; } - if(!m_triggeredByAuraSpell) // triggered spell not affected by stun/etc + if(!m_IsTriggeredSpell) // triggered spell not affected by stun/etc if(uint8 castResult = CheckCasterAuras()) return castResult; @@ -5248,6 +5310,12 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) return false; } + // Check Aura spell req (need for AoE spells) + if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell)) + return false; + if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell)) + return false; + // Check targets for not_selectable unit flag and remove // A player can cast spells on his pet (or other controlled unit) though in any state if (target != m_caster && target->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index d05099fec..3afc739a9 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2195,25 +2195,6 @@ void Spell::EffectApplyAura(uint32 i) if(!Aur) return; - // TODO Make a way so it works for every related spell! - if(unitTarget->GetTypeId()==TYPEID_PLAYER) // Negative buff should only be applied on players - { - uint32 spellId = 0; - if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages - spellId = 11196; // Recently Bandaged - else if( (m_spellInfo->AttributesEx & 0x20) && (m_spellInfo->AttributesEx2 & 0x20000) ) - spellId = 23230; // Blood Fury - Healing Reduction - - SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(spellId); - if (AdditionalSpellInfo) - { - // applied at target by target - Aura* AdditionalAura = CreateAura(AdditionalSpellInfo, 0, &m_currentBasePoints[0], unitTarget,unitTarget, 0); - unitTarget->AddAura(AdditionalAura); - sLog.outDebug("Spell: Additional Aura is: %u", AdditionalSpellInfo->EffectApplyAuraName[0]); - } - } - // Prayer of Mending (jump animation), we need formal caster instead original for correct animation if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags & 0x00002000000000LL)) m_caster->CastSpell(unitTarget, 41637, true, NULL, Aur, m_originalCasterGUID); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d14ce7dd5..e48bead91 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2390,7 +2390,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool if (pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) return SPELL_MISS_EVADE; - // Check for immune (use charges) + // Check for immune if (pVictim->IsImmunedToSpell(spell)) return SPELL_MISS_IMMUNE; @@ -2399,7 +2399,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool if (IsPositiveSpell(spell->Id)) return SPELL_MISS_NONE; - // Check for immune (use charges) + // Check for immune if (pVictim->IsImmunedToDamage(GetSpellSchoolMask(spell))) return SPELL_MISS_IMMUNE; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d1b84f35e..8997fd5a2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7024" + #define REVISION_NR "7025" #endif // __REVISION_NR_H__