mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Movement: first part of porting the new creature hover handling
This commit is contained in:
@@ -510,11 +510,9 @@ class npc_halfus_enslaved_dragon : public CreatureScript
|
||||
case EVENT_LIFTOFF:
|
||||
{
|
||||
Position pos = me->GetPosition();
|
||||
me->SetDisableGravity(true);
|
||||
me->SendSetPlayHoverAnim(true);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
pos.m_positionZ += 5.5f;
|
||||
me->GetMotionMaster()->MoveTakeoff(0, pos);
|
||||
_events.ScheduleEvent(EVENT_CAST_DEBUFF, Seconds(1) + Milliseconds(750));
|
||||
_events.ScheduleEvent(EVENT_CAST_DEBUFF, Seconds(1) + Milliseconds(800));
|
||||
break;
|
||||
}
|
||||
case EVENT_MOVE_OUT_OF_CAGE:
|
||||
@@ -535,6 +533,15 @@ class npc_halfus_enslaved_dragon : public CreatureScript
|
||||
if (!halfus || !protoBehemoth)
|
||||
break;
|
||||
|
||||
if (me->GetEntry() != NPC_ORPHANED_EMERALD_WELP)
|
||||
{
|
||||
me->SetDisableGravity(true);
|
||||
me->SendSetPlayHoverAnim(true);
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_HOVER);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
}
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_NETHER_SCION_ENCOUNTER:
|
||||
|
||||
@@ -421,7 +421,7 @@ struct npc_mandokir_chained_spirit : public PassiveAI
|
||||
Position pos;
|
||||
if (Player* target = ObjectAccessor::GetPlayer(*me, _revivePlayerGUID))
|
||||
{
|
||||
target->GetNearPoint(me, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 5.0f, target->GetAngle(me));
|
||||
target->GetNearPoint(me, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 5.0f, target->GetAngle(me));
|
||||
me->GetMotionMaster()->MovePoint(POINT_START_REVIVE, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ void hyjalAI::WaypointReached(uint32 waypointId, uint32 /*pathId*/)
|
||||
(*itr)->GetMotionMaster()->Initialize();
|
||||
float range = 10;
|
||||
if (me->GetEntry() == THRALL)range = 20;
|
||||
me->GetNearPoint(me, x, y, z, range, 0, me->GetAngle((*itr)));
|
||||
me->GetNearPoint(nullptr, x, y, z, range, me->GetAngle((*itr)));
|
||||
(*itr)->GetMotionMaster()->MovePoint(0, x+irand(-5, 5), y+irand(-5, 5), me->GetPositionZ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ class boss_altairus : public CreatureScript
|
||||
{
|
||||
boss_altairusAI(Creature* creature) : BossAI(creature, DATA_ALTAIRUS)
|
||||
{
|
||||
// me->SetHover(true);
|
||||
// me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
me->SetHover(true);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* /*target*/) override
|
||||
|
||||
@@ -104,8 +104,8 @@ Position const ToCCommonLoc[] =
|
||||
{ 550.955933f, 195.338888f, 395.14f, 0 }, // 4 - Left
|
||||
{ 563.833008f, 195.244995f, 394.585561f, 0 }, // 5 - Center
|
||||
{ 573.5f, 180.5f, 395.14f, 0 }, // 6 Move 0 Right
|
||||
{ 553.5f, 180.5f, 395.14f, 0 }, // 7 Move 0 Left
|
||||
{ 573.0f, 170.0f, 395.14f, 0 }, // 8 Move 1 Right
|
||||
{ 553.5f, 180.5f, 400.5521f, 0 }, // 7 Move 0 Left
|
||||
{ 573.0f, 170.0f, 400.5521f, 0 }, // 8 Move 1 Right
|
||||
{ 555.5f, 170.0f, 395.14f, 0 }, // 9 Move 1 Left
|
||||
{ 563.8f, 216.1f, 395.1f, 0 }, // 10 Behind the door
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ class npc_coldflame : public CreatureScript
|
||||
{
|
||||
float ang = Position::NormalizeOrientation(pos.GetAngle(me));
|
||||
me->SetOrientation(ang);
|
||||
owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetCombatReach(), ang);
|
||||
owner->GetNearPoint2D(nullptr, pos.m_positionX, pos.m_positionY, 5.0f - owner->GetCombatReach(), ang);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -394,7 +394,7 @@ class npc_coldflame : public CreatureScript
|
||||
|
||||
float ang = Position::NormalizeOrientation(pos.GetAngle(target));
|
||||
me->SetOrientation(ang);
|
||||
owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetCombatReach(), ang);
|
||||
owner->GetNearPoint2D(nullptr, pos.m_positionX, pos.m_positionY, 15.0f - owner->GetCombatReach(), ang);
|
||||
}
|
||||
|
||||
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
|
||||
|
||||
@@ -464,7 +464,7 @@ public:
|
||||
{
|
||||
Position pos;
|
||||
pos.m_positionZ = alexstraszaBunny->GetPositionZ();
|
||||
alexstraszaBunny->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 30.0f, alexstraszaBunny->GetAngle(me));
|
||||
alexstraszaBunny->GetNearPoint2D(nullptr, pos.m_positionX, pos.m_positionY, 30.0f, alexstraszaBunny->GetAngle(me));
|
||||
me->GetMotionMaster()->MoveLand(POINT_LAND_P_ONE, pos);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
@@ -849,7 +849,7 @@ public:
|
||||
Position randomPosOnRadius;
|
||||
// Hardcodded retail value, reason is Z getters can fail... (TO DO: Change to getter when height calculation works on 100%!)
|
||||
randomPosOnRadius.m_positionZ = 283.0521f;
|
||||
alexstraszaBunny->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 120.0f, alexstraszaBunny->GetAngle(me));
|
||||
alexstraszaBunny->GetNearPoint2D(nullptr, randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 120.0f, alexstraszaBunny->GetAngle(me));
|
||||
me->GetMotionMaster()->MovePoint(POINT_FLY_OUT_OF_PLATFORM_P_TWO, randomPosOnRadius);
|
||||
_flyingOutOfPlatform = true;
|
||||
}
|
||||
@@ -1675,7 +1675,7 @@ class spell_malygos_random_portal : public SpellScriptLoader
|
||||
{
|
||||
Position pos;
|
||||
pos.m_positionZ = target->GetPositionZ();
|
||||
target->GetNearPoint2D(pos.m_positionX, pos.m_positionY, frand(29.1f, 30.0f), target->GetAngle(malygos));
|
||||
target->GetNearPoint2D(nullptr, pos.m_positionX, pos.m_positionY, frand(29.1f, 30.0f), target->GetAngle(malygos));
|
||||
malygos->GetMotionMaster()->MovePoint(POINT_NEAR_RANDOM_PORTAL_P_NONE, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,9 +133,6 @@ enum Misc
|
||||
DATA_PHASE_3 = 1
|
||||
};
|
||||
|
||||
#define FLOOR_Z 427.28f
|
||||
#define FINAL_FLIGHT_Z 435.0f
|
||||
|
||||
class boss_steelbreaker : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -476,7 +473,7 @@ class boss_stormcaller_brundir : public CreatureScript
|
||||
_Reset();
|
||||
Initialize();
|
||||
me->RemoveAllAuras();
|
||||
me->SetDisableGravity(false);
|
||||
me->SetHover(false);
|
||||
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false); // Should be interruptable unless overridden by spell (Overload)
|
||||
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default
|
||||
}
|
||||
@@ -547,10 +544,6 @@ class boss_stormcaller_brundir : public CreatureScript
|
||||
if (Steelbreaker->IsAlive())
|
||||
Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
|
||||
}
|
||||
|
||||
// Prevent to have Brundir somewhere in the air when he die in Air phase
|
||||
if (me->GetPositionZ() > FLOOR_Z)
|
||||
me->GetMotionMaster()->MoveFall();
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* who) override
|
||||
@@ -598,9 +591,7 @@ class boss_stormcaller_brundir : public CreatureScript
|
||||
DoCast(me, SPELL_LIGHTNING_TENDRILS);
|
||||
DoCast(me, SPELL_LIGHTNING_TENDRILS_VISUAL);
|
||||
me->AttackStop();
|
||||
//me->SetLevitate(true);
|
||||
me->GetMotionMaster()->Initialize();
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FINAL_FLIGHT_Z);
|
||||
me->SetHover(true);
|
||||
events.DelayEvents(35000);
|
||||
events.ScheduleEvent(EVENT_FLIGHT, 2500);
|
||||
events.ScheduleEvent(EVENT_ENDFLIGHT, 32500);
|
||||
@@ -608,24 +599,22 @@ class boss_stormcaller_brundir : public CreatureScript
|
||||
break;
|
||||
case EVENT_FLIGHT:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
me->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), FINAL_FLIGHT_Z);
|
||||
me->GetMotionMaster()->MovePoint(0, *target);
|
||||
events.ScheduleEvent(EVENT_FLIGHT, 6000);
|
||||
break;
|
||||
case EVENT_ENDFLIGHT:
|
||||
me->GetMotionMaster()->Initialize();
|
||||
me->GetMotionMaster()->MovePoint(0, 1586.920166f, 119.848984f, FINAL_FLIGHT_Z);
|
||||
me->GetMotionMaster()->MovePoint(0, 1586.920166f, 119.848984f, me->GetPositionZ());
|
||||
events.CancelEvent(EVENT_FLIGHT);
|
||||
events.CancelEvent(EVENT_ENDFLIGHT);
|
||||
events.ScheduleEvent(EVENT_LAND, 4000);
|
||||
break;
|
||||
case EVENT_LAND:
|
||||
me->GetMotionMaster()->Initialize();
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FLOOR_Z);
|
||||
me->SetHover(false);
|
||||
events.CancelEvent(EVENT_LAND);
|
||||
events.ScheduleEvent(EVENT_GROUND, 2500);
|
||||
break;
|
||||
case EVENT_GROUND:
|
||||
//me->SetLevitate(false);
|
||||
me->RemoveAurasDueToSpell(sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHTNING_TENDRILS, me));
|
||||
me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_VISUAL);
|
||||
DoStartMovement(me->GetVictim());
|
||||
@@ -637,11 +626,11 @@ class boss_stormcaller_brundir : public CreatureScript
|
||||
{
|
||||
float x = float(irand(-25, 25));
|
||||
float y = float(irand(-25, 25));
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + x, me->GetPositionY() + y, FLOOR_Z);
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + x, me->GetPositionY() + y, me->GetPositionZ());
|
||||
// Prevention to go outside the room or into the walls
|
||||
if (Creature* trigger = me->FindNearestCreature(NPC_WORLD_TRIGGER, 100.0f, true))
|
||||
if (me->GetDistance(trigger) >= 50.0f)
|
||||
me->GetMotionMaster()->MovePoint(0, trigger->GetPositionX(), trigger->GetPositionY(), FLOOR_Z);
|
||||
me->GetMotionMaster()->MovePoint(0, *trigger);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_MOVE_POSITION, urand(7500, 10000));
|
||||
break;
|
||||
|
||||
@@ -613,7 +613,7 @@ class boss_mimiron : public CreatureScript
|
||||
{
|
||||
if (Creature* aerial = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)))
|
||||
{
|
||||
aerial->GetMotionMaster()->MoveLand(0, (aerial->GetPositionX(), aerial->GetPositionY(), aerial->GetPositionZMinusOffset()));
|
||||
aerial->GetMotionMaster()->MoveLand(0, (aerial->GetPositionX(), aerial->GetPositionY(), aerial->GetPositionZ()));
|
||||
aerial->SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, 0);
|
||||
aerial->CastSpell(vx001, SPELL_MOUNT_VX_001);
|
||||
aerial->CastSpell(aerial, SPELL_HALF_HEAL);
|
||||
@@ -1159,6 +1159,8 @@ class boss_aerial_command_unit : public CreatureScript
|
||||
case DO_START_AERIAL:
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
me->SetHover(true);
|
||||
me->SetDisableGravity(false);
|
||||
|
||||
events.SetPhase(PHASE_AERIAL_COMMAND_UNIT);
|
||||
events.ScheduleEvent(EVENT_SUMMON_JUNK_BOT, 5000, 0, PHASE_AERIAL_COMMAND_UNIT);
|
||||
|
||||
@@ -276,7 +276,7 @@ class npc_frozen_orb_stalker : public CreatureScript
|
||||
for (uint8 i = 0; i < num_orbs; ++i)
|
||||
{
|
||||
Position pos;
|
||||
me->GetNearPoint(toravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f);
|
||||
me->GetNearPoint(toravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 10.0f, 0.0f);
|
||||
me->SetPosition(pos);
|
||||
DoCast(me, SPELL_FROZEN_ORB_SUMMON);
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ class npc_frostbrood_skytalon : public CreatureScript
|
||||
{
|
||||
Position randomPosOnRadius;
|
||||
randomPosOnRadius.m_positionZ = (me->GetPositionZ() + 40.0f);
|
||||
me->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 40.0f, me->GetAngle(me));
|
||||
me->GetNearPoint2D(nullptr, randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 40.0f, me->GetAngle(me));
|
||||
me->GetMotionMaster()->MovePoint(POINT_FLY_AWAY, randomPosOnRadius);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
void InitializeAI() override
|
||||
{
|
||||
float x, y, z;
|
||||
me->GetNearPoint(me, x, y, z, 1, 100.0f, frand(0.f, 2.f * float(M_PI)));
|
||||
me->GetNearPoint(me, x, y, z, 100.0f, frand(0.f, 2.f * float(M_PI)));
|
||||
me->GetMotionMaster()->MovePoint(0, x, y, z);
|
||||
DoCastSelf(SPELL_MOLTEN_FLAME, true);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
ground = me->GetMap()->GetHeight(me->GetPhaseShift(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZMinusOffset());
|
||||
ground = me->GetMap()->GetHeight(me->GetPhaseShift(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
|
||||
SummonInfernal();
|
||||
events.ScheduleEvent(EVENT_CAST_SUMMON_INFERNAL, urand(1000, 3000));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user