diff options
| author | Matan Shukry <matanshukry@gmail.com> | 2021-02-05 22:29:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-05 21:29:00 +0100 |
| commit | 0cae71eac58bf37c6a2cbce2a60dd2aa1f7b4314 (patch) | |
| tree | 885af6f1e533b5f8f678575f0462b377cc7d3764 /src/server/game/Spells | |
| parent | b832ed2479c039958bce40c3c26294fc67acf744 (diff) | |
Core/Spells: Adding SpellTargetObjectTypes to spell target checker to early-eliminate alive units (#26028)
* Added object type into checker that is used by grid search to early eliminate alive units when looking for corpses
* Removed script 'spell_hun_pet_carrion_feeder'. Ability doesn't exist anymore
Diffstat (limited to 'src/server/game/Spells')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 39 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.h | 11 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellMgr.h | 4 |
3 files changed, 33 insertions, 21 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index fb494c2e233..19a7878f706 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1169,7 +1169,7 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge if (uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList)) { - Trinity::WorldObjectSpellConeTargetCheck check(DegToRad(m_spellInfo->ConeAngle), m_spellInfo->Width ? m_spellInfo->Width : m_caster->GetCombatReach(), radius, m_caster, m_spellInfo, selectionType, condList); + Trinity::WorldObjectSpellConeTargetCheck check(DegToRad(m_spellInfo->ConeAngle), m_spellInfo->Width ? m_spellInfo->Width : m_caster->GetCombatReach(), radius, m_caster, m_spellInfo, selectionType, condList, objectType); Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> searcher(m_caster, targets, check, containerTypeMask); SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> >(searcher, containerTypeMask, m_caster, m_caster, radius); @@ -1630,7 +1630,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge SpellEffectInfo const* effect = m_spellInfo->GetEffect(effIndex); std::list<WorldObject*> targets; - Trinity::WorldObjectSpellTrajTargetCheck check(dist2d, &srcPos, m_caster, m_spellInfo, targetType.GetCheckType(), effect->ImplicitTargetConditions); + Trinity::WorldObjectSpellTrajTargetCheck check(dist2d, &srcPos, m_caster, m_spellInfo, targetType.GetCheckType(), effect->ImplicitTargetConditions, TARGET_OBJECT_TYPE_NONE); Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellTrajTargetCheck> searcher(m_caster, targets, check, GRID_MAP_TYPE_MASK_ALL); SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellTrajTargetCheck> > (searcher, GRID_MAP_TYPE_MASK_ALL, m_caster, &srcPos, dist2d); if (targets.empty()) @@ -1856,7 +1856,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargetObjectTypes objec uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList); if (!containerTypeMask) return nullptr; - Trinity::WorldObjectSpellNearbyTargetCheck check(range, m_caster, m_spellInfo, selectionType, condList); + Trinity::WorldObjectSpellNearbyTargetCheck check(range, m_caster, m_spellInfo, selectionType, condList, objectType); Trinity::WorldObjectLastSearcher<Trinity::WorldObjectSpellNearbyTargetCheck> searcher(m_caster, target, check, containerTypeMask); SearchTargets<Trinity::WorldObjectLastSearcher<Trinity::WorldObjectSpellNearbyTargetCheck> > (searcher, containerTypeMask, m_caster, m_caster, range); return target; @@ -1867,7 +1867,7 @@ void Spell::SearchAreaTargets(std::list<WorldObject*>& targets, float range, Pos uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList); if (!containerTypeMask) return; - Trinity::WorldObjectSpellAreaTargetCheck check(range, position, m_caster, referer, m_spellInfo, selectionType, condList); + Trinity::WorldObjectSpellAreaTargetCheck check(range, position, m_caster, referer, m_spellInfo, selectionType, condList, objectType); Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(m_caster, targets, check, containerTypeMask); SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> > (searcher, containerTypeMask, m_caster, position, range); } @@ -7882,8 +7882,8 @@ namespace Trinity { WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo, - SpellTargetCheckTypes selectionType, ConditionContainer* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo), - _targetSelectionType(selectionType), _condList(condList) + SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType) : + _caster(caster), _referer(referer), _spellInfo(spellInfo), _targetSelectionType(selectionType), _condList(condList), _objectType(objectType) { if (condList) _condSrcInfo = new ConditionSourceInfo(nullptr, caster); @@ -7964,6 +7964,17 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) default: break; } + + switch (_objectType) + { + case TARGET_OBJECT_TYPE_CORPSE: + case TARGET_OBJECT_TYPE_CORPSE_ALLY: + case TARGET_OBJECT_TYPE_CORPSE_ENEMY: + if (unitTarget->IsAlive()) + return false; + default: + break; + } } if (!_condSrcInfo) return true; @@ -7972,8 +7983,8 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) } WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo, - SpellTargetCheckTypes selectionType, ConditionContainer* condList) - : WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList), _range(range), _position(caster) { } + SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType) + : WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList, objectType), _range(range), _position(caster) { } bool WorldObjectSpellNearbyTargetCheck::operator()(WorldObject* target) { @@ -7987,8 +7998,8 @@ bool WorldObjectSpellNearbyTargetCheck::operator()(WorldObject* target) } WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster, - Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList) - : WorldObjectSpellTargetCheck(caster, referer, spellInfo, selectionType, condList), _range(range), _position(position) { } + Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType) + : WorldObjectSpellTargetCheck(caster, referer, spellInfo, selectionType, condList, objectType), _range(range), _position(position) { } bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target) { @@ -8010,8 +8021,8 @@ bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target) } WorldObjectSpellConeTargetCheck::WorldObjectSpellConeTargetCheck(float coneAngle, float lineWidth, float range, Unit* caster, - SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList) - : WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList), _coneAngle(coneAngle), _lineWidth(lineWidth) { } + SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType) + : WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList, objectType), _coneAngle(coneAngle), _lineWidth(lineWidth) { } bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target) { @@ -8036,8 +8047,8 @@ bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target) return WorldObjectSpellAreaTargetCheck::operator ()(target); } -WorldObjectSpellTrajTargetCheck::WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList) - : WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList), _range(range), _position(position) { } +WorldObjectSpellTrajTargetCheck::WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType) + : WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList, objectType), _range(range), _position(position) { } bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target) { diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index e9f609639cb..0f67bb6915a 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -911,9 +911,10 @@ namespace Trinity SpellTargetCheckTypes _targetSelectionType; ConditionSourceInfo* _condSrcInfo; ConditionContainer* _condList; + SpellTargetObjectTypes _objectType; WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo, - SpellTargetCheckTypes selectionType, ConditionContainer* condList); + SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType); ~WorldObjectSpellTargetCheck(); bool operator()(WorldObject* target); }; @@ -923,7 +924,7 @@ namespace Trinity float _range; Position const* _position; WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo, - SpellTargetCheckTypes selectionType, ConditionContainer* condList); + SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType); bool operator()(WorldObject* target); }; @@ -932,7 +933,7 @@ namespace Trinity float _range; Position const* _position; WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster, - Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList); + Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType); bool operator()(WorldObject* target); }; @@ -941,7 +942,7 @@ namespace Trinity float _coneAngle; float _lineWidth; WorldObjectSpellConeTargetCheck(float coneAngle, float lineWidth, float range, Unit* caster, - SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList); + SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType); bool operator()(WorldObject* target); }; @@ -950,7 +951,7 @@ namespace Trinity float _range; Position const* _position; WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, - SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList); + SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList, SpellTargetObjectTypes objectType); bool operator()(WorldObject* target); }; } diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 151b1925ef3..d161f696bb9 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -589,12 +589,12 @@ bool IsWeaponSkill(uint32 skill); inline bool IsProfessionSkill(uint32 skill) { - return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING; + return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING; } inline bool IsProfessionOrRidingSkill(uint32 skill) { - return IsProfessionSkill(skill) || skill == SKILL_RIDING; + return IsProfessionSkill(skill) || skill == SKILL_RIDING; } bool IsPartOfSkillLine(uint32 skillId, uint32 spellId); |
