Skip to content

Commit

Permalink
[c12936] Allow targets 60 and 110 to use script target whenever required
Browse files Browse the repository at this point in the history
Also implement target 110 as TARGET_NARROW_FRONTAL_CONE_2

(based on commit [12736] - ec52a3f)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
  • Loading branch information
xfurry committed Nov 23, 2014
1 parent 9edf061 commit d517e33
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/game/SharedDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ enum Targets
TARGET_107 = 107, // possible TARGET_WMO(GO?)_IN_FRONT_OF_CASTER(_30 ?) TODO: Verify the angle!
TARGET_GO_IN_FRONT_OF_CASTER_90 = 108,
TARGET_109 = 109, // spell 89008
TARGET_110 = 110, // front enemy aoe
TARGET_NARROW_FRONTAL_CONE_2 = 110,
TARGET_111 = 111, // not used
TARGET_112 = 112, // spell 89549
TARGET_113 = 113, // not used
Expand Down
53 changes: 51 additions & 2 deletions src/game/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2392,8 +2392,53 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
FillAreaTargets(targetUnitMap, radius, PUSH_IN_FRONT_30, SPELL_TARGETS_FRIENDLY);
break;
case TARGET_NARROW_FRONTAL_CONE:
FillAreaTargets(targetUnitMap, radius, PUSH_IN_FRONT_15, SPELL_TARGETS_AOE_DAMAGE);
case TARGET_NARROW_FRONTAL_CONE_2:
{
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;

if (spellEffect->Effect == SPELL_EFFECT_SCRIPT_EFFECT)
targetB = SPELL_TARGETS_ALL;

UnitList tempTargetUnitMap;
SQLMultiStorage::SQLMSIteratorBounds<SpellTargetEntry> bounds = sSpellScriptTargetStorage.getBounds<SpellTargetEntry>(m_spellInfo->Id);

// fill real target list if no spell script target defined
FillAreaTargets(bounds.first != bounds.second ? tempTargetUnitMap : targetUnitMap,
radius, PUSH_IN_FRONT_15, bounds.first != bounds.second ? SPELL_TARGETS_ALL : targetB);

if (!tempTargetUnitMap.empty())
{
for (UnitList::const_iterator iter = tempTargetUnitMap.begin(); iter != tempTargetUnitMap.end(); ++iter)
{
if ((*iter)->GetTypeId() != TYPEID_UNIT)
continue;

for (SQLMultiStorage::SQLMultiSIterator<SpellTargetEntry> i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST)
{
if (i_spellST->CanNotHitWithSpellEffect(effIndex))
continue;

// only creature entries supported for this target type
if (i_spellST->type == SPELL_TARGET_TYPE_GAMEOBJECT)
continue;

if ((*iter)->GetEntry() == i_spellST->targetEntry)
{
if (i_spellST->type == SPELL_TARGET_TYPE_DEAD && ((Creature*)(*iter))->IsCorpse())
{
targetUnitMap.push_back((*iter));
}
else if (i_spellST->type == SPELL_TARGET_TYPE_CREATURE && (*iter)->isAlive())
{
targetUnitMap.push_back((*iter));
}
break;
}
}
}
}
break;
}
case TARGET_IN_FRONT_OF_CASTER_30:
FillAreaTargets(targetUnitMap, radius, PUSH_IN_FRONT_30, SPELL_TARGETS_AOE_DAMAGE);
break;
Expand Down Expand Up @@ -7354,7 +7399,11 @@ bool Spell::CheckTarget(Unit* target, SpellEffectIndex eff)
spellEffect->EffectImplicitTargetA != TARGET_AREAEFFECT_INSTANT &&
spellEffect->EffectImplicitTargetB != TARGET_AREAEFFECT_INSTANT &&
spellEffect->EffectImplicitTargetA != TARGET_AREAEFFECT_CUSTOM &&
spellEffect->EffectImplicitTargetB != TARGET_AREAEFFECT_CUSTOM )
spellEffect->EffectImplicitTargetB != TARGET_AREAEFFECT_CUSTOM &&
spellEffect->EffectImplicitTargetA != TARGET_NARROW_FRONTAL_CONE &&
spellEffect->EffectImplicitTargetB != TARGET_NARROW_FRONTAL_CONE &&
spellEffect->EffectImplicitTargetA != TARGET_NARROW_FRONTAL_CONE_2 &&
spellEffect->EffectImplicitTargetB != TARGET_NARROW_FRONTAL_CONE_2)
return false;
}

Expand Down
6 changes: 5 additions & 1 deletion src/game/SpellMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3486,7 +3486,11 @@ void SpellMgr::LoadSpellScriptTarget()
spellEffect->EffectImplicitTargetA == TARGET_AREAEFFECT_GO_AROUND_SOURCE ||
spellEffect->EffectImplicitTargetB == TARGET_AREAEFFECT_GO_AROUND_SOURCE ||
spellEffect->EffectImplicitTargetA == TARGET_AREAEFFECT_GO_AROUND_DEST ||
spellEffect->EffectImplicitTargetB == TARGET_AREAEFFECT_GO_AROUND_DEST)
spellEffect->EffectImplicitTargetB == TARGET_AREAEFFECT_GO_AROUND_DEST ||
spellEffect->EffectImplicitTargetA == TARGET_NARROW_FRONTAL_CONE ||
spellEffect->EffectImplicitTargetB == TARGET_NARROW_FRONTAL_CONE ||
spellEffect->EffectImplicitTargetA == TARGET_NARROW_FRONTAL_CONE_2 ||
spellEffect->EffectImplicitTargetB == TARGET_NARROW_FRONTAL_CONE_2)
{
targetfound = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12935"
#define REVISION_NR "12936"
#endif // __REVISION_NR_H__

0 comments on commit d517e33

Please sign in to comment.