-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathdragonblight.cpp
More file actions
209 lines (174 loc) · 6.45 KB
/
dragonblight.cpp
File metadata and controls
209 lines (174 loc) · 6.45 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/* This file is part of the ScriptDev2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Dragonblight
SD%Complete: 100
SDComment: Quest support: 12075, 12166, 12261.
SDCategory: Dragonblight
EndScriptData */
/* ContentData
npc_destructive_ward
npc_crystalline_ice_giant
EndContentData */
#include "precompiled.h"
/*######
# npc_destructive_ward
#####*/
enum
{
SAY_WARD_POWERUP = -1000664,
SAY_WARD_CHARGED = -1000665,
SPELL_DESTRUCTIVE_PULSE = 48733,
SPELL_DESTRUCTIVE_BARRAGE = 48734,
SPELL_DESTRUCTIVE_WARD_POWERUP = 48735,
SPELL_SUMMON_SMOLDERING_SKELETON = 48715,
SPELL_SUMMON_SMOLDERING_CONSTRUCT = 48718,
SPELL_DESTRUCTIVE_WARD_KILL_CREDIT = 52409,
MAX_STACK = 1,
};
// Script is based on real event from you-know-where.
// Some sources show the event in a bit different way, for unknown reason.
// Devs decided to add it in the below way, until more details can be obtained.
// It will be only two power-up's, where other sources has a different count (2-4 stacks has been observed)
// Probably caused by either a change in a patch (bugfix?) or the powerup has a condition (some
// sources suggest this, but without any explanation about what this might be)
struct npc_destructive_wardAI : public Scripted_NoMovementAI
{
npc_destructive_wardAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature)
{
m_uiPowerTimer = 30000;
m_uiStack = 0;
m_uiSummonTimer = 2000;
m_bCanPulse = false;
m_bFirst = true;
Reset();
}
uint32 m_uiPowerTimer;
uint32 m_uiStack;
uint32 m_uiSummonTimer;
bool m_bFirst;
bool m_bCanPulse;
void Reset() override { }
void JustSummoned(Creature* pSummoned) override
{
pSummoned->AI()->AttackStart(m_creature);
}
void UpdateAI(const uint32 uiDiff) override
{
if (m_bCanPulse)
{
if (DoCastSpellIfCan(m_creature, m_uiStack > MAX_STACK ? SPELL_DESTRUCTIVE_BARRAGE : SPELL_DESTRUCTIVE_PULSE) == CAST_OK)
m_bCanPulse = false;
}
if (m_uiSummonTimer)
{
if (m_uiSummonTimer <= uiDiff)
{
if (m_bFirst)
m_uiSummonTimer = 25000;
else
m_uiSummonTimer = 0;
switch (m_uiStack)
{
case 0:
DoCastSpellIfCan(m_creature, SPELL_SUMMON_SMOLDERING_SKELETON, CAST_TRIGGERED);
break;
case 1:
DoCastSpellIfCan(m_creature, SPELL_SUMMON_SMOLDERING_CONSTRUCT, CAST_TRIGGERED);
if (m_bFirst)
break;
DoCastSpellIfCan(m_creature, SPELL_SUMMON_SMOLDERING_CONSTRUCT, CAST_TRIGGERED);
break;
case 2:
if (m_bFirst)
break;
DoCastSpellIfCan(m_creature, SPELL_SUMMON_SMOLDERING_SKELETON, CAST_TRIGGERED);
DoCastSpellIfCan(m_creature, SPELL_SUMMON_SMOLDERING_SKELETON, CAST_TRIGGERED);
DoCastSpellIfCan(m_creature, SPELL_SUMMON_SMOLDERING_CONSTRUCT, CAST_TRIGGERED);
break;
}
m_bFirst = !m_bFirst;
}
else
m_uiSummonTimer -= uiDiff;
}
if (!m_uiPowerTimer)
return;
if (m_uiPowerTimer <= uiDiff)
{
if (m_uiStack > MAX_STACK)
{
if (DoCastSpellIfCan(m_creature, SPELL_DESTRUCTIVE_WARD_KILL_CREDIT) == CAST_OK)
{
DoScriptText(SAY_WARD_CHARGED, m_creature, m_creature->GetOwner());
m_uiPowerTimer = 0;
m_uiSummonTimer = 0;
m_bCanPulse = true;
}
}
else if (DoCastSpellIfCan(m_creature, SPELL_DESTRUCTIVE_WARD_POWERUP) == CAST_OK)
{
DoScriptText(SAY_WARD_POWERUP, m_creature, m_creature->GetOwner());
m_uiPowerTimer = 30000;
m_uiSummonTimer = 2000;
m_bFirst = true;
m_bCanPulse = true; // pulse right after each charge
++m_uiStack;
}
}
else
m_uiPowerTimer -= uiDiff;
}
};
CreatureAI* GetAI_npc_destructive_ward(Creature* pCreature)
{
return new npc_destructive_wardAI(pCreature);
}
/*######
## npc_crystalline_ice_giant
######*/
enum
{
SPELL_FEIGN_DEATH_PERMANENT = 31261,
ITEM_ID_SAMPLE_ROCKFLESH = 36765,
NPC_CRYSTALLINE_GIANT = 26809,
};
bool NpcSpellClick_npc_crystalline_ice_giant(Player* pPlayer, Creature* pClickedCreature, uint32 /*uiSpellId*/)
{
if (pClickedCreature->GetEntry() == NPC_CRYSTALLINE_GIANT && pClickedCreature->HasAura(SPELL_FEIGN_DEATH_PERMANENT))
{
if (Item* pItem = pPlayer->StoreNewItemInInventorySlot(ITEM_ID_SAMPLE_ROCKFLESH, 1))
{
pPlayer->SendNewItem(pItem, 1, true, false);
pClickedCreature->ForcedDespawn();
// always return true when handled special npc spell click
return true;
}
}
return true;
}
void AddSC_dragonblight()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "npc_destructive_ward";
pNewScript->GetAI = &GetAI_npc_destructive_ward;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "npc_crystalline_ice_giant";
pNewScript->pNpcSpellClick = &NpcSpellClick_npc_crystalline_ice_giant;
pNewScript->RegisterSelf();
}