*Update to Trinity 881.
--HG-- branch : trunk
This commit is contained in:
@@ -342,7 +342,7 @@ Unit* ScriptedAI::SelectUnit(SelectAggroTarget targetType, uint32 position, floa
|
|||||||
Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||||
if(!target
|
if(!target
|
||||||
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
||||||
|| dist && !m_creature->IsWithinDistInMap(target, dist))
|
|| dist && !m_creature->IsWithinCombatRange(target, dist))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ Unit* ScriptedAI::SelectUnit(SelectAggroTarget targetType, uint32 position, floa
|
|||||||
target = Unit::GetUnit(*m_creature,(*i)->getUnitGuid());
|
target = Unit::GetUnit(*m_creature,(*i)->getUnitGuid());
|
||||||
if(!target
|
if(!target
|
||||||
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
||||||
|| dist && !m_creature->IsWithinDistInMap(target, dist))
|
|| dist && !m_creature->IsWithinCombatRange(target, dist))
|
||||||
{
|
{
|
||||||
m_threatlist.erase(i);
|
m_threatlist.erase(i);
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,7 @@ void ScriptedAI::SelectUnitList(std::list<Unit*> &targetList, uint32 num, Select
|
|||||||
Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||||
if(!target
|
if(!target
|
||||||
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
||||||
|| dist && !m_creature->IsWithinDistInMap(target, dist))
|
|| dist && !m_creature->IsWithinCombatRange(target, dist))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -448,7 +448,7 @@ void ScriptedAI::SelectUnitList(std::list<Unit*> &targetList, uint32 num, Select
|
|||||||
m_threatlist.erase(i);
|
m_threatlist.erase(i);
|
||||||
if(!target
|
if(!target
|
||||||
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
|| playerOnly && target->GetTypeId() != TYPEID_PLAYER
|
||||||
|| dist && !m_creature->IsWithinDistInMap(target, dist))
|
|| dist && !m_creature->IsWithinCombatRange(target, dist))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -575,6 +575,16 @@ bool ScriptedAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float GetSpellMaxRange(uint32 id)
|
||||||
|
{
|
||||||
|
SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(id);
|
||||||
|
if(!spellInfo) return 0;
|
||||||
|
SpellRangeEntry const *range = GetSpellRangeStore()->LookupEntry(spellInfo->rangeIndex);
|
||||||
|
if(!range) return 0;
|
||||||
|
return range->maxRange;
|
||||||
|
}
|
||||||
|
|
||||||
void FillSpellSummary()
|
void FillSpellSummary()
|
||||||
{
|
{
|
||||||
SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
|
SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
|
|
||||||
|
float GetSpellMaxRange(uint32 id);
|
||||||
|
|
||||||
class SummonList : std::list<uint64>
|
class SummonList : std::list<uint64>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -908,18 +908,11 @@ struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI
|
|||||||
void ChargeCheck()
|
void ChargeCheck()
|
||||||
{
|
{
|
||||||
Unit* target = SelectUnit(SELECT_TARGET_FARTHEST, 0, 200, false);
|
Unit* target = SelectUnit(SELECT_TARGET_FARTHEST, 0, 200, false);
|
||||||
if(target && (!m_creature->IsWithinDistInMap(target, FLAME_CHARGE_DISTANCE)))
|
if(target && (!m_creature->IsWithinCombatRange(target, FLAME_CHARGE_DISTANCE)))
|
||||||
{
|
{
|
||||||
m_creature->AttackStop();
|
|
||||||
m_creature->GetMotionMaster()->Clear(false);
|
|
||||||
float x, y, z; // is it possible to fix charge?
|
|
||||||
target->GetContactPoint(m_creature, x, y, z);
|
|
||||||
m_creature->Relocate(x,y,z);
|
|
||||||
m_creature->SendMonsterMove(x, y, z, 0, MOVEMENTFLAG_WALK_MODE, 1);
|
|
||||||
//m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
|
|
||||||
m_creature->StopMoving();
|
|
||||||
//DoCast(target, SPELL_CHARGE);
|
|
||||||
m_creature->AddThreat(target, 5000000.0f);
|
m_creature->AddThreat(target, 5000000.0f);
|
||||||
|
AttackStart(target);
|
||||||
|
DoCast(target, SPELL_CHARGE);
|
||||||
DoTextEmote("sets its gaze on $N!", target);
|
DoTextEmote("sets its gaze on $N!", target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -967,7 +960,7 @@ struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
ChargeCheck();
|
ChargeCheck();
|
||||||
EnrageCheck();
|
EnrageCheck();
|
||||||
CheckTimer = 5000;
|
CheckTimer = 1000;
|
||||||
}else CheckTimer -= diff;
|
}else CheckTimer -= diff;
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
|
|||||||
@@ -246,9 +246,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
|
|||||||
FlamePatch_Timer = 30000;
|
FlamePatch_Timer = 30000;
|
||||||
Phase1 = false;
|
Phase1 = false;
|
||||||
break;
|
break;
|
||||||
case WE_CHARGE:
|
|
||||||
m_creature->SetSpeed(MOVE_RUN, DefaultMoveSpeedRate);
|
|
||||||
break;
|
|
||||||
case WE_METEOR:
|
case WE_METEOR:
|
||||||
m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, false);
|
m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, false);
|
||||||
m_creature->CastSpell(m_creature, SPELL_DIVE_BOMB_VISUAL, false);
|
m_creature->CastSpell(m_creature, SPELL_DIVE_BOMB_VISUAL, false);
|
||||||
@@ -336,17 +333,8 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
|
|||||||
|
|
||||||
if(Charge_Timer < diff)
|
if(Charge_Timer < diff)
|
||||||
{
|
{
|
||||||
if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1))
|
Unit *target= SelectUnit(SELECT_TARGET_RANDOM, 1, GetSpellMaxRange(SPELL_CHARGE), true);
|
||||||
{
|
DoCast(target, SPELL_CHARGE);
|
||||||
m_creature->SetInFront(target);
|
|
||||||
m_creature->GetMotionMaster()->Clear();
|
|
||||||
m_creature->AttackStop();
|
|
||||||
m_creature->SetSpeed(MOVE_RUN, 5.0f);
|
|
||||||
DoCast(target, SPELL_CHARGE);
|
|
||||||
WaitEvent = WE_CHARGE;
|
|
||||||
WaitTimer = 1000;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Charge_Timer = 30000;
|
Charge_Timer = 30000;
|
||||||
}else Charge_Timer -= diff;
|
}else Charge_Timer -= diff;
|
||||||
|
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
|
|||||||
uint32 ShapeShift_Timer;
|
uint32 ShapeShift_Timer;
|
||||||
uint32 Berserk_Timer;
|
uint32 Berserk_Timer;
|
||||||
|
|
||||||
uint64 ChargeTargetGUID;
|
|
||||||
uint64 TankGUID;
|
|
||||||
|
|
||||||
bool inBearForm;
|
bool inBearForm;
|
||||||
bool MoveEvent;
|
bool MoveEvent;
|
||||||
bool inMove;
|
bool inMove;
|
||||||
@@ -145,9 +142,6 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
|
|||||||
ShapeShift_Timer = 45000 + rand()%5000;
|
ShapeShift_Timer = 45000 + rand()%5000;
|
||||||
Berserk_Timer = 600000;
|
Berserk_Timer = 600000;
|
||||||
|
|
||||||
ChargeTargetGUID = 0;
|
|
||||||
TankGUID = 0;
|
|
||||||
|
|
||||||
inBearForm = false;
|
inBearForm = false;
|
||||||
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122);
|
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122);
|
||||||
}
|
}
|
||||||
@@ -301,15 +295,7 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
|
|||||||
|
|
||||||
void MovementInform(uint32 type, uint32 id)
|
void MovementInform(uint32 type, uint32 id)
|
||||||
{
|
{
|
||||||
if(!MoveEvent)
|
if(MoveEvent)
|
||||||
{
|
|
||||||
if(ChargeTargetGUID)
|
|
||||||
{
|
|
||||||
if(Unit* target = Unit::GetUnit(*m_creature, ChargeTargetGUID))
|
|
||||||
m_creature->CastSpell(target, SPELL_SURGE, true);
|
|
||||||
ChargeTargetGUID = 0;
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
{
|
{
|
||||||
if(type != POINT_MOTION_TYPE)
|
if(type != POINT_MOTION_TYPE)
|
||||||
return;
|
return;
|
||||||
@@ -360,19 +346,6 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
|
|||||||
}else waitTimer -= diff;
|
}else waitTimer -= diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(TankGUID)
|
|
||||||
{
|
|
||||||
if(!ChargeTargetGUID)
|
|
||||||
{
|
|
||||||
m_creature->SetSpeed(MOVE_RUN, 1.2f);
|
|
||||||
m_creature->GetMotionMaster()->Clear();
|
|
||||||
if(Unit* target = Unit::GetUnit(*m_creature, TankGUID))
|
|
||||||
m_creature->GetMotionMaster()->MoveChase(target);
|
|
||||||
TankGUID = 0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!m_creature->SelectHostilTarget() && !m_creature->getVictim())
|
if(!m_creature->SelectHostilTarget() && !m_creature->getVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -434,37 +407,13 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
DoYell(YELL_SURGE, LANG_UNIVERSAL, NULL);
|
DoYell(YELL_SURGE, LANG_UNIVERSAL, NULL);
|
||||||
DoPlaySoundToSet(m_creature, SOUND_YELL_SURGE);
|
DoPlaySoundToSet(m_creature, SOUND_YELL_SURGE);
|
||||||
|
Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1, GetSpellMaxRange(SPELL_SURGE), true);
|
||||||
Unit *target = NULL;
|
DoCast(target, SPELL_SURGE);
|
||||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
|
||||||
std::vector<Unit *> target_list;
|
|
||||||
for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
|
||||||
{
|
|
||||||
target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
|
||||||
//50 yard radius maximum
|
|
||||||
if(target && target->GetDistance2d(m_creature) < 50)
|
|
||||||
target_list.push_back(target);
|
|
||||||
target = NULL;
|
|
||||||
}
|
|
||||||
if(target_list.size())
|
|
||||||
target = *(target_list.begin()+rand()%target_list.size());
|
|
||||||
|
|
||||||
if(!target)
|
|
||||||
target = m_creature->getVictim();
|
|
||||||
TankGUID = m_creature->getVictim()->GetGUID();
|
|
||||||
ChargeTargetGUID = target->GetGUID();
|
|
||||||
|
|
||||||
float x, y, z;
|
|
||||||
target->GetContactPoint(m_creature, x, y, z);
|
|
||||||
m_creature->SetSpeed(MOVE_RUN, 5.0f);
|
|
||||||
m_creature->GetMotionMaster()->Clear();
|
|
||||||
m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
|
|
||||||
|
|
||||||
Surge_Timer = 15000 + rand()%5000;
|
Surge_Timer = 15000 + rand()%5000;
|
||||||
return;
|
|
||||||
}else Surge_Timer -= diff;
|
}else Surge_Timer -= diff;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if(LaceratingSlash_Timer < diff)
|
if(LaceratingSlash_Timer < diff)
|
||||||
{
|
{
|
||||||
DoCast(m_creature->getVictim(), SPELL_LACERATINGSLASH);
|
DoCast(m_creature->getVictim(), SPELL_LACERATINGSLASH);
|
||||||
|
|||||||
@@ -95,10 +95,16 @@ DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove)
|
|||||||
dist = sqrt((dx*dx) + (dy*dy) + (dz*dz));
|
dist = sqrt((dx*dx) + (dy*dy) + (dz*dz));
|
||||||
else //Walking on the ground
|
else //Walking on the ground
|
||||||
dist = sqrt((dx*dx) + (dy*dy));
|
dist = sqrt((dx*dx) + (dy*dy));
|
||||||
float speed = traveller.Speed();
|
|
||||||
|
|
||||||
speed *= 0.001f; // speed is in seconds so convert from second to millisecond
|
if(traveller.GetTraveller().hasUnitState(UNIT_STAT_CHARGING))
|
||||||
i_totalTravelTime = static_cast<uint32>(dist/speed);
|
i_totalTravelTime = 1000;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float speed = traveller.Speed();
|
||||||
|
speed *= 0.001f; // speed is in seconds so convert from second to millisecond
|
||||||
|
i_totalTravelTime = static_cast<uint32>(dist/speed);
|
||||||
|
}
|
||||||
|
|
||||||
i_timeElapsed = 0;
|
i_timeElapsed = 0;
|
||||||
if(sendMove)
|
if(sendMove)
|
||||||
traveller.MoveTo(i_destX, i_destY, i_destZ, i_totalTravelTime);
|
traveller.MoveTo(i_destX, i_destY, i_destZ, i_totalTravelTime);
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ MotionMaster::Initialize()
|
|||||||
while(!empty())
|
while(!empty())
|
||||||
{
|
{
|
||||||
MovementGenerator *curr = top();
|
MovementGenerator *curr = top();
|
||||||
curr->Finalize(*i_owner);
|
|
||||||
pop();
|
pop();
|
||||||
|
if(!curr)
|
||||||
|
continue;
|
||||||
|
curr->Finalize(*i_owner);
|
||||||
if( !isStatic( curr ) )
|
if( !isStatic( curr ) )
|
||||||
delete curr;
|
delete curr;
|
||||||
}
|
}
|
||||||
@@ -69,8 +71,10 @@ MotionMaster::~MotionMaster()
|
|||||||
while(!empty())
|
while(!empty())
|
||||||
{
|
{
|
||||||
MovementGenerator *curr = top();
|
MovementGenerator *curr = top();
|
||||||
curr->Finalize(*i_owner);
|
|
||||||
pop();
|
pop();
|
||||||
|
if(!curr)
|
||||||
|
continue;
|
||||||
|
curr->Finalize(*i_owner);
|
||||||
if( !isStatic( curr ) )
|
if( !isStatic( curr ) )
|
||||||
delete curr;
|
delete curr;
|
||||||
}
|
}
|
||||||
@@ -92,8 +96,10 @@ MotionMaster::Clear(bool reset)
|
|||||||
while( !empty() && size() > 1 )
|
while( !empty() && size() > 1 )
|
||||||
{
|
{
|
||||||
MovementGenerator *curr = top();
|
MovementGenerator *curr = top();
|
||||||
curr->Finalize(*i_owner);
|
|
||||||
pop();
|
pop();
|
||||||
|
if(!curr)
|
||||||
|
continue;
|
||||||
|
curr->Finalize(*i_owner);
|
||||||
if( !isStatic( curr ) )
|
if( !isStatic( curr ) )
|
||||||
delete curr;
|
delete curr;
|
||||||
}
|
}
|
||||||
@@ -268,6 +274,26 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MotionMaster::MoveCharge(float x, float y, float z)
|
||||||
|
{
|
||||||
|
if(Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
i_owner->addUnitState(UNIT_STAT_CHARGING);
|
||||||
|
if(i_owner->GetTypeId()==TYPEID_PLAYER)
|
||||||
|
{
|
||||||
|
DEBUG_LOG("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
|
||||||
|
Mutate(new PointMovementGenerator<Player>(0,x,y,z), MOTION_SLOT_CONTROLLED);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DEBUG_LOG("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
|
||||||
|
i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z );
|
||||||
|
Mutate(new PointMovementGenerator<Creature>(0,x,y,z), MOTION_SLOT_CONTROLLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MotionMaster::MoveFleeing(Unit* enemy)
|
MotionMaster::MoveFleeing(Unit* enemy)
|
||||||
{
|
{
|
||||||
@@ -366,14 +392,14 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
|
|||||||
return;
|
return;
|
||||||
//We set waypoint movement as new default movement generator
|
//We set waypoint movement as new default movement generator
|
||||||
// clear ALL movement generators (including default)
|
// clear ALL movement generators (including default)
|
||||||
while(!empty())
|
/*while(!empty())
|
||||||
{
|
{
|
||||||
MovementGenerator *curr = top();
|
MovementGenerator *curr = top();
|
||||||
curr->Finalize(*i_owner);
|
curr->Finalize(*i_owner);
|
||||||
pop();
|
pop();
|
||||||
if( !isStatic( curr ) )
|
if( !isStatic( curr ) )
|
||||||
delete curr;
|
delete curr;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//i_owner->GetTypeId()==TYPEID_PLAYER ?
|
//i_owner->GetTypeId()==TYPEID_PLAYER ?
|
||||||
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
|
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
|
|||||||
void MoveConfused();
|
void MoveConfused();
|
||||||
void MoveFleeing(Unit* enemy);
|
void MoveFleeing(Unit* enemy);
|
||||||
void MovePoint(uint32 id, float x,float y,float z);
|
void MovePoint(uint32 id, float x,float y,float z);
|
||||||
|
void MoveCharge(float x, float y, float z);
|
||||||
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
||||||
void MoveDistract(uint32 time);
|
void MoveDistract(uint32 time);
|
||||||
void MovePath(uint32 path_id, bool repeatable);
|
void MovePath(uint32 path_id, bool repeatable);
|
||||||
|
|||||||
@@ -44,7 +44,12 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||||
return true;
|
{
|
||||||
|
if(unit.hasUnitState(UNIT_STAT_CHARGING))
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Traveller<T> traveller(unit);
|
Traveller<T> traveller(unit);
|
||||||
|
|
||||||
@@ -53,7 +58,8 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
|||||||
if(i_destinationHolder.HasArrived())
|
if(i_destinationHolder.HasArrived())
|
||||||
{
|
{
|
||||||
unit.StopMoving();
|
unit.StopMoving();
|
||||||
MovementInform(unit);
|
if(!unit.hasUnitState(UNIT_STAT_CHARGING))
|
||||||
|
MovementInform(unit);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class TRINITY_DLL_SPEC PointMovementGenerator
|
|||||||
i_x(_x), i_y(_y), i_z(_z), i_nextMoveTime(0) {}
|
i_x(_x), i_y(_y), i_z(_z), i_nextMoveTime(0) {}
|
||||||
|
|
||||||
void Initialize(T &);
|
void Initialize(T &);
|
||||||
void Finalize(T &){}
|
void Finalize(T &unit){unit.clearUnitState(UNIT_STAT_CHARGING);}
|
||||||
void Reset(T &unit){unit.StopMoving();}
|
void Reset(T &unit){unit.StopMoving();}
|
||||||
bool Update(T &, const uint32 &diff);
|
bool Update(T &, const uint32 &diff);
|
||||||
|
|
||||||
|
|||||||
@@ -5946,17 +5946,10 @@ void Spell::EffectCharge(uint32 /*i*/)
|
|||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
unitTarget->GetContactPoint(m_caster, x, y, z);
|
unitTarget->GetContactPoint(m_caster, x, y, z);
|
||||||
if(unitTarget->GetTypeId() != TYPEID_PLAYER)
|
m_caster->GetMotionMaster()->MoveCharge(x, y, z);
|
||||||
((Creature *)unitTarget)->StopMoving();
|
|
||||||
|
|
||||||
// Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags
|
|
||||||
m_caster->SendMonsterMove(x, y, z, 0, MOVEMENTFLAG_WALK_MODE, 1);
|
|
||||||
|
|
||||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
|
||||||
m_caster->GetMap()->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation());
|
|
||||||
|
|
||||||
// not all charge effects used in negative spells
|
// not all charge effects used in negative spells
|
||||||
if ( !IsPositiveSpell(m_spellInfo->Id))
|
if ( !IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
m_caster->Attack(unitTarget,true);
|
m_caster->Attack(unitTarget,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-12
@@ -181,6 +181,9 @@ Unit::~Unit()
|
|||||||
RemoveAllDynObjects();
|
RemoveAllDynObjects();
|
||||||
|
|
||||||
if(m_charmInfo) delete m_charmInfo;
|
if(m_charmInfo) delete m_charmInfo;
|
||||||
|
|
||||||
|
RemoveAllAuras();
|
||||||
|
assert(m_Auras.begin() == m_Auras.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::Update( uint32 p_time )
|
void Unit::Update( uint32 p_time )
|
||||||
@@ -3973,18 +3976,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id))
|
sLog.outDebug("Aura %u (%u) now is remove mode %d", Aur->GetId(), Aur->GetModifier()->m_auraname, mode);
|
||||||
{
|
|
||||||
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
|
|
||||||
{
|
|
||||||
if(spell_triggered < 0)
|
|
||||||
RemoveAurasDueToSpell(-(*itr));
|
|
||||||
else if(Unit* caster = Aur->GetCaster())
|
|
||||||
CastSpell(this, *itr, true, 0, 0, caster->GetGUID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
|
|
||||||
assert(!Aur->IsInUse());
|
assert(!Aur->IsInUse());
|
||||||
Aur->ApplyModifier(false,true);
|
Aur->ApplyModifier(false,true);
|
||||||
Aur->_RemoveAura();
|
Aur->_RemoveAura();
|
||||||
@@ -3996,6 +3988,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
if(statue)
|
if(statue)
|
||||||
statue->UnSummon();
|
statue->UnSummon();
|
||||||
|
|
||||||
|
if(mode != AURA_REMOVE_BY_STACK)
|
||||||
|
{
|
||||||
|
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id))
|
||||||
|
{
|
||||||
|
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
|
||||||
|
{
|
||||||
|
if(spell_triggered < 0)
|
||||||
|
RemoveAurasDueToSpell(-(*itr));
|
||||||
|
else if(Unit* caster = Aur->GetCaster())
|
||||||
|
CastSpell(this, *itr, true, 0, 0, caster->GetGUID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// only way correctly remove all auras from list
|
// only way correctly remove all auras from list
|
||||||
if( m_Auras.empty() )
|
if( m_Auras.empty() )
|
||||||
i = m_Auras.end();
|
i = m_Auras.end();
|
||||||
|
|||||||
+2
-1
@@ -382,8 +382,9 @@ enum UnitState
|
|||||||
UNIT_STAT_ATTACK_PLAYER = 0x00004000,
|
UNIT_STAT_ATTACK_PLAYER = 0x00004000,
|
||||||
UNIT_STAT_CASTING = 0x00008000,
|
UNIT_STAT_CASTING = 0x00008000,
|
||||||
UNIT_STAT_POSSESSED = 0x00010000,
|
UNIT_STAT_POSSESSED = 0x00010000,
|
||||||
|
UNIT_STAT_CHARGING = 0x00020000,
|
||||||
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FOLLOW),
|
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FOLLOW),
|
||||||
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
|
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_CHARGING),
|
||||||
UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING),
|
UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING),
|
||||||
UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING),
|
UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING),
|
||||||
UNIT_STAT_ALL_STATE = 0xffffffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT)
|
UNIT_STAT_ALL_STATE = 0xffffffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT)
|
||||||
|
|||||||
Reference in New Issue
Block a user