From e01e1b4fb465f14dba75f5db2ff714ac5c687448 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 11 Aug 2009 19:48:41 +0400 Subject: [PATCH] [8350] Implement (partly) 78-85 target modes. Thanks to Astellar for original reseach related target modes. --- src/game/SharedDefines.h | 8 ++++++++ src/game/Spell.cpp | 33 +++++++++++++++++++++++++++++++++ src/game/SpellMgr.h | 8 ++++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index dfecca975..9d4a4863f 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1045,6 +1045,14 @@ enum Targets TARGET_BEHIND_VICTIM = 65, // uses in teleport behind spells, caster/target dependent from spell effect 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? + TARGET_POINT_AT_SOUTH = 79, // S? + TARGET_POINT_AT_EAST = 80, // 80/81 must be symmetric from line caster->target, E (base at 82/83, 84/85 order) ? + TARGET_POINT_AT_WEST = 81, // 80/81 must be symmetric from line caster->target, W (base at 82/83, 84/85 order) ? + TARGET_POINT_AT_NE = 82, // from spell desc: "(NE)" + 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_SELF2 = 87, TARGET_DIRECTLY_FORWARD = 89, TARGET_NONCOMBAT_PET = 90, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 728d47d49..fc558c412 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2110,6 +2110,39 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) if(DynamicObject* dynObj = m_caster->GetDynObject(m_triggeredByAuraSpell ? m_triggeredByAuraSpell->Id : m_spellInfo->Id)) m_targets.setDestination(dynObj->GetPositionX(), dynObj->GetPositionY(), dynObj->GetPositionZ()); break; + case TARGET_POINT_AT_NORTH: + case TARGET_POINT_AT_SOUTH: + case TARGET_POINT_AT_EAST: + case TARGET_POINT_AT_WEST: + case TARGET_POINT_AT_NE: + case TARGET_POINT_AT_NW: + case TARGET_POINT_AT_SE: + case TARGET_POINT_AT_SW: + { + + if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) + { + Unit* currentTarget = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; + float angle = currentTarget != m_caster ? currentTarget->GetAngle(m_caster) : m_caster->GetOrientation(); + + switch(cur) + { + case TARGET_POINT_AT_NORTH: break; + case TARGET_POINT_AT_SOUTH: angle += M_PI; break; + case TARGET_POINT_AT_EAST: angle -= M_PI/2; break; + case TARGET_POINT_AT_WEST: angle += M_PI/2; break; + case TARGET_POINT_AT_NE: angle -= M_PI/4; break; + case TARGET_POINT_AT_NW: angle += M_PI/4; break; + case TARGET_POINT_AT_SE: angle -= 3*M_PI/4; break; + case TARGET_POINT_AT_SW: angle += 3*M_PI/4; break; + } + + float x,y; + currentTarget->GetNearPoint2D(x,y,radius,angle); + m_targets.setDestination(x,y,currentTarget->GetPositionZ()); + } + break; + } case TARGET_DIRECTLY_FORWARD: { if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index f1eb31ef3..532779d78 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -257,6 +257,14 @@ inline bool IsPointEffectTarget( Targets target ) case TARGET_CURRENT_ENEMY_COORDINATES: case TARGET_DUELVSPLAYER_COORDINATES: case TARGET_DYNAMIC_OBJECT_COORDINATES: + case TARGET_POINT_AT_NORTH: + case TARGET_POINT_AT_SOUTH: + case TARGET_POINT_AT_EAST: + case TARGET_POINT_AT_WEST: + case TARGET_POINT_AT_NE: + case TARGET_POINT_AT_NW: + case TARGET_POINT_AT_SE: + case TARGET_POINT_AT_SW: return true; default: break; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b0521f458..c2b94c996 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 "8349" + #define REVISION_NR "8350" #endif // __REVISION_NR_H__