fix(Core/Creature): Prevent combat movement disabled creatures from r… (#18428)

* fix(Core/Creature): Prevent combat movement disabled creatures from repositioning if target moves within model boundary

* fixbuild

* Apply suggestions from code review
This commit is contained in:
Andrew
2024-02-27 10:11:39 -03:00
committed by GitHub
parent b2e2cbfc13
commit 6df652a8dd
32 changed files with 71 additions and 74 deletions
@@ -45,7 +45,7 @@ struct boss_quartermaster_zigris : public BossAI
void Reset() override
{
_Reset();
SetCombatMovement(false);
me->SetCombatMovement(false);
_hasDrunkPotion = false;
}
@@ -120,11 +120,11 @@ struct boss_quartermaster_zigris : public BossAI
{
DoCastVictim(SPELL_SHOOT);
me->GetMotionMaster()->Clear();
SetCombatMovement(false);
me->SetCombatMovement(false);
}
else if (!me->IsWithinLOSInMap(me->GetVictim()))
{
SetCombatMovement(true);
me->SetCombatMovement(true);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveChase(me->GetVictim());
}
@@ -359,7 +359,7 @@ public:
Talk(SAY_GAMESBEGIN_2);
DoCast(me, SPELL_NEFARIANS_BARRIER);
SetCombatMovement(false);
me->SetCombatMovement(false);
me->SetImmuneToPC(false);
AttackStart(SelectTarget(SelectTargetMethod::Random, 0, 200.f, true));
events.ScheduleEvent(EVENT_SHADOWBLINK, 500ms);
@@ -159,7 +159,7 @@ struct boss_dorothee : public ScriptedAI
{
boss_dorothee(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
//this is kinda a big no-no. but it will prevent her from moving to chase targets. she should just cast her spells. in this case, since there is not really something to LOS her with or get out of range this would work. but a more elegant solution would be better
instance = creature->GetInstanceScript();
@@ -123,7 +123,7 @@ struct boss_jeklik : public BossAI
me->SetDisableGravity(false);
me->SetReactState(REACT_PASSIVE);
BossAI::SetCombatMovement(false);
BossAI::me->SetCombatMovement(false);
batRidersCount = 0;
DoCastSelf(SPELL_GREEN_CHANNELING, true);
@@ -148,7 +148,7 @@ struct boss_jeklik : public BossAI
BossAI::PathEndReached(pathId);
me->SetDisableGravity(false);
SetCombatMovement(true);
me->SetCombatMovement(true);
me->SetReactState(REACT_AGGRESSIVE);
//
@@ -2168,7 +2168,7 @@ public:
{
boss_blight_wormAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
void Reset() override
@@ -134,7 +134,7 @@ public:
{
npc_andorhal_towerAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
void MoveInLineOfSight(Unit* who) override
@@ -1411,7 +1411,7 @@ public:
{
alliance_riflemanAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
uint32 ExplodeTimer;
@@ -84,7 +84,7 @@ struct boss_ayamiss : public BossAI
void Reset() override
{
BossAI::Reset();
SetCombatMovement(false);
me->SetCombatMovement(false);
me->SetReactState(REACT_AGGRESSIVE);
ScheduleHealthCheckEvent(70, [&] {
@@ -127,7 +127,7 @@ struct boss_ayamiss : public BossAI
}
else if (type == WAYPOINT_MOTION_TYPE && id == POINT_GROUND)
{
SetCombatMovement(true);
me->SetCombatMovement(true);
me->SetDisableGravity(false);
me->m_Events.AddEventAtOffset([this]()
@@ -188,7 +188,7 @@ struct npc_buru_egg : public ScriptedAI
npc_buru_egg(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
SetCombatMovement(false);
me->SetCombatMovement(false);
me->SetReactState(REACT_PASSIVE);
me->SetControlled(true, UNIT_STATE_STUNNED);
}
@@ -147,7 +147,7 @@ struct boss_eye_of_cthun : public BossAI
{
boss_eye_of_cthun(Creature* creature) : BossAI(creature, DATA_CTHUN)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
me->m_SightDistance = 90.f;
}
@@ -377,7 +377,7 @@ struct boss_cthun : public BossAI
{
boss_cthun(Creature* creature) : BossAI(creature, DATA_CTHUN)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
void Reset() override
@@ -597,7 +597,7 @@ struct npc_eye_tentacle : public ScriptedAI
}
}
SetCombatMovement(false);
me->SetCombatMovement(false);
}
void JustDied(Unit* /*killer*/) override
@@ -651,7 +651,7 @@ struct npc_claw_tentacle : public ScriptedAI
{
npc_claw_tentacle(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
if (Creature* portal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
@@ -720,7 +720,7 @@ struct npc_giant_claw_tentacle : public ScriptedAI
{
npc_giant_claw_tentacle(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
if (Creature* portal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
@@ -870,7 +870,7 @@ struct npc_giant_eye_tentacle : public ScriptedAI
{
npc_giant_eye_tentacle(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
if (Creature* portal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
@@ -106,7 +106,7 @@ struct boss_ouro : public BossAI
{
boss_ouro(Creature* creature) : BossAI(creature, DATA_OURO)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
me->SetControlled(true, UNIT_STATE_ROOT);
}
@@ -366,7 +366,7 @@ struct npc_toxic_slime : public ScriptedAI
void InitializeAI() override
{
SetCombatMovement(false);
me->SetCombatMovement(false);
DoCastSelf(SPELL_TOXIN);
InstanceScript* instance = me->GetInstanceScript();
+1 -1
View File
@@ -99,7 +99,7 @@ public:
{
npc_tiger_matriarch_creditAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
events.ScheduleEvent(EVENT_CHECK_SUMMON_AURA, 2s);
}
@@ -235,7 +235,7 @@ struct npc_amanitar_mushrooms : public ScriptedAI
{
npc_amanitar_mushrooms(Creature* pCreature) : ScriptedAI(pCreature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
//TODO: this prolly needs to be done in database
pCreature->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
@@ -295,7 +295,7 @@ struct boss_jedoga_shadowseeker : public BossAI
{
if (!ritualTriggered && me->HealthBelowPctDamaged(55, damage) && events.IsInPhase(PHASE_NORMAL))
{
SetCombatMovement(false);
me->SetCombatMovement(false);
me->InterruptNonMeleeSpells(false);
me->AttackStop();
me->SetReactState(REACT_PASSIVE);
@@ -368,7 +368,7 @@ struct boss_jedoga_shadowseeker : public BossAI
me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL);
me->RemoveAurasDueToSpell(SPELL_LIGHTNING_BOLTS);
me->RemoveAurasDueToSpell(SPELL_HOVER_FALL);
SetCombatMovement(true);
me->SetCombatMovement(true);
me->SetDisableGravity(false);
me->SetHover(false);
@@ -606,14 +606,14 @@ struct boss_jormungarAI : public ScriptedAI
if( bIsStationary )
{
me->SetNativeDisplayId(_MODEL_MOBILE);
SetCombatMovement(true);
me->SetCombatMovement(true);
if( Unit* victim = me->GetVictim() )
me->GetMotionMaster()->MoveChase(victim);
}
else
{
me->SetNativeDisplayId(_MODEL_STATIONARY);
SetCombatMovement(false);
me->SetCombatMovement(false);
}
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
me->CastSpell(me, SPELL_EMERGE_0, false);
@@ -692,7 +692,7 @@ public:
_MODEL_STATIONARY = MODEL_ACIDMAW_STATIONARY;
_MODEL_MOBILE = MODEL_ACIDMAW_MOBILE;
_TYPE_OTHER = TYPE_DREADSCALE;
SetCombatMovement(false);
me->SetCombatMovement(false);
}
};
@@ -1525,7 +1525,7 @@ public:
{
boss_yoggsaron_crusher_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
me->CastSpell(me, SPELL_CRUSH, true);
me->CastSpell(me, SPELL_FOCUSED_ANGER, true);
me->CastSpell(me, SPELL_DIMINISH_POWER, false);
@@ -1587,7 +1587,7 @@ public:
{
boss_yoggsaron_corruptor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
void DoAction(int32 param) override
@@ -1644,7 +1644,7 @@ public:
{
boss_yoggsaron_constrictor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
_checkTimer = 1;
_playerGUID.Clear();
}
@@ -1049,7 +1049,7 @@ public:
{
npc_warmage_coldarraAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
uint32 m_uiTimer; //Timer until recast
@@ -147,7 +147,7 @@ struct npc_warmage_violetstand : public ScriptedAI
{
npc_warmage_violetstand(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
ObjectGuid targetGUID;
@@ -1532,7 +1532,7 @@ public:
{
npc_guardian_pavilionAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
void MoveInLineOfSight(Unit* who) override
@@ -1596,7 +1596,7 @@ public:
{
npc_tournament_training_dummyAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
}
@@ -1816,7 +1816,7 @@ public:
PhaseCount = 0;
Summons.DespawnAll();
SetCombatMovement(false);
me->SetCombatMovement(false);
}
EventMap events;
@@ -57,7 +57,7 @@ struct boss_murmur : public BossAI
{
boss_murmur(Creature* creature) : BossAI(creature, DATA_MURMUR)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
@@ -98,7 +98,7 @@ struct boss_ahune : public ScriptedAI
{
boss_ahune(Creature* c) : ScriptedAI(c), summons(me)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
SetEquipmentSlots(false, 54806, EQUIP_UNEQUIP, EQUIP_UNEQUIP);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
InvokerGUID.Clear();
@@ -41,7 +41,7 @@ struct boss_omor_the_unscarred : public BossAI
{
boss_omor_the_unscarred(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
@@ -90,7 +90,7 @@ struct boss_alar : public BossAI
boss_alar(Creature* creature) : BossAI(creature, DATA_ALAR)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
}
void JustReachedHome() override
+2 -2
View File
@@ -334,7 +334,7 @@ public:
{
npc_training_dummyAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); //imune to knock aways like blast wave
}
@@ -392,7 +392,7 @@ public:
{
npc_target_dummyAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
me->SetCombatMovement(false);
deathTimer = 15000;
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); //imune to knock aways like blast wave
}