diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 30 | ||||
-rw-r--r-- | src/game/Spell.h | 9 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 29 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 64 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 25 | ||||
-rw-r--r-- | src/game/Unit.cpp | 9 | ||||
-rw-r--r-- | src/game/Unit.h | 1 | ||||
-rw-r--r-- | src/game/World.cpp | 3 |
8 files changed, 146 insertions, 24 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 716cc7a518e..66bcd898cbf 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1226,8 +1226,11 @@ 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)); } - TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + if(!spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_MAX_TARGETS)) + { + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + } } Unit* Spell::SearchNearbyTarget(float radius, SpellTargets TargetType, uint32 entry) @@ -1351,6 +1354,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; case TARGET_ALL_AROUND_CASTER: { + if(!unMaxTargets) + unMaxTargets = spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_MAX_TARGETS); m_caster->GetPosition(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ); }break; case TARGET_CURRENT_ENEMY_COORDINATES: @@ -1413,10 +1418,27 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) } }break; case TARGET_IN_FRONT_OF_CASTER: + case TARGET_UNIT_CONE_ENEMY_UNKNOWN: { - bool inFront = m_spellInfo->SpellVisual != 3879; - SearchAreaTarget(TagUnitMap, radius, inFront ? PUSH_IN_FRONT : PUSH_IN_BACK,SPELL_TARGETS_AOE_DAMAGE); + switch(spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_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; + case TARGET_UNIT_CONE_ALLY: + { + SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY); + }break; + // nearby target case TARGET_UNIT_NEARBY_ALLY: diff --git a/src/game/Spell.h b/src/game/Spell.h index e66a5af0876..a4ce3580437 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -73,6 +73,7 @@ enum SpellNotifyPushType { PUSH_IN_FRONT, PUSH_IN_BACK, + PUSH_IN_LINE, PUSH_SELF_CENTER, PUSH_DEST_CENTER, }; @@ -602,11 +603,15 @@ namespace Trinity switch(i_push_type) { case PUSH_IN_FRONT: - if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 )) + if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/3 )) i_data->push_back(itr->getSource()); break; case PUSH_IN_BACK: - if(i_spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 )) + if(i_spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, M_PI/3 )) + i_data->push_back(itr->getSource()); + break; + case PUSH_IN_LINE: + if(i_spell.GetCaster()->isInLine((Unit*)(itr->getSource()), i_radius )) i_data->push_back(itr->getSource()); break; case PUSH_SELF_CENTER: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index ed27c42eeee..7af5316c693 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -311,26 +311,19 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) damage+= rand()%2 ? damage : 0; } - switch(m_spellInfo->Id) // better way to check unknown + // Meteor like spells (divided damage to targets) + if(spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_SHARE_DAMAGE)) { - // Meteor like spells (divided damage to targets) - 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 - { - uint32 count = 0; - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) - if(ihit->effectMask & (1<<effect_idx)) - ++count; + uint32 count = 0; + for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + if(ihit->effectMask & (1<<effect_idx)) + ++count; - damage /= count; // divide to all targets - break; - } + damage /= count; // divide to all targets + } + + switch(m_spellInfo->Id) // better way to check unknown + { // percent from health with min case 25599: // Thundercrash { diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index efb83aa0fe2..b0db27a0b16 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1968,6 +1968,70 @@ void SpellMgr::LoadSpellPetAuras() sLog.outString( ">> Loaded %u spell pet auras", count ); } +// set data in core for now +void SpellMgr::LoadSpellExtraInfo() +{ + SpellExtraInfo info; + info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 0; + info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 0; + info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 0; + + info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 1; + SpellEntry const* tempSpell; + for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) + { + tempSpell = GetSpellStore()->LookupEntry(i); + if(tempSpell && tempSpell->SpellVisual == 3879) + mSpellExtraInfoMap[tempSpell->Id] = info; + } + info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 2; + mSpellExtraInfoMap[26029] = info; // dark glare + mSpellExtraInfoMap[37433] = info; // spout + mSpellExtraInfoMap[43140] = info; // flame breath + mSpellExtraInfoMap[43215] = info; // flame breath + info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 0; + + info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 1; + for(uint32 i = 0; i < 46000; ++i) + { + switch(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 + mSpellExtraInfoMap[i] = info; + break; + default: + break; + } + } + info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 0; + + info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 1; + for(uint32 i = 0; i < 46000; ++i) + { + switch(i) + { + case 44978: case 45001: case 45002: // Wild Magic + case 45004: case 45006: case 45010: // Wild Magic + case 31347: // Doom + case 41635: // Prayer of Mending + mSpellExtraInfoMap[i] = info; + break; + default: + break; + } + } + info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 3; + mSpellExtraInfoMap[41376] = info; //Spite + info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 0; +} + /// Some checks for spells, to prevent adding depricated/broken spells for trainers, spell book, etc bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) { diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 051d47eb65d..e727e446072 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -634,6 +634,20 @@ inline bool IsProfessionSkill(uint32 skill) return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID; } +enum SpellExtraInfoType +{ + SPELL_EXTRA_INFO_MAX_TARGETS, + SPELL_EXTRA_INFO_CONE_TYPE, + SPELL_EXTRA_INFO_SHARE_DAMAGE +}; + +struct SpellExtraInfo +{ + uint32 info[3]; +}; + +typedef std::map<uint32, SpellExtraInfo> SpellExtraInfoMap; + class SpellMgr { // Constructors @@ -832,6 +846,15 @@ class SpellMgr return NULL; } + uint32 GetSpellExtraInfo(uint32 spell_id, uint32 type) const + { + SpellExtraInfoMap::const_iterator itr = mSpellExtraInfoMap.find(spell_id); + if(itr != mSpellExtraInfoMap.end()) + return itr->second.info[type]; + else + return 0; + } + // Modifiers public: static SpellMgr& Instance(); @@ -848,6 +871,7 @@ class SpellMgr void LoadSpellThreats(); void LoadSkillLineAbilityMap(); void LoadSpellPetAuras(); + void LoadSpellExtraInfo(); private: SpellScriptTarget mSpellScriptTarget; @@ -861,6 +885,7 @@ class SpellMgr SpellProcEventMap mSpellProcEventMap; SkillLineAbilityMap mSkillLineAbilityMap; SpellPetAuraMap mSpellPetAuraMap; + SpellExtraInfoMap mSpellExtraInfoMap; }; #define spellmgr SpellMgr::Instance() diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a601a51d4fb..3b39fdefaf5 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3448,6 +3448,15 @@ bool Unit::isInBack(Unit const* target, float distance, float arc) const return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); } +bool Unit::isInLine(Unit const* target, float distance) const +{ + if(!HasInArc(M_PI, target) || !IsWithinDistInMap(target, distance)) return false; + float width = (GetObjectSize() / 2 + target->GetObjectSize()) / 2; + float angle = GetAngle(target); + angle -= GetOrientation(); + return abs(sin(angle)) * distance < width; +} + bool Unit::isInAccessablePlaceFor(Creature const* c) const { if(IsInWater()) diff --git a/src/game/Unit.h b/src/game/Unit.h index a61eb03190d..32dc0ba6e04 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1095,6 +1095,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject bool isInFront(Unit const* target,float distance, float arc = M_PI) const; void SetInFront(Unit const* target); bool isInBack(Unit const* target, float distance, float arc = M_PI) const; + bool isInLine(Unit const* target, float distance) const; // Visibility system UnitVisibility GetVisibility() const { return m_Visibility; } diff --git a/src/game/World.cpp b/src/game/World.cpp index 1858f409d35..508573603e8 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1095,6 +1095,9 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading spell pet auras..." ); spellmgr.LoadSpellPetAuras(); + sLog.outString( "Loading spell extra infos...(TODO)" ); + spellmgr.LoadSpellExtraInfo(); + sLog.outString( "Loading player Create Info & Level Stats..." ); objmgr.LoadPlayerInfo(); |