forked from insider42/scriptdev2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththunder_bluff.cpp
More file actions
134 lines (113 loc) · 4.15 KB
/
thunder_bluff.cpp
File metadata and controls
134 lines (113 loc) · 4.15 KB
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
/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.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 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Thunder_Bluff
SD%Complete: 100
SDComment: Quest support: 925
SDCategory: Thunder Bluff
EndScriptData */
#include "precompiled.h"
/*#####
# npc_cairne_bloodhoof
######*/
#define SPELL_BERSERKER_CHARGE 16636
#define SPELL_CLEAVE 16044
#define SPELL_MORTAL_STRIKE 16856
#define SPELL_THUNDERCLAP 23931
#define SPELL_UPPERCUT 22916
//TODO: verify abilities/timers
struct MANGOS_DLL_DECL npc_cairne_bloodhoofAI : public ScriptedAI
{
npc_cairne_bloodhoofAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
uint32 BerserkerCharge_Timer;
uint32 Cleave_Timer;
uint32 MortalStrike_Timer;
uint32 Thunderclap_Timer;
uint32 Uppercut_Timer;
void Reset()
{
BerserkerCharge_Timer = 30000;
Cleave_Timer = 5000;
MortalStrike_Timer = 10000;
Thunderclap_Timer = 15000;
Uppercut_Timer = 10000;
}
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (BerserkerCharge_Timer < diff)
{
Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0);
if (target)
DoCastSpellIfCan(target,SPELL_BERSERKER_CHARGE);
BerserkerCharge_Timer = 25000;
}else BerserkerCharge_Timer -= diff;
if (Uppercut_Timer < diff)
{
DoCastSpellIfCan(m_creature->getVictim(),SPELL_UPPERCUT);
Uppercut_Timer = 20000;
}else Uppercut_Timer -= diff;
if (Thunderclap_Timer < diff)
{
DoCastSpellIfCan(m_creature->getVictim(),SPELL_THUNDERCLAP);
Thunderclap_Timer = 15000;
}else Thunderclap_Timer -= diff;
if (MortalStrike_Timer < diff)
{
DoCastSpellIfCan(m_creature->getVictim(),SPELL_MORTAL_STRIKE);
MortalStrike_Timer = 15000;
}else MortalStrike_Timer -= diff;
if (Cleave_Timer < diff)
{
DoCastSpellIfCan(m_creature->getVictim(),SPELL_CLEAVE);
Cleave_Timer = 7000;
}else Cleave_Timer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_npc_cairne_bloodhoof(Creature* pCreature)
{
return new npc_cairne_bloodhoofAI(pCreature);
}
bool GossipHello_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
if (pPlayer->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I know this is rather silly but a young ward who is a bit shy would like your hoofprint.", GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO);
pPlayer->SEND_GOSSIP_MENU(7013, pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
if (uiAction == GOSSIP_SENDER_INFO)
{
pPlayer->CastSpell(pPlayer, 23123, false);
pPlayer->SEND_GOSSIP_MENU(7014, pCreature->GetGUID());
}
return true;
}
void AddSC_thunder_bluff()
{
Script *newscript;
newscript = new Script;
newscript->Name = "npc_cairne_bloodhoof";
newscript->GetAI = &GetAI_npc_cairne_bloodhoof;
newscript->pGossipHello = &GossipHello_npc_cairne_bloodhoof;
newscript->pGossipSelect = &GossipSelect_npc_cairne_bloodhoof;
newscript->RegisterSelf();
}