<commit_before>/*
 * ArcScript Scripts for Arcemu MMORPG Server
 * Copyright (C) 2008 Arcemu Team
 * Copyright (C) 2007 Moon++ <http://www.moonplusplus.com/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "StdAfx.h"
#include "Setup.h"
#include "Base.h"

/************************************************************************/
/* Instance_HellfireRamparts.cpp Script		                            */
/************************************************************************/

// Watchkeeper GargolmarAI

enum WatchkeeperGargolmarData
{
    CN_WATCHKEEPER_GARGOLMAR = 17306,
    CN_HELLFIRE_WATCHER = 17309,
    SPELL_SURGE = 34645,
    SPELL_MORTAL_WOUND = 30641,
    SPELL_RETATLIATION = 22857
};

class WatchkeeperGargolmarAI : public ArcScriptBossAI
{
    ARCSCRIPT_FACTORY_FUNCTION(WatchkeeperGargolmarAI, ArcScriptBossAI);
    WatchkeeperGargolmarAI(Creature* pCreature) : ArcScriptBossAI(pCreature)
    {
        AddSpell(SPELL_MORTAL_WOUND, Target_Current, 95, 0, RandomUInt(5, 13));
        AddSpell(SPELL_SURGE, Target_RandomPlayerNotCurrent, 95, 0, RandomUInt(5, 13), 0, 0, false, "Back off, pup!", Text_Yell, 10330);
        AddSpell(SPELL_RETATLIATION, Target_Self, 95, 0, 30);
    };

    void OnCombatStart(Unit* pTarget)
    {
        switch (RandomUInt(2))
        {
        case 0:
            _unit->SendScriptTextChatMessage(4873);     // What have we here?
            break;
        case 1:
            _unit->SendScriptTextChatMessage(4874);     // This may hurt a little....
            break;
        case 2:
            _unit->SendScriptTextChatMessage(4875);     // I'm going to enjoy this...
            break;
        }
    }

    void OnTargetDied(Unit* pTarget)
    {
        switch (RandomUInt(1))
        {
        case 0:
            _unit->SendScriptTextChatMessage(4876);     // Say farewell!
            break;
        case 1:
            _unit->SendScriptTextChatMessage(4877);     // Much too easy.
            break;
        }
    }

    void OnDied(Unit* mKiller)
    {
        _unit->SendScriptTextChatMessage(4878);      // Hahah.. <cough> ..argh!
    }

    void OnLoad()
    {
        RegisterAIUpdateEvent(1000);
    }

    void AIUpdate()
    {
        if (_unit->GetInRangePlayersCount() <= 1 && _introSpeech == false)
        {
            Emote("Do you smell that? Fresh meat has somehow breached our citadel. Be wary of any intruders.", Text_Yell, 0);
            _introSpeech = true;
            RemoveAIUpdateEvent();
        }
        if (_unit->GetHealthPct() <= 40 && GetPhase() == 1)
        {
            Emote("Heal me, quickly!", Text_Yell, 10329);
            HellfireWatcher->CastSpell(_unit, 12039, false);
            SetPhase(2);
        }
    }
protected:
    bool _introSpeech = false;
    Unit* HellfireWatcher = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), CN_HELLFIRE_WATCHER);
};

// Omor the UnscarredAI

enum OmorData
{
    CN_OMOR_THE_UNSCARRED = 17308,
    OMOR_DEMONIC_SHIELD = 31901,
    OMOR_SUMMON_FIENDISH_HOUND = 30707,
    OMOR_SHADOW_WHIP = 30638,
    OMOR_SHADOW_BOLT = 30686,
    OMOR_SHADOW_BOLT2 = 39297,
    OMOR_TREACHEROUS_AURA = 30695,
    OMOR_BANE_OF_TREACHERY = 37566
};
class OmorTheUnscarredAI : public ArcScriptCreatureAI
{
public:
    ARCSCRIPT_FACTORY_FUNCTION(OmorTheUnscarredAI, ArcScriptCreatureAI);<commit_msg>Scripts/Instances: fix crash reported by player<commit_after>/*
 * ArcScript Scripts for Arcemu MMORPG Server
 * Copyright (C) 2008 Arcemu Team
 * Copyright (C) 2007 Moon++ <http://www.moonplusplus.com/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "StdAfx.h"
#include "Setup.h"
#include "Base.h"

/************************************************************************/
/* Instance_HellfireRamparts.cpp Script		                            */
/************************************************************************/

// Watchkeeper GargolmarAI

enum WatchkeeperGargolmarData
{
    CN_WATCHKEEPER_GARGOLMAR = 17306,
    CN_HELLFIRE_WATCHER = 17309,
    SPELL_SURGE = 34645,
    SPELL_MORTAL_WOUND = 30641,
    SPELL_RETATLIATION = 22857
};

class WatchkeeperGargolmarAI : public ArcScriptBossAI
{
    ARCSCRIPT_FACTORY_FUNCTION(WatchkeeperGargolmarAI, ArcScriptBossAI);
    WatchkeeperGargolmarAI(Creature* pCreature) : ArcScriptBossAI(pCreature)
    {
        AddSpell(SPELL_MORTAL_WOUND, Target_Current, 95, 0, RandomUInt(5, 13));
        AddSpell(SPELL_SURGE, Target_RandomPlayerNotCurrent, 95, 0, RandomUInt(5, 13), 0, 0, false, "Back off, pup!", Text_Yell, 10330);
        AddSpell(SPELL_RETATLIATION, Target_Self, 95, 0, 30);
    };

    void OnCombatStart(Unit* pTarget)
    {
        switch (RandomUInt(2))
        {
        case 0:
            _unit->SendScriptTextChatMessage(4873);     // What have we here?
            break;
        case 1:
            _unit->SendScriptTextChatMessage(4874);     // This may hurt a little....
            break;
        case 2:
            _unit->SendScriptTextChatMessage(4875);     // I'm going to enjoy this...
            break;
        }
    }

    void OnTargetDied(Unit* pTarget)
    {
        switch (RandomUInt(1))
        {
        case 0:
            _unit->SendScriptTextChatMessage(4876);     // Say farewell!
            break;
        case 1:
            _unit->SendScriptTextChatMessage(4877);     // Much too easy.
            break;
        }
    }

    void OnDied(Unit* mKiller)
    {
        _unit->SendScriptTextChatMessage(4878);      // Hahah.. <cough> ..argh!
    }

    void OnLoad()
    {
        RegisterAIUpdateEvent(1000);
    }

    void AIUpdate()
    {
        if (_unit->GetInRangePlayersCount() <= 1 && _introSpeech == false)
        {
            Emote("Do you smell that? Fresh meat has somehow breached our citadel. Be wary of any intruders.", Text_Yell, 0);
            _introSpeech = true;
            RemoveAIUpdateEvent();
        }
        if (_unit->GetHealthPct() <= 40 && GetPhase() == 1)
        {
            Emote("Heal me, quickly!", Text_Yell, 10329);
            SetPhase(2);
            if (HellfireWatcher && HellfireWatcher->isAlive())
                HellfireWatcher->CastSpell(_unit, 12039, false);
        }
    }
protected:
    bool _introSpeech = false;
    Unit* HellfireWatcher = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), CN_HELLFIRE_WATCHER);
};

// Omor the UnscarredAI

enum OmorData
{
    CN_OMOR_THE_UNSCARRED = 17308,
    OMOR_DEMONIC_SHIELD = 31901,
    OMOR_SUMMON_FIENDISH_HOUND = 30707,
    OMOR_SHADOW_WHIP = 30638,
    OMOR_SHADOW_BOLT = 30686,
    OMOR_SHADOW_BOLT2 = 39297,
    OMOR_TREACHEROUS_AURA = 30695,
    OMOR_BANE_OF_TREACHERY = 37566
};
class OmorTheUnscarredAI : public ArcScriptCreatureAI
{
public:
    ARCSCRIPT_FACTORY_FUNCTION(OmorTheUnscarredAI, ArcScriptCreatureAI);
{'fraction_non_alphanumeric': 0.1304508956145769, 'fraction_numerical': 0.03705991352686844, 'mean_word_length': 2.786716557530402, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2889101', 'n_tokens_mistral': 2867, 'n_tokens_neox': 2550, 'n_words': 623}