aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms/TheStockade/boss_hogger.cpp
blob: 48704d899b84168ffaec69facb92515ea9076f32 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
 * 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/>.
 */

#include "MotionMaster.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "the_stockade.h"

enum Says
{
    SAY_PULL       = 0, // Forest just setback!
    SAY_ENRAGE     = 1, // AreaTriggerMessage: Hogger Enrages!
    SAY_DEATH      = 2, // Yiipe!

    SAY_WARDEN_1   = 0, // Yell - This ends here, Hogger!
    SAY_WARDEN_2   = 1, // Say - He's...he's dead?
    SAY_WARDEN_3   = 2  // Say - It's simply too good to be true. You couldn't have killed him so easily!
};

enum Spells
{
    SPELL_VICIOUS_SLICE     = 86604,
    SPELL_MADDENING_CALL    = 86620,
    SPELL_ENRAGE            = 86736
};

enum Events
{
    EVENT_VICIOUS_SLICE = 1,
    EVENT_MADDENING_CALL,

    EVENT_SAY_WARDEN_1,
    EVENT_SAY_WARDEN_2,
    EVENT_SAY_WARDEN_3
};

enum Points
{
    POINT_FINISH = 1
};

Position const wardenThelwaterMovePoint = { 152.019f, 106.198f, -35.1896f, 1.082104f };
Position const wardenThelwaterSpawnPosition = { 138.369f, 78.2932f, -33.85627f, 1.082104f };

// Hogger - 46254
struct boss_hogger : public BossAI
{
    boss_hogger(Creature* creature) : BossAI(creature, DATA_HOGGER), _hasEnraged(false) { }

    void Reset() override
    {
        _hasEnraged = false;
    }

    void JustEngagedWith(Unit* who) override
    {
        BossAI::JustEngagedWith(who);

        Talk(SAY_PULL);

        events.ScheduleEvent(EVENT_VICIOUS_SLICE, 3s, 4s);
        events.ScheduleEvent(EVENT_MADDENING_CALL, 1s, 2s);
    }

    void JustDied(Unit* killer) override
    {
        BossAI::JustDied(killer);

        Talk(SAY_DEATH);

        me->SummonCreature(NPC_WARDEN_THELWATER, wardenThelwaterSpawnPosition);
    }

    void JustSummoned(Creature* summon) override
    {
        BossAI::JustSummoned(summon);

        if (summon->GetEntry() == NPC_WARDEN_THELWATER)
            summon->GetMotionMaster()->MovePoint(POINT_FINISH, wardenThelwaterMovePoint);
    }

    void ExecuteEvent(uint32 eventId) override
    {
        switch (eventId)
        {
            case EVENT_VICIOUS_SLICE:
                DoCastVictim(SPELL_VICIOUS_SLICE);
                events.Repeat(10s, 14s);
                break;
            case EVENT_MADDENING_CALL:
                DoCast(SPELL_MADDENING_CALL);
                events.Repeat(15s, 20s);
                break;
            default:
                break;
        }
    }

    void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
    {
        if (me->HealthBelowPctDamaged(30, damage) && !_hasEnraged)
        {
            _hasEnraged = true;

            Talk(SAY_ENRAGE);
            DoCastSelf(SPELL_ENRAGE);
        }
    }

private:
    bool _hasEnraged;
};

// Warden Thelwater - 46409
struct npc_warden_thelwater : public ScriptedAI
{
    npc_warden_thelwater(Creature* creature) : ScriptedAI(creature) { }

    void MovementInform(uint32 type, uint32 id) override
    {
        if (type != POINT_MOTION_TYPE)
            return;

        if (id == POINT_FINISH)
        {
            scheduler.Schedule(1s, [this](TaskContext /*context*/)
            {
                Talk(SAY_WARDEN_1);
            });

            scheduler.Schedule(5s, [this](TaskContext /*context*/)
            {
                Talk(SAY_WARDEN_2);
            });

            scheduler.Schedule(8s, [this](TaskContext /*context*/)
            {
                Talk(SAY_WARDEN_3);
            });
        }
    }

    void UpdateAI(const uint32 diff) override
    {
        scheduler.Update(diff);
    }

private:
    TaskScheduler scheduler;
};

void AddSC_boss_hogger()
{
    RegisterStormwindStockadesAI(boss_hogger);
    RegisterStormwindStockadesAI(npc_warden_thelwater);
}