diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 5c571350d03..03427d1f05b 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -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? @@ -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, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 570bb00b149..25214ad14ea 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -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: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 416038c68e8..b4980652438 100644 --- a/src/shared/revision_nr.h +++ b/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__