Core/Movement: first part of porting the new creature hover handling

This commit is contained in:
Ovahlord committed 2019-02-18 01:52:15 +01:00
1 parent 50a91bd590
commit eb15db4522
25 files changed
+144 -167

No files matched your search

@@ -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);
}
}