aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
blob: bdacd1ba34c0c4e4b81a272f999c8e37f3f1d141 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
 *
 * 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 2 of the License, or (at your
 * option) 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/>.
 */

/* ScriptData
SDName: Boss_Ironaya
SD%Complete: 100
SDComment:
SDCategory: Uldaman
EndScriptData */

#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "uldaman.h"

enum Ironaya
{
    SPELL_ARCINGSMASH           = 8374,
    SPELL_KNOCKAWAY             = 10101,
    SPELL_WSTOMP                = 11876
};

struct boss_ironaya : public BossAI
{
    boss_ironaya(Creature* creature) : BossAI(creature, BOSS_IRONAYA)
    {
        Initialize();
    }

    void Initialize()
    {
        _hasCastKnockaway = false;
        _hasCastWstomp = false;
    }

    void Reset() override
    {
        _Reset();
        Initialize();
    }

    void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
    {
        if (!_hasCastKnockaway && HealthBelowPct(50) && me->GetVictim())
        {
            _hasCastKnockaway = true;
            DoCastVictim(SPELL_KNOCKAWAY, true);
            ResetThreat(me->GetVictim(), me);
        }

        if (!_hasCastWstomp && HealthBelowPct(25))
        {
            _hasCastWstomp = true;
            DoCastSelf(SPELL_WSTOMP);
        }
    }

    void JustEngagedWith(Unit* who) override
    {
        _JustEngagedWith(who);
        scheduler.Schedule(3s, [this](TaskContext task)
        {
            DoCastSelf(SPELL_ARCINGSMASH);
            task.Repeat(13s);
        });
    }

    void UpdateAI(uint32 diff) override
    {
        if (!UpdateVictim())
            return;

        scheduler.Update(diff);
    }

private:
    bool _hasCastKnockaway;
    bool _hasCastWstomp;
};

//This is the actual function called only once durring InitScripts()
//It must define all handled functions that are to be run in this script
void AddSC_boss_ironaya()
{
    RegisterUldamanCreatureAI(boss_ironaya);
}