[8541] Implement implicit target types TARGET_RANDOM_NEARBY_LOC(72) and TARGET_RANDOM_NEARBY_DEST(86). Some summon spells should work fine now

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
qsa 2009-09-26 09:29:38 +03:00 committed by Ambal
parent eb46131715
commit c78be3fc74
3 changed files with 31 additions and 1 deletions

View file

@ -1052,6 +1052,7 @@ enum Targets
TARGET_AREAEFFECT_PARTY_AND_CLASS = 61, TARGET_AREAEFFECT_PARTY_AND_CLASS = 61,
TARGET_DUELVSPLAYER_COORDINATES = 63, TARGET_DUELVSPLAYER_COORDINATES = 63,
TARGET_BEHIND_VICTIM = 65, // uses in teleport behind spells, caster/target dependent from spell effect TARGET_BEHIND_VICTIM = 65, // uses in teleport behind spells, caster/target dependent from spell effect
TARGET_RANDOM_NEARBY_LOC = 72, // uses in teleport onto nearby locations
TARGET_DYNAMIC_OBJECT_COORDINATES = 76, TARGET_DYNAMIC_OBJECT_COORDINATES = 76,
TARGET_SINGLE_ENEMY = 77, TARGET_SINGLE_ENEMY = 77,
TARGET_POINT_AT_NORTH = 78, // 78-85 possible _COORDINATES at radius with pi/4 step around target in unknown order, N? TARGET_POINT_AT_NORTH = 78, // 78-85 possible _COORDINATES at radius with pi/4 step around target in unknown order, N?
@ -1062,6 +1063,7 @@ enum Targets
TARGET_POINT_AT_NW = 83, // from spell desc: "(NW)" TARGET_POINT_AT_NW = 83, // from spell desc: "(NW)"
TARGET_POINT_AT_SE = 84, // from spell desc: "(SE)" TARGET_POINT_AT_SE = 84, // from spell desc: "(SE)"
TARGET_POINT_AT_SW = 85, // from spell desc: "(SW)" TARGET_POINT_AT_SW = 85, // from spell desc: "(SW)"
TARGET_RANDOM_NEARBY_DEST = 86, // "Test Nearby Dest Random" - random around selected destination
TARGET_SELF2 = 87, TARGET_SELF2 = 87,
TARGET_DIRECTLY_FORWARD = 89, TARGET_DIRECTLY_FORWARD = 89,
TARGET_NONCOMBAT_PET = 90, TARGET_NONCOMBAT_PET = 90,

View file

@ -1313,6 +1313,34 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
switch(targetMode) switch(targetMode)
{ {
case TARGET_RANDOM_NEARBY_LOC:
{
float dest_x = m_caster->GetPositionX() + irand(-radius, radius);
float dest_y = m_caster->GetPositionY() + irand(-radius, radius);
float dest_z = m_caster->GetMap()->GetHeight(dest_x, dest_y, MAX_HEIGHT);
m_targets.setDestination(dest_x, dest_y, dest_z);
TagUnitMap.push_back(m_caster);
break;
}
case TARGET_RANDOM_NEARBY_DEST:
{
float dest_x = m_targets.m_destX + irand(-radius, radius);
float dest_y = m_targets.m_destY + irand(-radius, radius);
float dest_z = m_caster->GetMap()->GetHeight(dest_x, dest_y, MAX_HEIGHT);
m_targets.setDestination(dest_x, dest_y, dest_z);
if (radius > 0.0f)
{
// caster included here?
FillAreaTargets(TagUnitMap, dest_x, dest_y, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
}
else
TagUnitMap.push_back(m_caster);
break;
}
case TARGET_TOTEM_EARTH: case TARGET_TOTEM_EARTH:
case TARGET_TOTEM_WATER: case TARGET_TOTEM_WATER:
case TARGET_TOTEM_AIR: case TARGET_TOTEM_AIR:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8540" #define REVISION_NR "8541"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__