mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
fix(Scripts/AlteracValley): Crashfix. (#10976)
* fix(Scripts/AlteracValley): Crashfix. * Update.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BattlegroundAV.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
@@ -77,6 +78,11 @@ SpellPair const _auraPairs[MAX_SPELL_PAIRS] =
|
||||
{ NPC_ICEBLOOD_WARMASTER, SPELL_ICEBLOOD_WARMASTER }
|
||||
};
|
||||
|
||||
enum Factions
|
||||
{
|
||||
FACTION_AV_ALLIANCE = 1534
|
||||
};
|
||||
|
||||
class npc_av_marshal_or_warmaster : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -104,6 +110,46 @@ public:
|
||||
Reset();
|
||||
}
|
||||
|
||||
void AttackStart(Unit* victim) override
|
||||
{
|
||||
ScriptedAI::AttackStart(victim);
|
||||
|
||||
// Boss should attack as well
|
||||
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
|
||||
{
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
{
|
||||
if (Creature* mainBoss = bg->GetBGCreature((me->GetFaction() == FACTION_AV_ALLIANCE ? AV_CPLACE_A_BOSS : AV_CPLACE_H_BOSS)))
|
||||
{
|
||||
if (mainBoss->IsAIEnabled && !mainBoss->GetVictim())
|
||||
{
|
||||
mainBoss->AI()->AttackStart(victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode() override
|
||||
{
|
||||
ScriptedAI::EnterEvadeMode();
|
||||
|
||||
// Evade boss
|
||||
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
|
||||
{
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
{
|
||||
if (Creature* mainBoss = bg->GetBGCreature((me->GetFaction() == FACTION_AV_ALLIANCE ? AV_CPLACE_A_BOSS : AV_CPLACE_H_BOSS)))
|
||||
{
|
||||
if (mainBoss->IsAIEnabled && !mainBoss->IsInEvadeMode())
|
||||
{
|
||||
mainBoss->AI()->EnterEvadeMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
// I have a feeling this isn't blizzlike, but owell, I'm only passing by and cleaning up.
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BattlegroundAV.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
@@ -75,6 +76,52 @@ public:
|
||||
Talk(YELL_RESPAWN);
|
||||
}
|
||||
|
||||
void AttackStart(Unit* victim) override
|
||||
{
|
||||
ScriptedAI::AttackStart(victim);
|
||||
|
||||
// Mini bosses should attack as well
|
||||
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
|
||||
{
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
{
|
||||
for (uint8 i = AV_CPLACE_H_MARSHAL_ICE; i <= AV_CPLACE_H_MARSHAL_WTOWER; ++i)
|
||||
{
|
||||
if (Creature* marshall = bg->GetBGCreature(i))
|
||||
{
|
||||
if (marshall->IsAIEnabled && !marshall->GetVictim())
|
||||
{
|
||||
marshall->AI()->AttackStart(victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode() override
|
||||
{
|
||||
ScriptedAI::EnterEvadeMode();
|
||||
|
||||
// Evade mini bosses
|
||||
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
|
||||
{
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
{
|
||||
for (uint8 i = AV_CPLACE_H_MARSHAL_ICE; i <= AV_CPLACE_H_MARSHAL_WTOWER; ++i)
|
||||
{
|
||||
if (Creature* marshall = bg->GetBGCreature(i))
|
||||
{
|
||||
if (marshall->IsAIEnabled && !marshall->IsInEvadeMode())
|
||||
{
|
||||
marshall->AI()->EnterEvadeMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BattlegroundAV.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
@@ -64,6 +65,52 @@ public:
|
||||
Talk(YELL_AGGRO);
|
||||
}
|
||||
|
||||
void AttackStart(Unit* victim) override
|
||||
{
|
||||
ScriptedAI::AttackStart(victim);
|
||||
|
||||
// Mini bosses should attack as well
|
||||
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
|
||||
{
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
{
|
||||
for (uint8 i = AV_CPLACE_A_MARSHAL_SOUTH; i <= AV_CPLACE_A_MARSHAL_STONE; ++i)
|
||||
{
|
||||
if (Creature* marshall = bg->GetBGCreature(i))
|
||||
{
|
||||
if (marshall->IsAIEnabled && !marshall->GetVictim())
|
||||
{
|
||||
marshall->AI()->AttackStart(victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode() override
|
||||
{
|
||||
ScriptedAI::EnterEvadeMode();
|
||||
|
||||
// Evade mini bosses
|
||||
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
|
||||
{
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
{
|
||||
for (uint8 i = AV_CPLACE_A_MARSHAL_SOUTH; i <= AV_CPLACE_A_MARSHAL_STONE; ++i)
|
||||
{
|
||||
if (Creature* marshall = bg->GetBGCreature(i))
|
||||
{
|
||||
if (marshall->IsAIEnabled && !marshall->IsInEvadeMode())
|
||||
{
|
||||
marshall->AI()->EnterEvadeMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
|
||||
Reference in New Issue
Block a user