From 9eceff2bc243946998c006418229dbb639e898d6 Mon Sep 17 00:00:00 2001 From: Teleqraph Date: Sun, 22 Oct 2023 11:24:48 +0200 Subject: Core/Map: Implement several difficulty getters (#29370) Co-authored-by: ModoX --- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 36 +++++++++++++++++++++- src/server/game/AI/ScriptedAI/ScriptedCreature.h | 14 ++++----- 2 files changed, 42 insertions(+), 8 deletions(-) (limited to 'src/server/game/AI/ScriptedAI') diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index ad12f677884..00c15509f5a 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -126,7 +126,6 @@ ScriptedAI::ScriptedAI(Creature* creature) : ScriptedAI(creature, creature->GetS ScriptedAI::ScriptedAI(Creature* creature, uint32 scriptId) : CreatureAI(creature, scriptId), IsFleeing(false), _isCombatMovementAllowed(true) { - _isHeroic = me->GetMap()->IsHeroic(); _difficulty = me->GetMap()->GetDifficultyID(); } @@ -304,6 +303,41 @@ bool ScriptedAI::HealthAbovePct(uint32 pct) const return me->HealthAbovePct(pct); } +bool ScriptedAI::IsLFR() const +{ + return me->GetMap()->IsLFR(); +} + +bool ScriptedAI::IsNormal() const +{ + return me->GetMap()->IsNormal(); +} + +bool ScriptedAI::IsHeroic() const +{ + return me->GetMap()->IsHeroic(); +} + +bool ScriptedAI::IsMythic() const +{ + return me->GetMap()->IsMythic(); +} + +bool ScriptedAI::IsMythicPlus() const +{ + return me->GetMap()->IsMythicPlus(); +} + +bool ScriptedAI::IsHeroicOrHigher() const +{ + return me->GetMap()->IsHeroicOrHigher(); +} + +bool ScriptedAI::IsTimewalking() const +{ + return me->GetMap()->IsTimewalking(); +} + SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, float rangeMin, float rangeMax, SelectEffect effect) { // No target so we can't cast diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index bcb0496ec36..a52b33b0dcc 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -237,12 +237,13 @@ struct TC_GAME_API ScriptedAI : public CreatureAI void SetCombatMovement(bool allowMovement); bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; } - // return true for heroic mode. i.e. - // - for dungeon in mode 10-heroic, - // - for raid in mode 10-Heroic - // - for raid in mode 25-heroic - // DO NOT USE to check raid in mode 25-normal. - bool IsHeroic() const { return _isHeroic; } + bool IsLFR() const; + bool IsNormal() const; + bool IsHeroic() const; + bool IsMythic() const; + bool IsMythicPlus() const; + bool IsHeroicOrHigher() const; + bool IsTimewalking() const; // return the dungeon or raid difficulty Difficulty GetDifficulty() const { return _difficulty; } @@ -305,7 +306,6 @@ struct TC_GAME_API ScriptedAI : public CreatureAI private: Difficulty _difficulty; bool _isCombatMovementAllowed; - bool _isHeroic; }; class TC_GAME_API BossAI : public ScriptedAI -- cgit v1.2.3