[7678] Implement spell target mode 7 and cleanup target mode 17.

This commit is contained in:
VladimirMangos 2009-04-17 13:36:29 +04:00
parent 650be82030
commit 09c32b5429
6 changed files with 34 additions and 18 deletions

View file

@ -988,6 +988,7 @@ enum Targets
TARGET_RANDOM_FRIEND_CHAIN_IN_AREA = 3,
TARGET_PET = 5,
TARGET_CHAIN_DAMAGE = 6,
TARGET_AREAEFFECT_INSTANT = 7, // targets around provided destination point
TARGET_AREAEFFECT_CUSTOM = 8,
TARGET_INNKEEPER_COORDINATES = 9, // uses in teleport to innkeeper spells
TARGET_ALL_ENEMY_IN_AREA = 15,

View file

@ -457,6 +457,11 @@ void Spell::FillTargetMap()
case 0:
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
break;
case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact
if((m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)==0)
m_targets.setDestination(m_caster->GetPositionX(),m_caster->GetPositionY(),m_caster->GetPositionZ());
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
break;
case TARGET_BEHIND_VICTIM: // use B case that not dependent from from A in fact
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
break;
@ -482,8 +487,14 @@ void Spell::FillTargetMap()
}
break;
case TARGET_TABLE_X_Y_Z_COORDINATES:
// Only if target A, for target B (used in teleports) dest select in effect
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
// All 17/7 pairs used for dest teleportation, A processed in effect code
if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_AREAEFFECT_INSTANT)
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
else
{
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
}
break;
default:
switch(m_spellInfo->EffectImplicitTargetB[i])
@ -1601,7 +1612,18 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
FillAreaTargets(TagUnitMap,m_targets.m_destX, m_targets.m_destY,radius,PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE);
break;
}
case TARGET_AREAEFFECT_INSTANT:
{
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;
// Select friendly targets for positive effect
if (IsPositiveEffect(m_spellInfo->Id, i))
targetB = SPELL_TARGETS_FRIENDLY;
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB);
// exclude caster
TagUnitMap.remove(m_caster);
}
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
{
// targets the ground, not the units in the area
@ -2057,17 +2079,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{
if (st->target_mapId == m_caster->GetMapId())
m_targets.setDestination(st->target_X, st->target_Y, st->target_Z);
// if B==TARGET_TABLE_X_Y_Z_COORDINATES then A already fill all required targets
if (m_spellInfo->EffectImplicitTargetB[i] && m_spellInfo->EffectImplicitTargetB[i]!=TARGET_TABLE_X_Y_Z_COORDINATES)
{
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;
// Select friendly targets for positive effect
if (IsPositiveEffect(m_spellInfo->Id, i))
targetB = SPELL_TARGETS_FRIENDLY;
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB);
}
else
sLog.outError( "SPELL: wrong map (%u instead %u) target coordinates for spell ID %u", st->target_mapId, m_caster->GetMapId(), m_spellInfo->Id );
}
else
sLog.outError( "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id );

View file

@ -463,12 +463,12 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target,
{
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
m_areaAuraType = AREA_AURA_PARTY;
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
m_modifier.m_auraname = SPELL_AURA_NONE;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_RAID:
m_areaAuraType = AREA_AURA_RAID;
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
m_modifier.m_auraname = SPELL_AURA_NONE;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND:
@ -476,7 +476,7 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target,
break;
case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
m_areaAuraType = AREA_AURA_ENEMY;
if(target == caster_ptr)
if (target == caster_ptr)
m_modifier.m_auraname = SPELL_AURA_NONE; // Do not do any effect on self
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PET:
@ -484,7 +484,7 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target,
break;
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
m_areaAuraType = AREA_AURA_OWNER;
if(target == caster_ptr)
if (target == caster_ptr)
m_modifier.m_auraname = SPELL_AURA_NONE;
break;
default:

View file

@ -2097,6 +2097,7 @@ void Spell::EffectTeleportUnits(uint32 i)
((Player*)unitTarget)->TeleportTo(((Player*)unitTarget)->m_homebindMapId,((Player*)unitTarget)->m_homebindX,((Player*)unitTarget)->m_homebindY,((Player*)unitTarget)->m_homebindZ,unitTarget->GetOrientation(),unitTarget==m_caster ? TELE_TO_SPELL : 0);
return;
}
case TARGET_AREAEFFECT_INSTANT: // in all cases first TARGET_TABLE_X_Y_Z_COORDINATES
case TARGET_TABLE_X_Y_Z_COORDINATES:
{
SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id);

View file

@ -181,6 +181,7 @@ inline bool IsAreaEffectTarget( Targets target )
{
switch (target )
{
case TARGET_AREAEFFECT_INSTANT:
case TARGET_AREAEFFECT_CUSTOM:
case TARGET_ALL_ENEMY_IN_AREA:
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7677"
#define REVISION_NR "7678"
#endif // __REVISION_NR_H__