diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Spell.cpp | 39 | ||||
| -rw-r--r-- | src/game/SpellAuras.cpp | 6 | ||||
| -rw-r--r-- | src/game/SpellEffects.cpp | 2 | ||||
| -rw-r--r-- | src/game/SpellMgr.cpp | 128 | ||||
| -rw-r--r-- | src/game/SpellMgr.h | 31 | ||||
| -rw-r--r-- | src/game/World.cpp | 2 | 
6 files changed, 99 insertions, 109 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 770d0fd8bff..37b1139077f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1046,8 +1046,9 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)                  // Get multiplier                  float multiplier = m_spellInfo->DmgMultiplier[effectNumber];                  // Apply multiplier mods -                if(Player* modOwner = m_originalCaster->GetSpellModOwner()) -                    modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier,this); +                if(m_originalCaster) +                    if(Player* modOwner = m_originalCaster->GetSpellModOwner()) +                        modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier,this);                  m_damageMultipliers[effectNumber] *= multiplier;              }          } @@ -1069,6 +1070,15 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)                  unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());          }      } + +    if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) && m_originalCaster) +    { +        uint32 flag = spellmgr.GetSpellCustomAttr(m_spellInfo->Id); +        if(flag & SPELL_ATTR_CU_EFFECT_HEAL) +            m_originalCaster->ProcDamageAndSpell(unit, PROC_FLAG_HEAL, PROC_FLAG_NONE, 0, GetSpellSchoolMask(m_spellInfo), m_spellInfo); +        if(m_originalCaster != unit && (flag & SPELL_ATTR_CU_EFFECT_DAMAGE))  +            m_originalCaster->ProcDamageAndSpell(unit, PROC_FLAG_HIT_SPELL, PROC_FLAG_STRUCK_SPELL, 0, GetSpellSchoolMask(m_spellInfo), m_spellInfo); +    }  }  void Spell::DoAllEffectOnTarget(GOTargetInfo *target) @@ -1282,7 +1292,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const u          TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);          cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));      } -    if(!spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_MAX_TARGETS)) +    if(!(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_PLAYERS_ONLY))      {          TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer >  grid_object_notifier(notifier);          cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1342,8 +1352,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)      uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i];      uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets; -    if(!unMaxTargets) -        unMaxTargets = spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_MAX_TARGETS); +      if(m_originalCaster)      {          if(Player* modOwner = m_originalCaster->GetSpellModOwner()) @@ -1503,19 +1512,13 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)          }break;          case TARGET_IN_FRONT_OF_CASTER:          case TARGET_UNIT_CONE_ENEMY_UNKNOWN: -            switch(spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_CONE_TYPE)) -            { -                default: -                case 0: -                    SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_AOE_DAMAGE); -                    break; -                case 1: -                    SearchAreaTarget(TagUnitMap, radius, PUSH_IN_BACK, SPELL_TARGETS_AOE_DAMAGE); -                    break; -                case 2: -                    SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE); -                    break; -            }break; +            if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_CONE_BACK) +                SearchAreaTarget(TagUnitMap, radius, PUSH_IN_BACK, SPELL_TARGETS_AOE_DAMAGE); +            else if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_CONE_LINE) +                SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE); +            else +                SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_AOE_DAMAGE); +            break;          case TARGET_UNIT_CONE_ALLY:              SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY);              break; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 1d7df27a76f..8a2eb28ceed 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5623,7 +5623,7 @@ void Aura::PeriodicTick()              // DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura) -            pCaster->ProcDamageAndSpell(target, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), GetSpellSchoolMask(spellProto), spellProto); +            pCaster->ProcDamageAndSpell(target, PROC_FLAG_NONE, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), GetSpellSchoolMask(spellProto), spellProto);              break;          }          case SPELL_AURA_PERIODIC_LEECH: @@ -5736,7 +5736,7 @@ void Aura::PeriodicTick()              // DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura) -            pCaster->ProcDamageAndSpell(target, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, new_damage, GetSpellSchoolMask(spellProto), spellProto); +            pCaster->ProcDamageAndSpell(target, PROC_FLAG_HEALED, PROC_FLAG_TAKE_DAMAGE, new_damage, GetSpellSchoolMask(spellProto), spellProto);              if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false))              {                  for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) @@ -5839,7 +5839,7 @@ void Aura::PeriodicTick()              // ignore item heals              if(procSpell && !haveCastItem) -                pCaster->ProcDamageAndSpell(target,PROC_FLAG_HEAL, PROC_FLAG_HEALED, pdamage, SPELL_SCHOOL_MASK_NONE, spellProto); +                pCaster->ProcDamageAndSpell(target,PROC_FLAG_NONE, PROC_FLAG_HEALED, pdamage, SPELL_SCHOOL_MASK_NONE, spellProto);              break;          }          case SPELL_AURA_PERIODIC_MANA_LEECH: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 01fcbd87d45..2a3823118cb 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -311,7 +311,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)                  }                  // Meteor like spells (divided damage to targets) -                if(spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_SHARE_DAMAGE)) +                if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_SHARE_DAMAGE)                  {                      uint32 count = 0;                      for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index ec67d55e645..ae09d9e0650 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1969,82 +1969,74 @@ void SpellMgr::LoadSpellPetAuras()  }  // set data in core for now -void SpellMgr::LoadSpellExtraAttr() +void SpellMgr::LoadSpellCustomAttr()  { -    SpellExtraAttribute tempAttr; -    tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 0; -    tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 0; -    tempAttr.attr[SPELL_EXTRA_ATTR_SHARE_DAMAGE] = 0; - -    tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 1; -    { -        SpellEntry const* tempSpell; -        for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) -        { -            tempSpell = GetSpellStore()->LookupEntry(i); -            if(tempSpell && tempSpell->SpellVisual == 3879) -                mSpellExtraAttrMap[tempSpell->Id] = tempAttr; -        } -    } -    tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 2; -    mSpellExtraAttrMap[26029] = tempAttr; // dark glare -    mSpellExtraAttrMap[37433] = tempAttr; // spout -    mSpellExtraAttrMap[43140] = tempAttr; // flame breath -    mSpellExtraAttrMap[43215] = tempAttr; // flame breath -    tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 0; - -    tempAttr.attr[SPELL_EXTRA_ATTR_SHARE_DAMAGE] = 1; -    for(uint32 i = 0; i < 46000; ++i) +    SpellEntry *tempSpell; +    for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)      { -        switch(i) +        tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(i); +        if(!tempSpell) +            continue; + +        mSpellCustomAttrMap[tempSpell->Id] = 0; + +        for(uint32 i = 0; i < 3; ++i)          { -            case 24340: case 26558: case 28884:     // Meteor -            case 36837: case 38903: case 41276:     // Meteor -            case 26789:                             // Shard of the Fallen Star -            case 31436:                             // Malevolent Cleave -            case 35181:                             // Dive Bomb -            case 40810: case 43267: case 43268:     // Saber Lash -            case 42384:                             // Brutal Swipe -            case 45150:                             // Meteor Slash -                mSpellExtraAttrMap[i] = tempAttr; -                break; -            default: -                break; +            switch(tempSpell->EffectApplyAuraName[i]) +            { +                case SPELL_AURA_PERIODIC_DAMAGE: +                case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: +                case SPELL_AURA_PERIODIC_LEECH: +                    mSpellCustomAttrMap[tempSpell->Id] |= SPELL_ATTR_CU_EFFECT_DAMAGE; +                    break; +                case SPELL_AURA_PERIODIC_HEAL: +                case SPELL_AURA_OBS_MOD_HEALTH: +                    mSpellCustomAttrMap[tempSpell->Id] |= SPELL_ATTR_CU_EFFECT_HEAL; +                    break; +                default: +                    break; +            }          } -    } -    tempAttr.attr[SPELL_EXTRA_ATTR_SHARE_DAMAGE] = 0; -    tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 1; -    for(uint32 i = 0; i < 46000; ++i) -    { -        switch(i) +        if(tempSpell->SpellVisual == 3879) +            mSpellCustomAttrMap[tempSpell->Id] |= SPELL_ATTR_CU_CONE_BACK; + +        switch(tempSpell->Id)          { -            case 44978: case 45001: case 45002:     // Wild Magic -            case 45004: case 45006: case 45010:     // Wild Magic -            case 31347: // Doom -            case 41635: // Prayer of Mending -                mSpellExtraAttrMap[i] = tempAttr; -                break; -            default: -                break; +        case 26029: // dark glare +        case 37433: // spout +        case 43140: case 43215: // flame breath +            mSpellCustomAttrMap[tempSpell->Id] |= SPELL_ATTR_CU_CONE_LINE; +            break; +        case 24340: case 26558: case 28884:     // Meteor +        case 36837: case 38903: case 41276:     // Meteor +        case 26789:                             // Shard of the Fallen Star +        case 31436:                             // Malevolent Cleave +        case 35181:                             // Dive Bomb +        case 40810: case 43267: case 43268:     // Saber Lash +        case 42384:                             // Brutal Swipe +        case 45150:                             // Meteor Slash +            mSpellCustomAttrMap[tempSpell->Id] |= SPELL_ATTR_CU_SHARE_DAMAGE; +            break; +        case 44978: case 45001: case 45002:     // Wild Magic +        case 45004: case 45006: case 45010:     // Wild Magic +        case 31347: // Doom +        case 41635: // Prayer of Mending +            mSpellCustomAttrMap[tempSpell->Id] |= SPELL_ATTR_CU_PLAYERS_ONLY; +            tempSpell->MaxAffectedTargets = 1; +            break; +        case 41376: // Spite +        case 39992: // Needle Spine +            mSpellCustomAttrMap[tempSpell->Id] |= SPELL_ATTR_CU_PLAYERS_ONLY; +            tempSpell->MaxAffectedTargets = 3; +            break; +        case 8122: case 8124: case 10888: case 10890: // Psychic Scream +            tempSpell->Attributes |= SPELL_ATTR_BREAKABLE_BY_DAMAGE; +            break; +        default: +            break;          }      } -    tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 3; -    mSpellExtraAttrMap[41376] = tempAttr;   //Spite -    mSpellExtraAttrMap[39992] = tempAttr;   //Needle Spine -    tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 0; - -    //hack here, only for those strange exceptions! -    // Psychic Scream -    SpellEntry *tempSpell; -    if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(8122)) -        tempSpell->Attributes |= SPELL_ATTR_BREAKABLE_BY_DAMAGE; -    if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(8124)) -        tempSpell->Attributes |= SPELL_ATTR_BREAKABLE_BY_DAMAGE; -    if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(10888)) -        tempSpell->Attributes |= SPELL_ATTR_BREAKABLE_BY_DAMAGE; -    if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(10890)) -        tempSpell->Attributes |= SPELL_ATTR_BREAKABLE_BY_DAMAGE;  }  void SpellMgr::LoadSpellLinked() diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 4006fff3b59..1a13b73194b 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -634,19 +634,14 @@ inline bool IsProfessionSkill(uint32 skill)      return  IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID;  } -enum SpellExtraAttributeType -{ -    SPELL_EXTRA_ATTR_MAX_TARGETS, -    SPELL_EXTRA_ATTR_CONE_TYPE, -    SPELL_EXTRA_ATTR_SHARE_DAMAGE -}; - -struct SpellExtraAttribute -{ -    uint32 attr[3]; -}; +#define SPELL_ATTR_CU_PLAYERS_ONLY      0x00000001 +#define SPELL_ATTR_CU_CONE_BACK         0x00000002 +#define SPELL_ATTR_CU_CONE_LINE         0x00000004 +#define SPELL_ATTR_CU_SHARE_DAMAGE      0x00000008 +#define SPELL_ATTR_CU_EFFECT_HEAL       0x00000010 +#define SPELL_ATTR_CU_EFFECT_DAMAGE     0x00000020 -typedef std::map<uint32, SpellExtraAttribute> SpellExtraAttrMap; +typedef std::map<uint32, uint32> SpellCustomAttrMap;  typedef std::map<int32, std::vector<int32> > SpellLinkedMap; @@ -848,11 +843,11 @@ class SpellMgr                  return NULL;          } -        uint32 GetSpellExtraAttr(uint32 spell_id, uint32 type) const +        uint32 GetSpellCustomAttr(uint32 spell_id) const          { -            SpellExtraAttrMap::const_iterator itr = mSpellExtraAttrMap.find(spell_id); -            if(itr != mSpellExtraAttrMap.end()) -                return itr->second.attr[type]; +            SpellCustomAttrMap::const_iterator itr = mSpellCustomAttrMap.find(spell_id); +            if(itr != mSpellCustomAttrMap.end()) +                return itr->second;              else                  return 0;          } @@ -879,7 +874,7 @@ class SpellMgr          void LoadSpellThreats();          void LoadSkillLineAbilityMap();          void LoadSpellPetAuras(); -        void LoadSpellExtraAttr(); +        void LoadSpellCustomAttr();          void LoadSpellLinked();      private: @@ -894,7 +889,7 @@ class SpellMgr          SpellProcEventMap  mSpellProcEventMap;          SkillLineAbilityMap mSkillLineAbilityMap;          SpellPetAuraMap     mSpellPetAuraMap; -        SpellExtraAttrMap   mSpellExtraAttrMap; +        SpellCustomAttrMap  mSpellCustomAttrMap;          SpellLinkedMap      mSpellLinkedMap;  }; diff --git a/src/game/World.cpp b/src/game/World.cpp index 6e1de2d8567..ad99e676ee7 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1095,7 +1095,7 @@ void World::SetInitialWorldSettings()      spellmgr.LoadSpellPetAuras();      sLog.outString( "Loading spell extra attributes...(TODO)" ); -    spellmgr.LoadSpellExtraAttr(); +    spellmgr.LoadSpellCustomAttr();      sLog.outString( "Loading linked spells..." );      spellmgr.LoadSpellLinked();  | 
