Skip to content

Commit

Permalink
[8541] Implement implicit target types TARGET_RANDOM_NEARBY_LOC(72) a…
Browse files Browse the repository at this point in the history
…nd TARGET_RANDOM_NEARBY_DEST(86). Some summon spells should work fine now

Signed-off-by: Ambal <pogrebniak@gala.net>
  • Loading branch information
qsa authored and tomrus88 committed Sep 26, 2009
1 parent 5e05ce7 commit 334dfe1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/game/SharedDefines.h
Expand Up @@ -1053,6 +1053,7 @@ enum Targets
TARGET_AREAEFFECT_PARTY_AND_CLASS = 61,
TARGET_DUELVSPLAYER_COORDINATES = 63,
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_SINGLE_ENEMY = 77,
TARGET_POINT_AT_NORTH = 78, // 78-85 possible _COORDINATES at radius with pi/4 step around target in unknown order, N?
Expand All @@ -1063,6 +1064,7 @@ enum Targets
TARGET_POINT_AT_NW = 83, // from spell desc: "(NW)"
TARGET_POINT_AT_SE = 84, // from spell desc: "(SE)"
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_DIRECTLY_FORWARD = 89,
TARGET_NONCOMBAT_PET = 90,
Expand Down
28 changes: 28 additions & 0 deletions src/game/Spell.cpp
Expand Up @@ -1323,6 +1323,34 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)

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_WATER:
case TARGET_TOTEM_AIR:
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8540"
#define REVISION_NR "8541"
#endif // __REVISION_NR_H__

0 comments on commit 334dfe1

Please sign in to comment.