| 1 | /* |
|---|
| 2 | * ArcScripts for ArcEmu MMORPG Server |
|---|
| 3 | * Copyright (C) 2009 ArcEmu Team <http://www.arcemu.org/> |
|---|
| 4 | * Copyright (C) 2008-2009 Sun++ Team <http://www.sunscripting.com/> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software: you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation, either version 3 of the License, or |
|---|
| 9 | * any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #include "StdAfx.h" |
|---|
| 21 | #include "Setup.h" |
|---|
| 22 | #include "../Common/Base.h" |
|---|
| 23 | #include "../Common/Instance_Base.h" |
|---|
| 24 | |
|---|
| 25 | class GrandWidowFaerlinaAI; |
|---|
| 26 | class AnubRekhanAI; |
|---|
| 27 | class DeathchargerSteedAI; |
|---|
| 28 | class PlaguedWarriorAI; |
|---|
| 29 | class PlaguedChampionAI; |
|---|
| 30 | class PlaguedGuardianAI; |
|---|
| 31 | class PlagueFissureGO; |
|---|
| 32 | class SporeAI; |
|---|
| 33 | class PortalOfShadowsAI; |
|---|
| 34 | class DeathKnightUnderstudyAI; |
|---|
| 35 | |
|---|
| 36 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 37 | ////// The Arachnid Quarter |
|---|
| 38 | |
|---|
| 39 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 40 | ////// Carrion Spinner |
|---|
| 41 | #define CN_CARRION_SPINNER 15975 |
|---|
| 42 | #define CARRION_SPINNER_POISON_BOLT_NORMAL 30043 |
|---|
| 43 | #define CARRION_SPINNER_POISON_BOLT_HEROIC 56032 |
|---|
| 44 | #define CARRION_SPINNER_WEB_WRAP 28618 // TODO: PULL EFFECT *FUN* |
|---|
| 45 | |
|---|
| 46 | class CarrionSpinnerAI : public MoonScriptCreatureAI |
|---|
| 47 | { |
|---|
| 48 | MOONSCRIPT_FACTORY_FUNCTION( CarrionSpinnerAI, MoonScriptCreatureAI ); |
|---|
| 49 | CarrionSpinnerAI( Creature* pCreature ); |
|---|
| 50 | |
|---|
| 51 | void Destroy(); |
|---|
| 52 | }; |
|---|
| 53 | |
|---|
| 54 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 55 | ////// Dread Creeper |
|---|
| 56 | #define CN_DREAD_CREEPER 15974 |
|---|
| 57 | #define DREAD_CREEPER_VEIL_OF_SHADOW_NORMAL 53803 |
|---|
| 58 | #define DREAD_CREEPER_VEIL_OF_SHADOW_HEROIC 28440 |
|---|
| 59 | |
|---|
| 60 | class DreadCreeperAI : public MoonScriptCreatureAI |
|---|
| 61 | { |
|---|
| 62 | MOONSCRIPT_FACTORY_FUNCTION( DreadCreeperAI, MoonScriptCreatureAI ); |
|---|
| 63 | DreadCreeperAI( Creature* pCreature ); |
|---|
| 64 | |
|---|
| 65 | void Destroy(); |
|---|
| 66 | }; |
|---|
| 67 | |
|---|
| 68 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 69 | ////// Naxxramas Cultist |
|---|
| 70 | #define CN_NAXXRAMAS_CULTIST 15980 |
|---|
| 71 | #define NAXXRAMAS_CULTIST_KNOCKBACK_NORMAL 53850 |
|---|
| 72 | #define NAXXRAMAS_CULTIST_KNOCKBACK_HEROIC 53851 |
|---|
| 73 | |
|---|
| 74 | class NaxxramasCultistAI : public MoonScriptCreatureAI |
|---|
| 75 | { |
|---|
| 76 | MOONSCRIPT_FACTORY_FUNCTION( NaxxramasCultistAI, MoonScriptCreatureAI ); |
|---|
| 77 | NaxxramasCultistAI( Creature* pCreature ); |
|---|
| 78 | |
|---|
| 79 | void Destroy(); |
|---|
| 80 | }; |
|---|
| 81 | //Necro Stalker AI - was it removed ? |
|---|
| 82 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 83 | ////// Venom Stalker |
|---|
| 84 | #define CN_VENOM_STALKER 15976 |
|---|
| 85 | #define VENOM_STALKER_POISON_CHARGE_NORMAL 28431 |
|---|
| 86 | #define VENOM_STALKER_POISON_CHARGE_HEROIC 53809 |
|---|
| 87 | |
|---|
| 88 | class VenomStalkerAI : public MoonScriptCreatureAI |
|---|
| 89 | { |
|---|
| 90 | MOONSCRIPT_FACTORY_FUNCTION( VenomStalkerAI, MoonScriptCreatureAI ); |
|---|
| 91 | VenomStalkerAI( Creature* pCreature ); |
|---|
| 92 | |
|---|
| 93 | void Destroy(); |
|---|
| 94 | }; |
|---|
| 95 | |
|---|
| 96 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 97 | ////// Tomb Horror |
|---|
| 98 | #define CN_TOMB_HORROR 15979 |
|---|
| 99 | #define TOMB_HORROR_SPIKE_VOLLEY 28615 |
|---|
| 100 | #define TOMB_HORROR_CRYPT_SCARAB_SWARM_NORMAL 54313 |
|---|
| 101 | #define TOMB_HORROR_CRYPT_SCARAB_SWARM_HEROIC 54317 |
|---|
| 102 | #define TOMB_HORROR_CRYPT_SCARABS_NORMAL 54311 |
|---|
| 103 | #define TOMB_HORROR_CRYPT_SCARABS_HEROIC 54316 |
|---|
| 104 | |
|---|
| 105 | class TombHorrorAI : public MoonScriptCreatureAI |
|---|
| 106 | { |
|---|
| 107 | MOONSCRIPT_FACTORY_FUNCTION( TombHorrorAI, MoonScriptCreatureAI ); |
|---|
| 108 | TombHorrorAI( Creature* pCreature ); |
|---|
| 109 | |
|---|
| 110 | void Destroy(); |
|---|
| 111 | }; |
|---|
| 112 | |
|---|
| 113 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 114 | ////// Naxxramas Acolyte |
|---|
| 115 | #define CN_NAXXRAMAS_ACOLYTE 16368 |
|---|
| 116 | #define NAXXRAMAS_ACOLYTE_SHADOW_BOLT_VOLLEY_NORMAL 56064 |
|---|
| 117 | #define NAXXRAMAS_ACOLYTE_SHADOW_BOLT_VOLLEY_HEROIC 56065 |
|---|
| 118 | #define NAXXRAMAS_ACOLYTE_ARCANE_EXPLOSION_NORMAL 56063 |
|---|
| 119 | #define NAXXRAMAS_ACOLYTE_ARCANE_EXPLOSION_HEROIC 56067 |
|---|
| 120 | // To check: "total caster" + Explosion only when players are close ? |
|---|
| 121 | class NaxxramasAcolyteAI : public MoonScriptCreatureAI |
|---|
| 122 | { |
|---|
| 123 | MOONSCRIPT_FACTORY_FUNCTION( NaxxramasAcolyteAI, MoonScriptCreatureAI ); |
|---|
| 124 | NaxxramasAcolyteAI( Creature* pCreature ); |
|---|
| 125 | |
|---|
| 126 | void Destroy(); |
|---|
| 127 | }; |
|---|
| 128 | |
|---|
| 129 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 130 | ////// Vigilant Shade |
|---|
| 131 | #define CN_VIGILANT_SHADE 30085 |
|---|
| 132 | #define VIGILANT_SHADE_INVISIBILITY 55848 |
|---|
| 133 | #define VIGILANT_SHADE_SHADOW_BOLT_VOLLEY_NORMAL 55850 |
|---|
| 134 | #define VIGILANT_SHADE_SHADOW_BOLT_VOLLEY_HEROIC 55851 |
|---|
| 135 | // Invisiblity should be removed OnCombatStart ? |
|---|
| 136 | class VigilantShadeAI : public MoonScriptCreatureAI |
|---|
| 137 | { |
|---|
| 138 | MOONSCRIPT_FACTORY_FUNCTION( VigilantShadeAI, MoonScriptCreatureAI ); |
|---|
| 139 | VigilantShadeAI( Creature* pCreature ); |
|---|
| 140 | |
|---|
| 141 | void OnCombatStart( Unit* pTarget ); |
|---|
| 142 | void OnCombatStop( Unit* pTarget ); |
|---|
| 143 | void Destroy(); |
|---|
| 144 | }; |
|---|
| 145 | |
|---|
| 146 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 147 | ////// Crypt Reaver |
|---|
| 148 | #define CN_CRYPT_REAVER 15978 |
|---|
| 149 | #define CRYPT_REAVER_CLEAVE 40504 |
|---|
| 150 | #define CRYPT_REAVER_FRENZY 56625 |
|---|
| 151 | |
|---|
| 152 | class CryptReaverAI : public MoonScriptCreatureAI |
|---|
| 153 | { |
|---|
| 154 | MOONSCRIPT_FACTORY_FUNCTION( CryptReaverAI, MoonScriptCreatureAI ); |
|---|
| 155 | CryptReaverAI( Creature* pCreature ); |
|---|
| 156 | |
|---|
| 157 | void Destroy(); |
|---|
| 158 | }; |
|---|
| 159 | |
|---|
| 160 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 161 | ////// Web Wrap |
|---|
| 162 | #define CN_WEB_WRAP 16486 |
|---|
| 163 | |
|---|
| 164 | class WebWrapAI : public MoonScriptCreatureAI |
|---|
| 165 | { |
|---|
| 166 | MOONSCRIPT_FACTORY_FUNCTION( WebWrapAI, MoonScriptCreatureAI ); |
|---|
| 167 | WebWrapAI( Creature* pCreature ); |
|---|
| 168 | |
|---|
| 169 | void OnCombatStart( Unit* pTarget ); |
|---|
| 170 | void OnCombatStop( Unit* pTarget ); |
|---|
| 171 | void OnDied( Unit* pKiller ); |
|---|
| 172 | void AIUpdate(); |
|---|
| 173 | void Destroy(); |
|---|
| 174 | |
|---|
| 175 | uint64 mPlayerGuid; |
|---|
| 176 | }; |
|---|
| 177 | |
|---|
| 178 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 179 | ////// Maexxna Spiderling |
|---|
| 180 | #define CN_MAEXXNA_SPIDERLING 17055 |
|---|
| 181 | #define MAEXXNA_SPIDERLING_NECROTIC_POISON_NORMAL 54121 |
|---|
| 182 | #define MAEXXNA_SPIDERLING_NECROTIC_POISON_HEROIC 28776 |
|---|
| 183 | |
|---|
| 184 | class MaexxnaSpiderlingAI : public MoonScriptCreatureAI |
|---|
| 185 | { |
|---|
| 186 | MOONSCRIPT_FACTORY_FUNCTION( MaexxnaSpiderlingAI, MoonScriptCreatureAI ); |
|---|
| 187 | MaexxnaSpiderlingAI( Creature* pCreature ); |
|---|
| 188 | |
|---|
| 189 | void Destroy(); |
|---|
| 190 | }; |
|---|
| 191 | |
|---|
| 192 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 193 | ////// Maexxna |
|---|
| 194 | #define CN_MAEXXNA 15952 |
|---|
| 195 | #define MAEXXNA_WEB_WRAP 28622 |
|---|
| 196 | #define MAEXXNA_WEB_SPRAY_NORMAL 29484 |
|---|
| 197 | #define MAEXXNA_WEB_SPRAY_HEROIC 54125 |
|---|
| 198 | #define MAEXXNA_POISON_SHOCK_NORMAL 28741 |
|---|
| 199 | #define MAEXXNA_POISON_SHOCK_HEROIC 54122 |
|---|
| 200 | #define MAEXXNA_NECROTIC_POISON_NORMAL 54121 |
|---|
| 201 | #define MAEXXNA_NECROTIC_POISON_HEROIC 28776 |
|---|
| 202 | #define MAEXXNA_FRENZY_NORMAL 54123 |
|---|
| 203 | #define MAEXXNA_FRENZY_HEROIC 54124 |
|---|
| 204 | |
|---|
| 205 | static Coords WebWrapPos[] = |
|---|
| 206 | { |
|---|
| 207 | // Left wall |
|---|
| 208 | { 3515.307861f, -3837.076172f, 302.671753f, 4.388477f, 0 }, |
|---|
| 209 | { 3529.401123f, -3841.910889f, 300.766174f, 4.335070f, 0 }, |
|---|
| 210 | { 3541.990479f, -3851.308350f, 298.685272f, 3.804141f, 0 }, |
|---|
| 211 | // Right wall |
|---|
| 212 | { 3497.262939f, -3949.542969f, 308.138916f, 1.433983f, 0 }, |
|---|
| 213 | { 3510.450928f, -3949.871582f, 309.523193f, 1.613839f, 0 }, |
|---|
| 214 | { 3523.486572f, -3946.144287f, 309.651611f, 1.973552f, 0 } |
|---|
| 215 | }; |
|---|
| 216 | |
|---|
| 217 | void SpellFunc_MaexxnaWebWrap( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 218 | |
|---|
| 219 | class MaexxnaAI : public MoonScriptBossAI |
|---|
| 220 | { |
|---|
| 221 | MOONSCRIPT_FACTORY_FUNCTION( MaexxnaAI, MoonScriptBossAI ); |
|---|
| 222 | MaexxnaAI( Creature* pCreature ); |
|---|
| 223 | |
|---|
| 224 | void OnCombatStart( Unit* pTarget ); |
|---|
| 225 | void OnCombatStop( Unit* pTarget ); |
|---|
| 226 | void AIUpdate(); |
|---|
| 227 | void Destroy(); |
|---|
| 228 | |
|---|
| 229 | SpellDesc* mWebWrapProc; |
|---|
| 230 | bool mHasEnraged; |
|---|
| 231 | bool mLeftWall; |
|---|
| 232 | int32 mAddsSummonTimer; |
|---|
| 233 | int32 mWebSprayTimer; |
|---|
| 234 | int32 mWebWrapTimer; |
|---|
| 235 | }; |
|---|
| 236 | |
|---|
| 237 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 238 | ////// Naxxramas Worshipper |
|---|
| 239 | #define CN_NAXXRAMAS_WORSHIPPER 16506 |
|---|
| 240 | #define NAXXRAMAS_WORSHIPPER_FIREBALL_NORMAL 54095 |
|---|
| 241 | #define NAXXRAMAS_WORSHIPPER_FIREBALL_HEROIC 54096 |
|---|
| 242 | #define NAXXRAMAS_WORSHIPPER_WIDOW_EMBRACE 28732 |
|---|
| 243 | #define NAXXRAMAS_WORSHIPPER_MIND_EXHAUSTION 28727 |
|---|
| 244 | |
|---|
| 245 | class NaxxramasWorshipperAI : public MoonScriptCreatureAI |
|---|
| 246 | { |
|---|
| 247 | MOONSCRIPT_FACTORY_FUNCTION( NaxxramasWorshipperAI, MoonScriptCreatureAI ); |
|---|
| 248 | NaxxramasWorshipperAI( Creature* pCreature ); |
|---|
| 249 | friend class GrandWidowFaerlinaAI; |
|---|
| 250 | |
|---|
| 251 | void OnCastSpell( uint32 pSpellId ); |
|---|
| 252 | void OnDied( Unit* pKiller ); |
|---|
| 253 | void AIUpdate(); |
|---|
| 254 | void Destroy(); |
|---|
| 255 | |
|---|
| 256 | GrandWidowFaerlinaAI* mGrandWidow; |
|---|
| 257 | bool mPossessed; |
|---|
| 258 | }; |
|---|
| 259 | |
|---|
| 260 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 261 | ////// Naxxramas Follower |
|---|
| 262 | #define CN_NAXXRAMAS_FOLLOWER 16505 |
|---|
| 263 | #define NAXXRAMAS_FOLLOWER_BERSERKER_CHARGE_HEROIC 56107 |
|---|
| 264 | #define NAXXRAMAS_FOLLOWER_SILENCE_HEROIC 54093 |
|---|
| 265 | |
|---|
| 266 | void SpellFunc_NaxxramasFollowerCharge( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 267 | |
|---|
| 268 | class NaxxramasFollowerAI : public MoonScriptCreatureAI |
|---|
| 269 | { |
|---|
| 270 | MOONSCRIPT_FACTORY_FUNCTION( NaxxramasFollowerAI, MoonScriptCreatureAI ); |
|---|
| 271 | NaxxramasFollowerAI( Creature* pCreature ); |
|---|
| 272 | friend class GrandWidowFaerlinaAI; |
|---|
| 273 | |
|---|
| 274 | void Destroy(); |
|---|
| 275 | |
|---|
| 276 | GrandWidowFaerlinaAI* mGrandWidow; |
|---|
| 277 | SpellDesc* mCharge; |
|---|
| 278 | }; |
|---|
| 279 | |
|---|
| 280 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 281 | ////// Grand Widow Faerlina |
|---|
| 282 | #define CN_GRAND_WIDOW_FAERLINA 15953 |
|---|
| 283 | #define GRAND_WIDOW_FAERLINA_POISON_VOLLEY_BOLT_NORMAL 28796 |
|---|
| 284 | #define GRAND_WIDOW_FAERLINA_POISON_VOLLEY_BOLT_HEROIC 54098 |
|---|
| 285 | #define GRAND_WIDOW_FAERLINA_FRENZY_NORMAL 28798 |
|---|
| 286 | #define GRAND_WIDOW_FAERLINA_FRENZY_HEROIC 54100 |
|---|
| 287 | #define GRAND_WIDOW_RAIN_OF_FIRE_NORMAL 39024 |
|---|
| 288 | #define GRAND_WIDOW_RAIN_OF_FIRE_HEROIC 58936 |
|---|
| 289 | |
|---|
| 290 | static Coords Worshippers[ 4 ] = |
|---|
| 291 | { |
|---|
| 292 | { -3.0f, 0, 0, 0, 0 }, |
|---|
| 293 | { -9.0f, 0, 0, 0, 0 }, |
|---|
| 294 | { 3.0f, 0, 0, 0, 0 }, |
|---|
| 295 | { 9.0f, 0, 0, 0, 0 } |
|---|
| 296 | }; |
|---|
| 297 | |
|---|
| 298 | static Coords Followers[ 2 ] = |
|---|
| 299 | { |
|---|
| 300 | { -6.0f, 0, 0, 0, 0 }, |
|---|
| 301 | { 6.0f, 0, 0, 0, 0 } |
|---|
| 302 | }; |
|---|
| 303 | |
|---|
| 304 | class GrandWidowFaerlinaAI : public MoonScriptBossAI |
|---|
| 305 | { |
|---|
| 306 | MOONSCRIPT_FACTORY_FUNCTION( GrandWidowFaerlinaAI, MoonScriptBossAI ); |
|---|
| 307 | GrandWidowFaerlinaAI( Creature* pCreature ); |
|---|
| 308 | |
|---|
| 309 | void OnCombatStart( Unit* pTarget ); |
|---|
| 310 | void OnCombatStop( Unit* pTarget ); |
|---|
| 311 | void AIUpdate(); |
|---|
| 312 | void Destroy(); |
|---|
| 313 | |
|---|
| 314 | set< NaxxramasWorshipperAI* > mWorshippers; |
|---|
| 315 | set< NaxxramasFollowerAI* > mFollowers; |
|---|
| 316 | SpellDesc* mFrenzy; |
|---|
| 317 | SpellDesc* mPoisonVolleyBolt; |
|---|
| 318 | int32 mFrenzyTimer; |
|---|
| 319 | int32 mPoisonVolleyBoltTimer; |
|---|
| 320 | }; |
|---|
| 321 | |
|---|
| 322 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 323 | ////// Crypt Guard |
|---|
| 324 | #define CN_CRYPT_GUARD 16573 |
|---|
| 325 | #define CRYPT_GUARD_ACID_SPLIT_NORMAL 28969 |
|---|
| 326 | #define CRYPT_GUARD_ACID_SPLIT_HEROIC 56098 |
|---|
| 327 | #define CRYPT_GUARD_CLEAVE 40504 |
|---|
| 328 | #define CRYPT_GUARD_FRENZY 8269 |
|---|
| 329 | |
|---|
| 330 | class CryptGuardAI : public MoonScriptCreatureAI |
|---|
| 331 | { |
|---|
| 332 | MOONSCRIPT_FACTORY_FUNCTION( CryptGuardAI, MoonScriptCreatureAI ); |
|---|
| 333 | CryptGuardAI( Creature* pCreature ); |
|---|
| 334 | friend class AnubRekhanAI; |
|---|
| 335 | |
|---|
| 336 | void OnCombatStart( Unit* pTarget ); |
|---|
| 337 | void AIUpdate(); |
|---|
| 338 | void Destroy(); |
|---|
| 339 | |
|---|
| 340 | AnubRekhanAI* mAnubRekhanAI; |
|---|
| 341 | bool mEnraged; |
|---|
| 342 | }; |
|---|
| 343 | |
|---|
| 344 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 345 | ////// Corpse Scarab |
|---|
| 346 | #define CN_CORPSE_SCARAB 16698 |
|---|
| 347 | |
|---|
| 348 | class CorpseScarabAI : public MoonScriptCreatureAI |
|---|
| 349 | { |
|---|
| 350 | MOONSCRIPT_FACTORY_FUNCTION( CorpseScarabAI, MoonScriptCreatureAI ); |
|---|
| 351 | CorpseScarabAI( Creature* pCreature ); |
|---|
| 352 | friend class AnubRekhanAI; |
|---|
| 353 | |
|---|
| 354 | void Destroy(); |
|---|
| 355 | |
|---|
| 356 | AnubRekhanAI* mAnubRekhanAI; |
|---|
| 357 | }; |
|---|
| 358 | |
|---|
| 359 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 360 | ////// Anub'Rekhan |
|---|
| 361 | #define CN_ANUBREKHAN 15956 |
|---|
| 362 | #define ANUBREKHAN_IMPALE_NORMAL 28783 |
|---|
| 363 | #define ANUBREKHAN_IMPALE_HEROIC 56090 |
|---|
| 364 | #define ANUBREKHAN_LOCUST_SWARM_NORMAL 28785 |
|---|
| 365 | #define ANUBREKHAN_LOCUST_SWARM_HEROIC 54021 |
|---|
| 366 | #define ANUBREKHAN_SUMMON_CORPSE_SCARABS_5 29105 |
|---|
| 367 | #define ANUBREKHAN_SUMMON_CORPSE_SCARABS_10 28864 |
|---|
| 368 | #define ANUBREKHAN_BERSERK 26662 |
|---|
| 369 | |
|---|
| 370 | static Coords CryptGuards[] = |
|---|
| 371 | { |
|---|
| 372 | { 3300.486572f, -3449.479492f, 287.077850f, 3.883793f, 0 }, |
|---|
| 373 | { 3300.568604f, -3503.060059f, 287.077850f, 2.367975f, 0 }, |
|---|
| 374 | { 3332.591797f, -3476.102539f, 287.073425f, 0.015707f, 0 } |
|---|
| 375 | }; |
|---|
| 376 | |
|---|
| 377 | void SpellFunc_AnubRekhanCorpseScarabsPlayer( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 378 | void SpellFunc_AnubRekhanCorpseScarabsCryptGuard( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 379 | |
|---|
| 380 | class AnubRekhanAI : public MoonScriptBossAI |
|---|
| 381 | { |
|---|
| 382 | MOONSCRIPT_FACTORY_FUNCTION( AnubRekhanAI, MoonScriptBossAI ); |
|---|
| 383 | AnubRekhanAI( Creature* pCreature ); |
|---|
| 384 | |
|---|
| 385 | void OnCombatStart( Unit* pTarget ); |
|---|
| 386 | void OnCombatStop( Unit* pTarget ); |
|---|
| 387 | void AIUpdate(); |
|---|
| 388 | void Destroy(); |
|---|
| 389 | |
|---|
| 390 | set< CorpseScarabAI* > mScarabs; |
|---|
| 391 | set< CryptGuardAI* > mCryptGuards; |
|---|
| 392 | set< uint32 > mUsedCorpseGuids; |
|---|
| 393 | SpellDesc* mLocustSwarm; |
|---|
| 394 | int32 mLocustSwarmTimer; |
|---|
| 395 | int32 mCryptSpawnTimer; |
|---|
| 396 | }; |
|---|
| 397 | |
|---|
| 398 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 399 | ////// The Plague Quarter |
|---|
| 400 | |
|---|
| 401 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 402 | ////// Infectious Ghoul |
|---|
| 403 | #define CN_INFECTIOUS_GHOUL 16244 |
|---|
| 404 | #define INFECTIOUS_GHOUL_FLESH_ROT 54709 |
|---|
| 405 | #define INFECTIOUS_GHOUL_REND_NORMAL 54703 |
|---|
| 406 | #define INFECTIOUS_GHOUL_REND_HEROIC 54708 |
|---|
| 407 | #define INFECTIOUS_GHOUL_FRENZY_NORMAL 54701 |
|---|
| 408 | #define INFECTIOUS_GHOUL_FRENZY_HEROIC 24318 |
|---|
| 409 | |
|---|
| 410 | class InfectiousGhoulAI : public MoonScriptCreatureAI |
|---|
| 411 | { |
|---|
| 412 | MOONSCRIPT_FACTORY_FUNCTION( InfectiousGhoulAI, MoonScriptCreatureAI ); |
|---|
| 413 | InfectiousGhoulAI( Creature* pCreature ); |
|---|
| 414 | |
|---|
| 415 | void OnCombatStart( Unit* pTarget ); |
|---|
| 416 | void AIUpdate(); |
|---|
| 417 | void Destroy(); |
|---|
| 418 | |
|---|
| 419 | bool mEnraged; |
|---|
| 420 | }; |
|---|
| 421 | |
|---|
| 422 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 423 | ////// Stoneskin Gargoyle |
|---|
| 424 | #define CN_STONESKIN_GARGOYLE 16168 |
|---|
| 425 | #define STONESKIN_GARGOYLE_ACID_VOLLEY_NORMAL 29325 |
|---|
| 426 | #define STONESKIN_GARGOYLE_ACID_VOLLEY_HEROIC 54714 |
|---|
| 427 | #define STONESKIN_GARGOYLE_STONESKIN_NORMAL 28995 |
|---|
| 428 | #define STONESKIN_GARGOYLE_STONESKIN_HEROIC 54722 |
|---|
| 429 | |
|---|
| 430 | class StoneskinGargoyleAI : public MoonScriptCreatureAI |
|---|
| 431 | { |
|---|
| 432 | MOONSCRIPT_FACTORY_FUNCTION( StoneskinGargoyleAI, MoonScriptCreatureAI ); |
|---|
| 433 | StoneskinGargoyleAI( Creature* pCreature ); |
|---|
| 434 | |
|---|
| 435 | bool HasStoneskin(); |
|---|
| 436 | void AIUpdate(); |
|---|
| 437 | void Destroy(); |
|---|
| 438 | |
|---|
| 439 | SpellDesc* mStoneskin; |
|---|
| 440 | }; |
|---|
| 441 | |
|---|
| 442 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 443 | ////// Frenzied Bat |
|---|
| 444 | #define CN_FRENZIED_BAT 16036 |
|---|
| 445 | #define FRENZIED_BAT_FRENZIED_DIVE 54781 |
|---|
| 446 | |
|---|
| 447 | class FrenziedBatAI : public MoonScriptCreatureAI |
|---|
| 448 | { |
|---|
| 449 | MOONSCRIPT_FACTORY_FUNCTION( FrenziedBatAI, MoonScriptCreatureAI ); |
|---|
| 450 | FrenziedBatAI( Creature* pCreature ); |
|---|
| 451 | |
|---|
| 452 | void Destroy(); |
|---|
| 453 | }; |
|---|
| 454 | |
|---|
| 455 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 456 | ////// Plague Beast |
|---|
| 457 | #define CN_PLAGUE_BEAST 16034 |
|---|
| 458 | #define PLAGUE_BEAST_PLAGUE_SPLASH_NORMAL 54780 |
|---|
| 459 | #define PLAGUE_BEAST_PLAGUE_SPLASH_HEROIC 56538 |
|---|
| 460 | #define PLAGUE_BEAST_MUTATED_SPORES 30110 |
|---|
| 461 | #define PLAGUE_BEAST_TRAMPLE 5568 |
|---|
| 462 | |
|---|
| 463 | class PlagueBeastAI : public MoonScriptCreatureAI |
|---|
| 464 | { |
|---|
| 465 | MOONSCRIPT_FACTORY_FUNCTION( PlagueBeastAI, MoonScriptCreatureAI ); |
|---|
| 466 | PlagueBeastAI( Creature* pCreature ); |
|---|
| 467 | |
|---|
| 468 | void OnCombatStart( Unit* pTarget ); |
|---|
| 469 | void OnCombatStop( Unit* pTarget ); |
|---|
| 470 | void Destroy(); |
|---|
| 471 | }; |
|---|
| 472 | |
|---|
| 473 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 474 | ////// Eye Stalker |
|---|
| 475 | #define CN_EYE_STALKER 16236 |
|---|
| 476 | #define EYE_STALKER_MIND_FLAY_NORMAL 29407 |
|---|
| 477 | #define EYE_STALKER_MIND_FLAY_HEROIC 54805 |
|---|
| 478 | |
|---|
| 479 | class EyeStalkerAI : public MoonScriptCreatureAI |
|---|
| 480 | { |
|---|
| 481 | MOONSCRIPT_FACTORY_FUNCTION( EyeStalkerAI, MoonScriptCreatureAI ); |
|---|
| 482 | EyeStalkerAI( Creature* pCreature ); |
|---|
| 483 | |
|---|
| 484 | void OnCombatStart( Unit* pTarget ); |
|---|
| 485 | void AIUpdate(); |
|---|
| 486 | void Destroy(); |
|---|
| 487 | }; |
|---|
| 488 | |
|---|
| 489 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 490 | ////// Noth the Plaguebringer |
|---|
| 491 | #define CN_NOTH_THE_PLAGUEBRINGER 15954 |
|---|
| 492 | #define NOTH_THE_PLAGUEBRINGER_BLINK_HEROIC 29208 |
|---|
| 493 | #define NOTH_THE_PLAGUEBRINGER_CRIPLE_HEROIC 29212 |
|---|
| 494 | #define NOTH_THE_PLAGUEBRINGER_CURSE_OF_THE_PLAGUE_NORMAL 29213 // I must check if it's target-limited spell |
|---|
| 495 | #define NOTH_THE_PLAGUEBRINGER_CURSE_OF_THE_PLAGUE_HEROIC 54835 // I must check if it's target-limited spell |
|---|
| 496 | #define NOTH_THE_PLAGUEBRINGER_BERSERK 47008 // Guessed |
|---|
| 497 | |
|---|
| 498 | static Coords SkelPosPhase1[] = |
|---|
| 499 | { |
|---|
| 500 | { 2660.175781f, -3473.315674f, 262.003967f, 5.252077f, 0 }, |
|---|
| 501 | { 2717.336426f, -3463.309326f, 262.044098f, 3.703270f, 0 }, |
|---|
| 502 | { 2718.720215f, -3524.452881f, 261.943176f, 2.760789f, 0 } |
|---|
| 503 | }; |
|---|
| 504 | |
|---|
| 505 | static Coords SkelPosPhase2[] = |
|---|
| 506 | { |
|---|
| 507 | { 2660.932129f, -3474.058105f, 262.004730f, 5.765719f, 0 }, |
|---|
| 508 | { 2706.175537f, -3465.862793f, 262.003510f, 4.488667f, 0 }, |
|---|
| 509 | { 2723.024170f, -3472.919434f, 262.102020f, 3.809298f, 0 }, |
|---|
| 510 | { 2717.878906f, -3518.062988f, 261.905945f, 3.177050f, 0 } |
|---|
| 511 | }; |
|---|
| 512 | |
|---|
| 513 | void SpellFunc_NothToBalconyPhaseSwitch( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 514 | void SpellFunc_NothFromBalconyPhaseSwitch( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 515 | void SpellFunc_NothCriple( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 516 | void SpellFunc_NothBlink( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 517 | |
|---|
| 518 | class NothThePlaguebringerAI : public MoonScriptBossAI |
|---|
| 519 | { |
|---|
| 520 | MOONSCRIPT_FACTORY_FUNCTION( NothThePlaguebringerAI, MoonScriptBossAI ); |
|---|
| 521 | NothThePlaguebringerAI( Creature* pCreature ); |
|---|
| 522 | friend class PlaguedWarriorAI; |
|---|
| 523 | friend class PlaguedChampionAI; |
|---|
| 524 | friend class PlaguedGuardianAI; |
|---|
| 525 | |
|---|
| 526 | void OnCombatStart( Unit* pTarget ); |
|---|
| 527 | void OnCombatStop( Unit* pTarget ); |
|---|
| 528 | void AIUpdate(); |
|---|
| 529 | void Destroy(); |
|---|
| 530 | |
|---|
| 531 | set< PlaguedWarriorAI*> mWarriors; |
|---|
| 532 | set< PlaguedChampionAI*> mChampions; |
|---|
| 533 | set< PlaguedGuardianAI* > mGuardians; |
|---|
| 534 | SpellDesc* mCriple; |
|---|
| 535 | SpellDesc* mBlink; |
|---|
| 536 | SpellDesc* mToBalconySwitch; |
|---|
| 537 | SpellDesc* mFromBalconySwitch; |
|---|
| 538 | int32 mBlinkTimer; |
|---|
| 539 | int32 mSkeletonTimer; |
|---|
| 540 | int32 mPhaseSwitchTimer; |
|---|
| 541 | uint32 mPhaseCounter; |
|---|
| 542 | }; |
|---|
| 543 | |
|---|
| 544 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 545 | ////// Plagued Warrior |
|---|
| 546 | #define CN_PLAGUED_WARRIOR 16984 |
|---|
| 547 | #define PLAGUED_WARRIOR_STRIKE 12057 |
|---|
| 548 | #define PLAGUED_WARRIOR_CLEAVE 15496 |
|---|
| 549 | |
|---|
| 550 | class PlaguedWarriorAI : public MoonScriptCreatureAI |
|---|
| 551 | { |
|---|
| 552 | MOONSCRIPT_FACTORY_FUNCTION( PlaguedWarriorAI, MoonScriptCreatureAI ); |
|---|
| 553 | PlaguedWarriorAI( Creature* pCreature ); |
|---|
| 554 | |
|---|
| 555 | void Destroy(); |
|---|
| 556 | |
|---|
| 557 | NothThePlaguebringerAI* mNothAI; |
|---|
| 558 | }; |
|---|
| 559 | |
|---|
| 560 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 561 | ////// Plagued Champion |
|---|
| 562 | #define CN_PLAGUED_CHAMPION 16983 |
|---|
| 563 | #define PLAGUED_CHAMPION_MORTAL_STRIKE_NORMAL 32736 |
|---|
| 564 | #define PLAGUED_CHAMPION_MORTAL_STRIKE_HEROIC 13737 |
|---|
| 565 | #define PLAGUED_CHAMPION_SHADOW_SHOCK_NORMAL 30138 |
|---|
| 566 | #define PLAGUED_CHAMPION_SHADOW_SHOCK_HEROIC 54889 |
|---|
| 567 | |
|---|
| 568 | class PlaguedChampionAI : public MoonScriptCreatureAI |
|---|
| 569 | { |
|---|
| 570 | MOONSCRIPT_FACTORY_FUNCTION( PlaguedChampionAI, MoonScriptCreatureAI ); |
|---|
| 571 | PlaguedChampionAI( Creature* pCreature ); |
|---|
| 572 | |
|---|
| 573 | void Destroy(); |
|---|
| 574 | |
|---|
| 575 | NothThePlaguebringerAI* mNothAI; |
|---|
| 576 | }; |
|---|
| 577 | |
|---|
| 578 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 579 | ////// Plagued Guardian |
|---|
| 580 | #define CN_PLAGUED_GUARDIAN 16981 |
|---|
| 581 | #define PLAGUED_GUARDIAN_ARCANE_EXPLOSION_NORMAL 54890 |
|---|
| 582 | #define PLAGUED_GUARDIAN_ARCANE_EXPLOSION_HEROIC 54891 |
|---|
| 583 | #define PLAGUED_GUARDIAN_BLINK 29208 |
|---|
| 584 | |
|---|
| 585 | class PlaguedGuardianAI : public MoonScriptCreatureAI |
|---|
| 586 | { |
|---|
| 587 | MOONSCRIPT_FACTORY_FUNCTION( PlaguedGuardianAI, MoonScriptCreatureAI ); |
|---|
| 588 | PlaguedGuardianAI( Creature* pCreature ); |
|---|
| 589 | |
|---|
| 590 | void Destroy(); |
|---|
| 591 | |
|---|
| 592 | NothThePlaguebringerAI* mNothAI; |
|---|
| 593 | }; |
|---|
| 594 | |
|---|
| 595 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 596 | ////// Heigan the Unclean |
|---|
| 597 | #define CN_HEIGAN_THE_UNCLEAN 15936 |
|---|
| 598 | #define HEIGAN_THE_UNCLEAN_SPELL_DISRUPTION 29310 |
|---|
| 599 | #define HEIGAN_THE_UNCLEAN_DECREPIT_FEVER_NORMAL 29998 |
|---|
| 600 | #define HEIGAN_THE_UNCLEAN_DECREPIT_FEVER_HEROIC 55011 |
|---|
| 601 | #define HEIGAN_THE_UNCLEAN_PLAGUE_CLOUD_CHANNEL 29350 |
|---|
| 602 | #define HEIGAN_THE_UNCLEAN_PLAGUE_CLOUD_DAMAGE 30122 |
|---|
| 603 | #define HEIGAN_THE_UNCLEAN_TELEPORT 34673 // Guessed. |
|---|
| 604 | #define FISSURE_TRIGGER_ERUPTION 29371 |
|---|
| 605 | |
|---|
| 606 | float HeiganPos[2] = {2796, -3707}; |
|---|
| 607 | const float HeiganEruptionSlope[3] = |
|---|
| 608 | { |
|---|
| 609 | (-3685 - HeiganPos[1]) /(2724 - HeiganPos[0]), |
|---|
| 610 | (-3647 - HeiganPos[1]) /(2749 - HeiganPos[0]), |
|---|
| 611 | (-3637 - HeiganPos[1]) /(2771 - HeiganPos[0]), |
|---|
| 612 | }; |
|---|
| 613 | |
|---|
| 614 | class HeiganTheUncleanAI : public MoonScriptBossAI |
|---|
| 615 | { |
|---|
| 616 | MOONSCRIPT_FACTORY_FUNCTION( HeiganTheUncleanAI, MoonScriptBossAI ); |
|---|
| 617 | HeiganTheUncleanAI( Creature* pCreature ); |
|---|
| 618 | friend class PlagueFissureGO; |
|---|
| 619 | |
|---|
| 620 | uint32 CalculateTriggerArea( float pPosX, float pPosY ); |
|---|
| 621 | void CallEruptionEvent( int32 pTimerId, int32 pNewTime ); |
|---|
| 622 | void OnCombatStart( Unit* pTarget ); |
|---|
| 623 | void OnCombatStop( Unit* pTarget ); |
|---|
| 624 | void AIUpdate(); |
|---|
| 625 | void Destroy(); |
|---|
| 626 | |
|---|
| 627 | set< pair< uint32, PlagueFissureGO* > > mFissures; |
|---|
| 628 | int32 mPhaseSwitchTimer; |
|---|
| 629 | int32 mEruptionTimer; |
|---|
| 630 | int32 mEruptionPhase; |
|---|
| 631 | bool mClockWiseEruption; |
|---|
| 632 | }; |
|---|
| 633 | |
|---|
| 634 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 635 | ////// Plague Fissure |
|---|
| 636 | #define GO_PLAGUE_FISSURE 181533 |
|---|
| 637 | |
|---|
| 638 | class PlagueFissureGO : public GameObjectAIScript |
|---|
| 639 | { |
|---|
| 640 | public: |
|---|
| 641 | |
|---|
| 642 | static GameObjectAIScript* Create( GameObject* pGameObject ); |
|---|
| 643 | PlagueFissureGO( GameObject* pGameObject ); |
|---|
| 644 | |
|---|
| 645 | void DoErrupt(); |
|---|
| 646 | |
|---|
| 647 | // I believe it's nowhere hooked in the core. |
|---|
| 648 | void SetState( uint32 pState ); |
|---|
| 649 | void Destroy(); |
|---|
| 650 | |
|---|
| 651 | HeiganTheUncleanAI* mHeiganAI; |
|---|
| 652 | }; |
|---|
| 653 | |
|---|
| 654 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 655 | ////// Loatheb |
|---|
| 656 | #define CN_LOATHEB 16011 |
|---|
| 657 | #define LOATHEB_NECROTIC_AURA 55593 |
|---|
| 658 | #define LOATHEB_SUMMON_SPORE 29234 |
|---|
| 659 | #define LOATHEB_DEATHBLOOM_NORMAL 29865 |
|---|
| 660 | #define LOATHEB_DEATHBLOOM_HEROIC 55053 |
|---|
| 661 | #define LOATHEB_DEATHBLOOM_DAMAGE_NORMAL 55594 |
|---|
| 662 | #define LOATHEB_DEATHBLOOM_DAMAGE_HEROIC 55601 |
|---|
| 663 | #define LOATHEB_INEVITABLE_DOOM_NORMAL 29204 |
|---|
| 664 | #define LOATHEB_INEVITABLE_DOOM_HEROIC 55052 |
|---|
| 665 | #define LOATHEB_BERSERK 26662 // Unused |
|---|
| 666 | |
|---|
| 667 | static Coords Spores[] = |
|---|
| 668 | { |
|---|
| 669 | { 2880.517334f, -4027.450684f, 273.680695f, 0.848522f, 0 }, |
|---|
| 670 | { 2938.914307f, -4027.245850f, 273.617340f, 2.419318f, 0 }, |
|---|
| 671 | { 2938.526611f, -3968.206543f, 273.524963f, 3.829108f, 0 }, |
|---|
| 672 | { 2879.754883f, -3968.288574f, 273.633698f, 5.525566f, 0 } |
|---|
| 673 | }; |
|---|
| 674 | |
|---|
| 675 | class LoathebAI : public MoonScriptBossAI |
|---|
| 676 | { |
|---|
| 677 | MOONSCRIPT_FACTORY_FUNCTION( LoathebAI, MoonScriptBossAI ); |
|---|
| 678 | LoathebAI( Creature* pCreature ); |
|---|
| 679 | friend class SporeAI; |
|---|
| 680 | |
|---|
| 681 | void OnCombatStart( Unit* pTarget ); |
|---|
| 682 | void OnCombatStop( Unit* pTarget ); |
|---|
| 683 | void AIUpdate(); |
|---|
| 684 | void Destroy(); |
|---|
| 685 | |
|---|
| 686 | set< SporeAI* > mSpores; |
|---|
| 687 | uint32 mDoomStaticTimer; |
|---|
| 688 | int32 mSporeTimer; |
|---|
| 689 | int32 mDoomTimer; |
|---|
| 690 | int32 mDeathbloomTimer; |
|---|
| 691 | bool mDeathbloomDamagePhase; |
|---|
| 692 | }; |
|---|
| 693 | |
|---|
| 694 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 695 | ////// Spore |
|---|
| 696 | #define CN_SPORE 16286 |
|---|
| 697 | #define SPORE_FUNGAL_CREEP 29232 |
|---|
| 698 | |
|---|
| 699 | class SporeAI : public MoonScriptCreatureAI |
|---|
| 700 | { |
|---|
| 701 | MOONSCRIPT_FACTORY_FUNCTION( SporeAI, MoonScriptCreatureAI ); |
|---|
| 702 | SporeAI( Creature* pCreature ); |
|---|
| 703 | |
|---|
| 704 | void OnDied( Unit* pKiller ); |
|---|
| 705 | void Destroy(); |
|---|
| 706 | |
|---|
| 707 | LoathebAI* mLoathebAI; |
|---|
| 708 | }; |
|---|
| 709 | |
|---|
| 710 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 711 | ////// The Military Quarter |
|---|
| 712 | |
|---|
| 713 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 714 | ////// Death Knight |
|---|
| 715 | #define CN_DEATH_KNIGHT 16146 |
|---|
| 716 | #define DEATH_KNIGHT_BLOOD_PRESENCE 55212 |
|---|
| 717 | #define DEATH_KNIGHT_DEATH_COIL_NORMAL 55209 |
|---|
| 718 | #define DEATH_KNIGHT_DEATH_COIL_HEROIC 55320 |
|---|
| 719 | #define DEATH_KNIGHT_DEATH_COIL_HEAL 55210 |
|---|
| 720 | #define DEATH_KNIGHT_HYSTERIA 55213 |
|---|
| 721 | |
|---|
| 722 | class DeathKnightAI : public MoonScriptCreatureAI |
|---|
| 723 | { |
|---|
| 724 | MOONSCRIPT_FACTORY_FUNCTION( DeathKnightAI, MoonScriptCreatureAI ); |
|---|
| 725 | DeathKnightAI( Creature* pCreature ); |
|---|
| 726 | |
|---|
| 727 | void OnCombatStart( Unit* pTarget ); |
|---|
| 728 | void Destroy(); |
|---|
| 729 | }; |
|---|
| 730 | |
|---|
| 731 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 732 | ////// Death Knight Captain |
|---|
| 733 | #define CN_DEATH_KNIGHT_CAPTAIN 16145 |
|---|
| 734 | #define DEATH_KNIGHT_CAPTAIN_UNHOLY_PRESENCE 55222 |
|---|
| 735 | #define DEATH_KNIGHT_CAPTAIN_RAISE_DEAD 28353 |
|---|
| 736 | #define DEATH_KNIGHT_CAPTAIN_PLAGUE_STRIKE_NORMAL 55255 |
|---|
| 737 | #define DEATH_KNIGHT_CAPTAIN_PLAGUE_STRIKE_HEROIC 55321 |
|---|
| 738 | #define DEATH_KNIGHT_CAPTAIN_WHIRLWIND 28335 |
|---|
| 739 | |
|---|
| 740 | class DeathKnightCaptainAI : public MoonScriptCreatureAI |
|---|
| 741 | { |
|---|
| 742 | MOONSCRIPT_FACTORY_FUNCTION( DeathKnightCaptainAI, MoonScriptCreatureAI ); |
|---|
| 743 | DeathKnightCaptainAI( Creature* pCreature ); |
|---|
| 744 | |
|---|
| 745 | void OnCombatStart( Unit* pTarget ); |
|---|
| 746 | void Destroy(); |
|---|
| 747 | }; |
|---|
| 748 | |
|---|
| 749 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 750 | ////// Skeletal Construct - wiki says he's in Naxx, but WoWHead claims him to be in Icecrown only |
|---|
| 751 | |
|---|
| 752 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 753 | ////// Ghost of Naxxramas |
|---|
| 754 | #define CN_GHOST_OF_NAXXRAMAS 16419 |
|---|
| 755 | |
|---|
| 756 | class GhostOfNaxxramasAI : public MoonScriptCreatureAI |
|---|
| 757 | { |
|---|
| 758 | MOONSCRIPT_FACTORY_FUNCTION( GhostOfNaxxramasAI, MoonScriptCreatureAI ); |
|---|
| 759 | GhostOfNaxxramasAI( Creature* pCreature ); |
|---|
| 760 | |
|---|
| 761 | void Destroy(); |
|---|
| 762 | }; |
|---|
| 763 | |
|---|
| 764 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 765 | ////// Shade of Naxxramas |
|---|
| 766 | #define CN_SHADE_OF_NAXXRAMAS 16164 |
|---|
| 767 | #define SHADE_OF_NAXXRAMAS_PORTAL_OF_SHADOWS 28383 |
|---|
| 768 | #define SHADE_OF_NAXXRAMAS_SHADOW_BOLT_VOLLEY_NORMAL 28407 |
|---|
| 769 | #define SHADE_OF_NAXXRAMAS_SHADOW_BOLT_VOLLEY_HEROIC 55323 |
|---|
| 770 | |
|---|
| 771 | class ShadeOfNaxxramasAI : public MoonScriptCreatureAI |
|---|
| 772 | { |
|---|
| 773 | MOONSCRIPT_FACTORY_FUNCTION( ShadeOfNaxxramasAI, MoonScriptCreatureAI ); |
|---|
| 774 | ShadeOfNaxxramasAI( Creature* pCreature ); |
|---|
| 775 | friend class PortalOfShadowsAI; |
|---|
| 776 | |
|---|
| 777 | void OnDied( Unit* pKiller ); |
|---|
| 778 | void Destroy(); |
|---|
| 779 | |
|---|
| 780 | set< PortalOfShadowsAI* > mPortals; |
|---|
| 781 | }; |
|---|
| 782 | |
|---|
| 783 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 784 | ////// Portal of Shadows |
|---|
| 785 | #define CN_PORTAL_OF_SHADOWS 16420 |
|---|
| 786 | |
|---|
| 787 | class PortalOfShadowsAI : public MoonScriptCreatureAI |
|---|
| 788 | { |
|---|
| 789 | MOONSCRIPT_FACTORY_FUNCTION( PortalOfShadowsAI, MoonScriptCreatureAI ); |
|---|
| 790 | PortalOfShadowsAI( Creature* pCreature ); |
|---|
| 791 | |
|---|
| 792 | void OnCombatStart( Unit* pTarget ); |
|---|
| 793 | void OnCombatStop( Unit* pTarget ); |
|---|
| 794 | void AIUpdate(); |
|---|
| 795 | void Destroy(); |
|---|
| 796 | |
|---|
| 797 | ShadeOfNaxxramasAI* mShadeAI; |
|---|
| 798 | int32 mSpawnTimer; |
|---|
| 799 | }; |
|---|
| 800 | |
|---|
| 801 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 802 | ////// Necro Knight |
|---|
| 803 | #define CN_NECRO_KNIGHT 16165 |
|---|
| 804 | #define NECRO_KNIGHT_ARCANE_EXPLOSION 15453 |
|---|
| 805 | #define NECRO_KNIGHT_BLAST_WAVE 30092 |
|---|
| 806 | #define NECRO_KNIGHT_BLINK 28391 |
|---|
| 807 | #define NECRO_KNIGHT_CONE_OF_COLD 30095 |
|---|
| 808 | #define NECRO_KNIGHT_FLAMESTRIKE 30091 |
|---|
| 809 | #define NECRO_KNIGHT_FROST_NOVA 30094 |
|---|
| 810 | |
|---|
| 811 | void SpellFunc_NecroKnightBlink( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 812 | |
|---|
| 813 | class NecroKnightAI : public MoonScriptCreatureAI |
|---|
| 814 | { |
|---|
| 815 | MOONSCRIPT_FACTORY_FUNCTION( NecroKnightAI, MoonScriptCreatureAI ); |
|---|
| 816 | NecroKnightAI( Creature* pCreature ); |
|---|
| 817 | |
|---|
| 818 | void Destroy(); |
|---|
| 819 | }; |
|---|
| 820 | |
|---|
| 821 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 822 | ////// Skeletal Smith |
|---|
| 823 | #define CN_SKELETAL_SMITH 16193 |
|---|
| 824 | #define SKELETAL_SMITH_CRUSH_ARMOR 33661 |
|---|
| 825 | #define SKELETAL_SMITH_DISARM 6713 |
|---|
| 826 | #define SKELETAL_SMITH_THUNDERCLAP 23931 |
|---|
| 827 | //#define SKELETAL_SMITH_SUDDER_ARMOR 24317 |
|---|
| 828 | |
|---|
| 829 | class SkeletalSmithAI : public MoonScriptCreatureAI |
|---|
| 830 | { |
|---|
| 831 | MOONSCRIPT_FACTORY_FUNCTION( SkeletalSmithAI, MoonScriptCreatureAI ); |
|---|
| 832 | SkeletalSmithAI( Creature* pCreature ); |
|---|
| 833 | |
|---|
| 834 | void Destroy(); |
|---|
| 835 | }; |
|---|
| 836 | |
|---|
| 837 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 838 | ////// Death Knight Cavalier |
|---|
| 839 | #define CN_DEATH_KNIGHT_CAVALIER 16163 |
|---|
| 840 | #define DEATH_KNIGHT_CAVALIER_BONE_ARMOR_NORMAL 55315 |
|---|
| 841 | #define DEATH_KNIGHT_CAVALIER_BONE_ARMOR_HEROIC 55336 |
|---|
| 842 | #define DEATH_KNIGHT_CAVALIER_DISMOUNT_DEATHCHARGER 55294 |
|---|
| 843 | #define DEATH_KNIGHT_CAVALIER_ICY_TOUCH_NORMAL 55313 |
|---|
| 844 | #define DEATH_KNIGHT_CAVALIER_ICY_TOUCH_HEROIC 55331 |
|---|
| 845 | #define DEATH_KNIGHT_CAVALIER_STRANGULATE_NORMAL 55314 |
|---|
| 846 | #define DEATH_KNIGHT_CAVALIER_STRANGULATE_HEROIC 55334 |
|---|
| 847 | #define DEATH_KNIGHT_CAVALIER_AURA_OF_AGONY 28413 |
|---|
| 848 | #define DEATH_KNIGHT_CAVALIER_CLEAVE 15284 |
|---|
| 849 | #define DEATH_KNIGHT_CAVALIER_DEATH_COIL 28412 |
|---|
| 850 | |
|---|
| 851 | class DeathKnightCavalierAI : public MoonScriptCreatureAI |
|---|
| 852 | { |
|---|
| 853 | MOONSCRIPT_FACTORY_FUNCTION( DeathKnightCavalierAI, MoonScriptCreatureAI ); |
|---|
| 854 | DeathKnightCavalierAI( Creature* pCreature ); |
|---|
| 855 | friend class DeathchargerSteedAI; |
|---|
| 856 | |
|---|
| 857 | void OnCombatStop( Unit* pTarget ); |
|---|
| 858 | void AIUpdate(); |
|---|
| 859 | void Destroy(); |
|---|
| 860 | |
|---|
| 861 | DeathchargerSteedAI* mChargerAI; |
|---|
| 862 | bool mIsMounted; |
|---|
| 863 | }; |
|---|
| 864 | |
|---|
| 865 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 866 | ////// Deathcharger Steed |
|---|
| 867 | #define CN_DEATHCHARGER_STEED 29818 |
|---|
| 868 | #define DEATHCHARGER_STEED_CHARGE 55317 |
|---|
| 869 | |
|---|
| 870 | void SpellFunc_DeathchargerSteedCharge( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 871 | |
|---|
| 872 | class DeathchargerSteedAI : public MoonScriptCreatureAI |
|---|
| 873 | { |
|---|
| 874 | MOONSCRIPT_FACTORY_FUNCTION( DeathchargerSteedAI, MoonScriptCreatureAI ); |
|---|
| 875 | DeathchargerSteedAI( Creature* pCreature ); |
|---|
| 876 | friend class DeathKnightCavalierAI; |
|---|
| 877 | |
|---|
| 878 | void OnCombatStop( Unit* pTarget ); |
|---|
| 879 | void Destroy(); |
|---|
| 880 | |
|---|
| 881 | DeathKnightCavalierAI* mDeathKnightAI; |
|---|
| 882 | SpellDesc* mCharge; |
|---|
| 883 | }; |
|---|
| 884 | |
|---|
| 885 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 886 | ////// Dark Touched Warrior |
|---|
| 887 | #define CN_DARK_TOUCHED_WARRIOR 16156 |
|---|
| 888 | #define DARK_TOUCHED_WARRIOR_WHIRLWIND 55267 |
|---|
| 889 | //#define DARK_TOUCHED_WARRIOR_WHIRLWIND 55266 // This one disables mob's melee |
|---|
| 890 | |
|---|
| 891 | class DarkTouchedWarriorAI : public MoonScriptCreatureAI |
|---|
| 892 | { |
|---|
| 893 | MOONSCRIPT_FACTORY_FUNCTION( DarkTouchedWarriorAI, MoonScriptCreatureAI ); |
|---|
| 894 | DarkTouchedWarriorAI( Creature* pCreature ); |
|---|
| 895 | |
|---|
| 896 | void OnCombatStart( Unit* pTarget ); |
|---|
| 897 | void AIUpdate(); |
|---|
| 898 | void Destroy(); |
|---|
| 899 | |
|---|
| 900 | int32 mResetHateTimer; |
|---|
| 901 | }; |
|---|
| 902 | |
|---|
| 903 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 904 | ////// Risen Squire |
|---|
| 905 | #define CN_RISEN_SQUIRE 16154 |
|---|
| 906 | #define RISEN_SQUIRE_PIERCE_ARMOR 55318 |
|---|
| 907 | |
|---|
| 908 | class RisenSquireAI : public MoonScriptCreatureAI |
|---|
| 909 | { |
|---|
| 910 | MOONSCRIPT_FACTORY_FUNCTION( RisenSquireAI, MoonScriptCreatureAI ); |
|---|
| 911 | RisenSquireAI( Creature* pCreature ); |
|---|
| 912 | |
|---|
| 913 | void Destroy(); |
|---|
| 914 | }; |
|---|
| 915 | |
|---|
| 916 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 917 | ////// Unholy Axe |
|---|
| 918 | #define CN_UNHOLY_AXE 16194 |
|---|
| 919 | #define UNHOLY_AXE_MORTAL_STRIKE_NORMAL 16856 |
|---|
| 920 | #define UNHOLY_AXE_MORTAL_STRIKE_HEROIC 15708 |
|---|
| 921 | #define UNHOLY_AXE_WHIRLWIND_NORMAL 55463 |
|---|
| 922 | #define UNHOLY_AXE_WHIRLWIND_HEROIC 24236 |
|---|
| 923 | |
|---|
| 924 | class UnholyAxeAI : public MoonScriptCreatureAI |
|---|
| 925 | { |
|---|
| 926 | MOONSCRIPT_FACTORY_FUNCTION( UnholyAxeAI, MoonScriptCreatureAI ); |
|---|
| 927 | UnholyAxeAI( Creature* pCreature ); |
|---|
| 928 | |
|---|
| 929 | void Destroy(); |
|---|
| 930 | }; |
|---|
| 931 | |
|---|
| 932 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 933 | ////// Unholy Sword |
|---|
| 934 | #define CN_UNHOLY_SWORD 16216 |
|---|
| 935 | #define UNHOLY_SWORD_CLEAVE_NORMAL 15284 |
|---|
| 936 | #define UNHOLY_SWORD_CLEAVE_HEROIC 19632 |
|---|
| 937 | |
|---|
| 938 | class UnholySwordAI : public MoonScriptCreatureAI |
|---|
| 939 | { |
|---|
| 940 | MOONSCRIPT_FACTORY_FUNCTION( UnholySwordAI, MoonScriptCreatureAI ); |
|---|
| 941 | UnholySwordAI( Creature* pCreature ); |
|---|
| 942 | |
|---|
| 943 | void Destroy(); |
|---|
| 944 | }; |
|---|
| 945 | |
|---|
| 946 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 947 | ////// Unholy Staff |
|---|
| 948 | #define CN_UNHOLY_STAFF 16215 |
|---|
| 949 | #define UNHOLY_STAFF_ARCANE_EXPLOSION_NORMAL 28450 |
|---|
| 950 | #define UNHOLY_STAFF_ARCANE_EXPLOSION_HEROIC 55467 |
|---|
| 951 | #define UNHOLY_STAFF_FROST_NOVA 29849 |
|---|
| 952 | #define UNHOLY_STAFF_POLYMORPH 29848 |
|---|
| 953 | |
|---|
| 954 | class UnholyStaffAI : public MoonScriptCreatureAI |
|---|
| 955 | { |
|---|
| 956 | MOONSCRIPT_FACTORY_FUNCTION( UnholyStaffAI, MoonScriptCreatureAI ); |
|---|
| 957 | UnholyStaffAI( Creature* pCreature ); |
|---|
| 958 | |
|---|
| 959 | void Destroy(); |
|---|
| 960 | }; |
|---|
| 961 | |
|---|
| 962 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 963 | ////// Instructor Razuvious |
|---|
| 964 | #define CN_INSTRUCTOR_RAZUVIOUS 16061 |
|---|
| 965 | #define INSTRUCTOR_RAZUVIOUS_DISRUPTING_SHOUT_NORMAL 55543 |
|---|
| 966 | #define INSTRUCTOR_RAZUVIOUS_DISRUPTING_SHOUT_HEROIC 29107 |
|---|
| 967 | #define INSTRUCTOR_RAZUVIOUS_JAGGED_KNIFE 55550 |
|---|
| 968 | #define INSTRUCTOR_RAZUVIOUS_UNBALANCING_STRIKE 55470 |
|---|
| 969 | #define INSTRUCTOR_RAZUVIOUS_HOPELESS 29125 |
|---|
| 970 | |
|---|
| 971 | class InstructorRazuviousAI : public MoonScriptBossAI |
|---|
| 972 | { |
|---|
| 973 | MOONSCRIPT_FACTORY_FUNCTION( InstructorRazuviousAI, MoonScriptBossAI ); |
|---|
| 974 | InstructorRazuviousAI( Creature* pCreature ); |
|---|
| 975 | friend class DeathKnightUnderstudyAI; |
|---|
| 976 | |
|---|
| 977 | void OnCombatStart( Unit* pTarget ); |
|---|
| 978 | void OnCombatStop( Unit* pTarget ); |
|---|
| 979 | void OnDied( Unit* pKiller ); |
|---|
| 980 | void AIUpdate(); |
|---|
| 981 | void Destroy(); |
|---|
| 982 | |
|---|
| 983 | set< DeathKnightUnderstudyAI* > mStudents; |
|---|
| 984 | }; |
|---|
| 985 | |
|---|
| 986 | InstructorRazuviousAI::InstructorRazuviousAI( Creature* pCreature ) : MoonScriptBossAI( pCreature ) |
|---|
| 987 | { |
|---|
| 988 | }; |
|---|
| 989 | |
|---|
| 990 | void InstructorRazuviousAI::OnCombatStart( Unit* pTarget ) |
|---|
| 991 | { |
|---|
| 992 | ParentClass::OnCombatStart( pTarget ); |
|---|
| 993 | }; |
|---|
| 994 | |
|---|
| 995 | void InstructorRazuviousAI::OnCombatStop( Unit* pTarget ) |
|---|
| 996 | { |
|---|
| 997 | ParentClass::OnCombatStop( pTarget ); |
|---|
| 998 | }; |
|---|
| 999 | |
|---|
| 1000 | void InstructorRazuviousAI::OnDied( Unit* pKiller ) |
|---|
| 1001 | { |
|---|
| 1002 | ParentClass::OnDied( pKiller ); |
|---|
| 1003 | }; |
|---|
| 1004 | |
|---|
| 1005 | void InstructorRazuviousAI::AIUpdate() |
|---|
| 1006 | { |
|---|
| 1007 | ParentClass::AIUpdate(); |
|---|
| 1008 | }; |
|---|
| 1009 | |
|---|
| 1010 | void InstructorRazuviousAI::Destroy() |
|---|
| 1011 | { |
|---|
| 1012 | delete this; |
|---|
| 1013 | }; |
|---|
| 1014 | |
|---|
| 1015 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1016 | ////// Death Knight Understudy |
|---|
| 1017 | #define CN_DEATH_KNIGHT_UNDERSTUDY 16803 |
|---|
| 1018 | #define DEATH_KNIGHT_UNDERSTUDY_BLOOD_STRIKE 61696 |
|---|
| 1019 | #define DEATH_KNIGHT_UNDERSTUDY_BONE_BARRIER 29061 |
|---|
| 1020 | #define DEATH_KNIGHT_UNDERSTUDY_TAUNT 29060 |
|---|
| 1021 | |
|---|
| 1022 | class DeathKnightUnderstudyAI : public MoonScriptCreatureAI |
|---|
| 1023 | { |
|---|
| 1024 | MOONSCRIPT_FACTORY_FUNCTION( DeathKnightUnderstudyAI, MoonScriptCreatureAI ); |
|---|
| 1025 | DeathKnightUnderstudyAI( Creature* pCreature ); |
|---|
| 1026 | |
|---|
| 1027 | void Destroy(); |
|---|
| 1028 | |
|---|
| 1029 | InstructorRazuviousAI* mRazuviousAI; |
|---|
| 1030 | bool mIsControlled; |
|---|
| 1031 | }; |
|---|
| 1032 | |
|---|
| 1033 | DeathKnightUnderstudyAI::DeathKnightUnderstudyAI( Creature* pCreature ) : MoonScriptCreatureAI( pCreature ) |
|---|
| 1034 | { |
|---|
| 1035 | AddSpell( DEATH_KNIGHT_UNDERSTUDY_BLOOD_STRIKE, Target_Current, 10, 0, 4, 0, 8 ); |
|---|
| 1036 | AddSpell( DEATH_KNIGHT_UNDERSTUDY_BONE_BARRIER, Target_Self, 8, 0, 30 ); |
|---|
| 1037 | AddSpell( DEATH_KNIGHT_UNDERSTUDY_TAUNT, Target_Current, 8, 0, 10, 0, 8 ); |
|---|
| 1038 | |
|---|
| 1039 | // Blood Strike |
|---|
| 1040 | AI_Spell* NewSpell = new AI_Spell; |
|---|
| 1041 | NewSpell->spell = dbcSpell.LookupEntry( DEATH_KNIGHT_UNDERSTUDY_BLOOD_STRIKE ); |
|---|
| 1042 | NewSpell->agent = AGENT_SPELL; |
|---|
| 1043 | NewSpell->entryId = _unit->GetEntry(); |
|---|
| 1044 | NewSpell->maxrange = GetMaxRange( dbcSpellRange.LookupEntry( NewSpell->spell->rangeIndex ) ); |
|---|
| 1045 | NewSpell->minrange = GetMinRange( dbcSpellRange.LookupEntry( NewSpell->spell->rangeIndex ) ); |
|---|
| 1046 | NewSpell->spelltargetType = TTYPE_SINGLETARGET; |
|---|
| 1047 | NewSpell->spellType = STYPE_DAMAGE; |
|---|
| 1048 | NewSpell->cooldown = objmgr.GetPetSpellCooldown( NewSpell->spell->Id ); |
|---|
| 1049 | NewSpell->cooldowntime = 0; |
|---|
| 1050 | NewSpell->autocast_type = AUTOCAST_EVENT_NONE; |
|---|
| 1051 | NewSpell->floatMisc1 = 0; |
|---|
| 1052 | NewSpell->Misc2 = 0; |
|---|
| 1053 | NewSpell->procChance = 0; |
|---|
| 1054 | NewSpell->procCount=0; |
|---|
| 1055 | _unit->GetAIInterface()->addSpellToList( NewSpell ); |
|---|
| 1056 | //_unit->GetAIInterface()->m_spells.push_back( NewSpell ); |
|---|
| 1057 | |
|---|
| 1058 | // Bone Barrier |
|---|
| 1059 | NewSpell = new AI_Spell; |
|---|
| 1060 | NewSpell->spell = dbcSpell.LookupEntry( DEATH_KNIGHT_UNDERSTUDY_BONE_BARRIER ); |
|---|
| 1061 | NewSpell->agent = AGENT_SPELL; |
|---|
| 1062 | NewSpell->entryId = _unit->GetEntry(); |
|---|
| 1063 | NewSpell->maxrange = GetMaxRange( dbcSpellRange.LookupEntry( NewSpell->spell->rangeIndex ) ); |
|---|
| 1064 | NewSpell->minrange = GetMinRange( dbcSpellRange.LookupEntry( NewSpell->spell->rangeIndex ) ); |
|---|
| 1065 | NewSpell->spelltargetType = TTYPE_CASTER; |
|---|
| 1066 | NewSpell->spellType = STYPE_BUFF; |
|---|
| 1067 | NewSpell->cooldown = objmgr.GetPetSpellCooldown( NewSpell->spell->Id ); |
|---|
| 1068 | NewSpell->cooldowntime = 0; |
|---|
| 1069 | NewSpell->autocast_type = AUTOCAST_EVENT_NONE; |
|---|
| 1070 | NewSpell->floatMisc1 = 0; |
|---|
| 1071 | NewSpell->Misc2 = 0; |
|---|
| 1072 | NewSpell->procChance = 0; |
|---|
| 1073 | NewSpell->procCount=0; |
|---|
| 1074 | _unit->GetAIInterface()->addSpellToList( NewSpell ); |
|---|
| 1075 | //_unit->GetAIInterface()->m_spells.push_back( NewSpell ); |
|---|
| 1076 | |
|---|
| 1077 | // Taunt |
|---|
| 1078 | NewSpell = new AI_Spell; |
|---|
| 1079 | NewSpell->spell = dbcSpell.LookupEntry( DEATH_KNIGHT_UNDERSTUDY_TAUNT ); |
|---|
| 1080 | NewSpell->agent = AGENT_SPELL; |
|---|
| 1081 | NewSpell->entryId = _unit->GetEntry(); |
|---|
| 1082 | NewSpell->maxrange = GetMaxRange( dbcSpellRange.LookupEntry( NewSpell->spell->rangeIndex ) ); |
|---|
| 1083 | NewSpell->minrange = GetMinRange( dbcSpellRange.LookupEntry( NewSpell->spell->rangeIndex ) ); |
|---|
| 1084 | NewSpell->spelltargetType = TTYPE_SINGLETARGET; |
|---|
| 1085 | NewSpell->spellType = STYPE_BUFF; |
|---|
| 1086 | NewSpell->cooldown = objmgr.GetPetSpellCooldown( NewSpell->spell->Id ); |
|---|
| 1087 | NewSpell->cooldowntime = 0; |
|---|
| 1088 | NewSpell->autocast_type = AUTOCAST_EVENT_NONE; |
|---|
| 1089 | NewSpell->floatMisc1 = 0; |
|---|
| 1090 | NewSpell->Misc2 = 0; |
|---|
| 1091 | NewSpell->procChance = 0; |
|---|
| 1092 | NewSpell->procCount=0; |
|---|
| 1093 | _unit->GetAIInterface()->addSpellToList( NewSpell ); |
|---|
| 1094 | //_unit->GetAIInterface()->m_spells.push_back( NewSpell ) |
|---|
| 1095 | |
|---|
| 1096 | mRazuviousAI = NULL; |
|---|
| 1097 | }; |
|---|
| 1098 | |
|---|
| 1099 | void DeathKnightUnderstudyAI::Destroy() |
|---|
| 1100 | { |
|---|
| 1101 | if ( mRazuviousAI != NULL ) |
|---|
| 1102 | { |
|---|
| 1103 | set< DeathKnightUnderstudyAI* >::iterator Iter = mRazuviousAI->mStudents.find( this ); |
|---|
| 1104 | if ( Iter != mRazuviousAI->mStudents.end() ) |
|---|
| 1105 | mRazuviousAI->mStudents.erase( Iter ); |
|---|
| 1106 | |
|---|
| 1107 | mRazuviousAI = NULL; |
|---|
| 1108 | }; |
|---|
| 1109 | |
|---|
| 1110 | delete this; |
|---|
| 1111 | }; |
|---|
| 1112 | |
|---|
| 1113 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1114 | ////// The Construct Quarter |
|---|
| 1115 | |
|---|
| 1116 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1117 | ////// Patchwork Golem |
|---|
| 1118 | #define CN_PATCHWORK_GOLEM 16017 |
|---|
| 1119 | #define PATCHWORK_GOLEM_CLEAVE 27794 |
|---|
| 1120 | #define PATCHWORK_GOLEM_DISEASE_CLOUD_NORMAL 27793 |
|---|
| 1121 | #define PATCHWORK_GOLEM_DISEASE_CLOUD_HEROIC 28362 |
|---|
| 1122 | #define PATCHWORK_GOLEM_EXECUTE_NORMAL 7160 |
|---|
| 1123 | #define PATCHWORK_GOLEM_EXECUTE_HEROIC 56426 |
|---|
| 1124 | #define PATCHWORK_GOLEM_WAR_STOMP_NORMAL 27758 |
|---|
| 1125 | #define PATCHWORK_GOLEM_WAR_STOMP_HEROIC 56427 |
|---|
| 1126 | |
|---|
| 1127 | class PatchworkGolemAI : public MoonScriptCreatureAI |
|---|
| 1128 | { |
|---|
| 1129 | MOONSCRIPT_FACTORY_FUNCTION( PatchworkGolemAI, MoonScriptCreatureAI ); |
|---|
| 1130 | PatchworkGolemAI( Creature* pCreature ); |
|---|
| 1131 | |
|---|
| 1132 | void OnCombatStart( Unit* pTarget ); |
|---|
| 1133 | void OnCombatStop( Unit* pTarget ); |
|---|
| 1134 | void Destroy(); |
|---|
| 1135 | }; |
|---|
| 1136 | |
|---|
| 1137 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1138 | ////// Bile Retcher |
|---|
| 1139 | #define CN_BILE_RETCHER 16018 |
|---|
| 1140 | #define BILE_RETCHER_BILE_VOMIT_NORMAL 27807 |
|---|
| 1141 | #define BILE_RETCHER_BILE_VOMIT_HEROIC 54326 |
|---|
| 1142 | #define BILE_RETCHER_BILE_RETCHER_SLAM 27862 |
|---|
| 1143 | |
|---|
| 1144 | class BileRetcherAI : public MoonScriptCreatureAI |
|---|
| 1145 | { |
|---|
| 1146 | MOONSCRIPT_FACTORY_FUNCTION( BileRetcherAI, MoonScriptCreatureAI ); |
|---|
| 1147 | BileRetcherAI( Creature* pCreature ); |
|---|
| 1148 | |
|---|
| 1149 | void Destroy(); |
|---|
| 1150 | }; |
|---|
| 1151 | |
|---|
| 1152 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1153 | ////// Sewage Slime |
|---|
| 1154 | #define CN_SEWAGE_SLIME 16375 |
|---|
| 1155 | #define SEWAGE_SLIME_DISEASE_CLOUD 28156 |
|---|
| 1156 | |
|---|
| 1157 | class SewageSlimeAI : public MoonScriptCreatureAI |
|---|
| 1158 | { |
|---|
| 1159 | MOONSCRIPT_FACTORY_FUNCTION( SewageSlimeAI, MoonScriptCreatureAI ); |
|---|
| 1160 | SewageSlimeAI( Creature* pCreature ); |
|---|
| 1161 | |
|---|
| 1162 | void OnCombatStart( Unit* pTarget ); |
|---|
| 1163 | void OnCombatStop( Unit* pTarget ); |
|---|
| 1164 | void Destroy(); |
|---|
| 1165 | }; |
|---|
| 1166 | |
|---|
| 1167 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1168 | ////// Embalming Slime |
|---|
| 1169 | #define CN_EMBALMING_SLIME 16375 |
|---|
| 1170 | #define EMBALMING_SLIME_EMBALMING_CLOUD 28322 |
|---|
| 1171 | |
|---|
| 1172 | class EmbalmingSlimeAI : public MoonScriptCreatureAI |
|---|
| 1173 | { |
|---|
| 1174 | MOONSCRIPT_FACTORY_FUNCTION( EmbalmingSlimeAI, MoonScriptCreatureAI ); |
|---|
| 1175 | EmbalmingSlimeAI( Creature* pCreature ); |
|---|
| 1176 | |
|---|
| 1177 | void OnCombatStart( Unit* pTarget ); |
|---|
| 1178 | void OnCombatStop( Unit* pTarget ); |
|---|
| 1179 | void Destroy(); |
|---|
| 1180 | }; |
|---|
| 1181 | |
|---|
| 1182 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1183 | ////// Mad Scientist |
|---|
| 1184 | #define CN_MAD_SCIENTIST 16020 |
|---|
| 1185 | #define MAD_SCIENTIST_GREAT_HEAL_NORMAL 28306 |
|---|
| 1186 | #define MAD_SCIENTIST_GREAT_HEAL_HEROIC 54337 |
|---|
| 1187 | #define MAD_SCIENTIST_MANA_BURN_NORMAL 28301 |
|---|
| 1188 | #define MAD_SCIENTIST_MANA_BURN_HEROIC 54338 |
|---|
| 1189 | |
|---|
| 1190 | class MadScientistAI : public MoonScriptCreatureAI |
|---|
| 1191 | { |
|---|
| 1192 | MOONSCRIPT_FACTORY_FUNCTION( MadScientistAI, MoonScriptCreatureAI ); |
|---|
| 1193 | MadScientistAI( Creature* pCreature ); |
|---|
| 1194 | |
|---|
| 1195 | void Destroy(); |
|---|
| 1196 | }; |
|---|
| 1197 | |
|---|
| 1198 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1199 | ////// Living Monstrosity |
|---|
| 1200 | #define CN_LIVING_MONSTROSITY 16021 |
|---|
| 1201 | #define LIVING_MONSTROSITY_FEAR 27990 |
|---|
| 1202 | #define LIVING_MONSTROSITY_LIGHTNING_TOTEM 28294 |
|---|
| 1203 | #define LIVING_MONSTROSITY_CHAIN_LIGHTNING_NORMAL 28293 |
|---|
| 1204 | #define LIVING_MONSTROSITY_CHAIN_LIGHTNING_HEROIC 54334 |
|---|
| 1205 | |
|---|
| 1206 | class LivingMonstrosityAI : public MoonScriptCreatureAI |
|---|
| 1207 | { |
|---|
| 1208 | MOONSCRIPT_FACTORY_FUNCTION( LivingMonstrosityAI, MoonScriptCreatureAI ); |
|---|
| 1209 | LivingMonstrosityAI( Creature* pCreature ); |
|---|
| 1210 | |
|---|
| 1211 | void Destroy(); |
|---|
| 1212 | }; |
|---|
| 1213 | |
|---|
| 1214 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1215 | ////// Lightning Totem |
|---|
| 1216 | #define CN_LIGHTNING_TOTEM 16385 |
|---|
| 1217 | #define LIGHTNING_TOTEM_SHOCK_NORMAL 28297 |
|---|
| 1218 | #define LIGHTNING_TOTEM_SHOCK_HEROIC 54333 |
|---|
| 1219 | |
|---|
| 1220 | class LightningTotemAI : public MoonScriptCreatureAI |
|---|
| 1221 | { |
|---|
| 1222 | MOONSCRIPT_FACTORY_FUNCTION( LightningTotemAI, MoonScriptCreatureAI ); |
|---|
| 1223 | LightningTotemAI( Creature* pCreature ); |
|---|
| 1224 | |
|---|
| 1225 | void OnCombatStart( Unit* pTarget ); |
|---|
| 1226 | void AIUpdate(); |
|---|
| 1227 | void Destroy(); |
|---|
| 1228 | }; |
|---|
| 1229 | |
|---|
| 1230 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1231 | ////// Stitched Colossus |
|---|
| 1232 | #define CN_STITCHED_COLOSSUS 30071 |
|---|
| 1233 | #define STITCHED_COLOSSUS_MASSIVE_STOMP_NORMAL 55821 |
|---|
| 1234 | #define STITCHED_COLOSSUS_MASSIVE_STOMP_HEROIC 55826 |
|---|
| 1235 | #define STITCHED_COLOSSUS_UNSTOPPABLE_ENRAGE 54356 |
|---|
| 1236 | |
|---|
| 1237 | class StitchedColossusAI : public MoonScriptCreatureAI |
|---|
| 1238 | { |
|---|
| 1239 | MOONSCRIPT_FACTORY_FUNCTION( StitchedColossusAI, MoonScriptCreatureAI ); |
|---|
| 1240 | StitchedColossusAI( Creature* pCreature ); |
|---|
| 1241 | |
|---|
| 1242 | void OnCombatStart( Unit* pTarget ); |
|---|
| 1243 | void AIUpdate(); |
|---|
| 1244 | void Destroy(); |
|---|
| 1245 | |
|---|
| 1246 | bool mEnraged; |
|---|
| 1247 | }; |
|---|
| 1248 | |
|---|
| 1249 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1250 | ////// Marauding Geist |
|---|
| 1251 | #define CN_MARAUDING_GEIST 30083 |
|---|
| 1252 | #define MARAUDING_GEIST_FRENZIED_LEAP 56729 |
|---|
| 1253 | |
|---|
| 1254 | class MaraudingGeistAI : public MoonScriptCreatureAI |
|---|
| 1255 | { |
|---|
| 1256 | MOONSCRIPT_FACTORY_FUNCTION( MaraudingGeistAI, MoonScriptCreatureAI ); |
|---|
| 1257 | MaraudingGeistAI( Creature* pCreature ); |
|---|
| 1258 | |
|---|
| 1259 | void Destroy(); |
|---|
| 1260 | }; |
|---|
| 1261 | |
|---|
| 1262 | ///////////////////////////////////////////////////////////////////////////////// |
|---|
| 1263 | ////// Patchwerk |
|---|
| 1264 | |
|---|
| 1265 | void SpellFunc_PatchwerkHatefulStrike( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType ); |
|---|
| 1266 | |
|---|
| 1267 | #define CN_PATCHWERK 16028 |
|---|
| 1268 | #define PATCHWERK_FRENZY 28131 |
|---|
| 1269 | #define PATCHWERK_BERSERK 26662 |
|---|
| 1270 | #define PATCHWERK_HATEFUL_STRIKE_10 41926 |
|---|
| 1271 | #define PATCHWERK_HATEFUL_STRIKE_25 59192 |
|---|
| 1272 | |
|---|
| 1273 | class PatchwerkAI : public MoonScriptBossAI |
|---|
| 1274 | { |
|---|
| 1275 | MOONSCRIPT_FACTORY_FUNCTION( PatchwerkAI, MoonScriptBossAI ); |
|---|
| 1276 | PatchwerkAI( Creature* pCreature ); |
|---|
| 1277 | |
|---|
| 1278 | void AIUpdate(); |
|---|
| 1279 | void Destroy(); |
|---|
| 1280 | |
|---|
| 1281 | bool mEnraged; |
|---|
| 1282 | }; |
|---|
| 1283 | |
|---|
| 1284 | // ---- Abomination Wing ---- |
|---|
| 1285 | |
|---|
| 1286 | // Stitched Spewer AI |
|---|
| 1287 | #define STICKED_SPEWER 16025 |
|---|
| 1288 | |
|---|
| 1289 | #define CN_SLIME_BOLT 32309 |
|---|
| 1290 | #define CN_UPPERCUT 26007 |
|---|
| 1291 | |
|---|
| 1292 | class StickedSpewerAI : public CreatureAIScript |
|---|
| 1293 | { |
|---|
| 1294 | public: |
|---|
| 1295 | ADD_CREATURE_FACTORY_FUNCTION(StickedSpewerAI); |
|---|
| 1296 | SP_AI_Spell spells[2]; |
|---|
| 1297 | bool m_spellcheck[2]; |
|---|
| 1298 | |
|---|
| 1299 | StickedSpewerAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 1300 | { |
|---|
| 1301 | // -- Number of spells to add -- |
|---|
| 1302 | nrspells = 2; |
|---|
| 1303 | |
|---|
| 1304 | // --- Initialization --- |
|---|
| 1305 | for(int i=0;i<nrspells;i++) |
|---|
| 1306 | { |
|---|
| 1307 | m_spellcheck[i] = false; |
|---|
| 1308 | } |
|---|
| 1309 | // ---------------------- |
|---|
| 1310 | |
|---|
| 1311 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 1312 | spells[0].info = dbcSpell.LookupEntry(CN_SLIME_BOLT); |
|---|
| 1313 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 1314 | spells[0].instant = false; |
|---|
| 1315 | spells[0].perctrigger = 10.0f; |
|---|
| 1316 | spells[0].attackstoptimer = 2000; // 1sec |
|---|
| 1317 | |
|---|
| 1318 | spells[1].info = dbcSpell.LookupEntry(CN_UPPERCUT); |
|---|
| 1319 | spells[1].targettype = TARGET_VARIOUS; |
|---|
| 1320 | spells[1].instant = false; |
|---|
| 1321 | spells[1].perctrigger = 10.0f; |
|---|
| 1322 | spells[1].attackstoptimer = 2000; // 1sec |
|---|
| 1323 | |
|---|
| 1324 | } |
|---|
| 1325 | |
|---|
| 1326 | void OnCombatStart(Unit* mTarget) |
|---|
| 1327 | { |
|---|
| 1328 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 1329 | } |
|---|
| 1330 | |
|---|
| 1331 | void OnCombatStop(Unit* mTarget) |
|---|
| 1332 | { |
|---|
| 1333 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 1334 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 1335 | RemoveAIUpdateEvent(); |
|---|
| 1336 | } |
|---|
| 1337 | |
|---|
| 1338 | void OnDied(Unit* mKiller) |
|---|
| 1339 | { |
|---|
| 1340 | RemoveAIUpdateEvent(); |
|---|
| 1341 | } |
|---|
| 1342 | |
|---|
| 1343 | void AIUpdate() |
|---|
| 1344 | { |
|---|
| 1345 | float val = (float)RandomFloat(100.0f); |
|---|
| 1346 | SpellCast(val); |
|---|
| 1347 | } |
|---|
| 1348 | |
|---|
| 1349 | void SpellCast(float val) |
|---|
| 1350 | { |
|---|
| 1351 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 1352 | { |
|---|
| 1353 | float comulativeperc = 0; |
|---|
| 1354 | Unit* target = NULL; |
|---|
| 1355 | for(int i=0;i<nrspells;i++) |
|---|
| 1356 | { |
|---|
| 1357 | if(!spells[i].perctrigger) continue; |
|---|
| 1358 | |
|---|
| 1359 | if(m_spellcheck[i]) |
|---|
| 1360 | { |
|---|
| 1361 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 1362 | switch(spells[i].targettype) |
|---|
| 1363 | { |
|---|
| 1364 | case TARGET_SELF: |
|---|
| 1365 | case TARGET_VARIOUS: |
|---|
| 1366 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 1367 | case TARGET_ATTACKING: |
|---|
| 1368 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 1369 | case TARGET_DESTINATION: |
|---|
| 1370 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 1371 | } |
|---|
| 1372 | m_spellcheck[i] = false; |
|---|
| 1373 | return; |
|---|
| 1374 | } |
|---|
| 1375 | |
|---|
| 1376 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 1377 | { |
|---|
| 1378 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 1379 | m_spellcheck[i] = true; |
|---|
| 1380 | } |
|---|
| 1381 | comulativeperc += spells[i].perctrigger; |
|---|
| 1382 | } |
|---|
| 1383 | } |
|---|
| 1384 | } |
|---|
| 1385 | |
|---|
| 1386 | protected: |
|---|
| 1387 | |
|---|
| 1388 | int nrspells; |
|---|
| 1389 | }; |
|---|
| 1390 | |
|---|
| 1391 | |
|---|
| 1392 | |
|---|
| 1393 | //Surgical Assistant AI |
|---|
| 1394 | #define CN_SURGICAL_ASSISTANT 16022 |
|---|
| 1395 | |
|---|
| 1396 | #define MIND_FLAY 28310 |
|---|
| 1397 | |
|---|
| 1398 | class SurgicalAssistantAI : public CreatureAIScript |
|---|
| 1399 | { |
|---|
| 1400 | public: |
|---|
| 1401 | ADD_CREATURE_FACTORY_FUNCTION(SurgicalAssistantAI); |
|---|
| 1402 | SP_AI_Spell spells[1]; |
|---|
| 1403 | bool m_spellcheck[1]; |
|---|
| 1404 | |
|---|
| 1405 | SurgicalAssistantAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 1406 | { |
|---|
| 1407 | // -- Number of spells to add -- |
|---|
| 1408 | nrspells = 1; |
|---|
| 1409 | |
|---|
| 1410 | // --- Initialization --- |
|---|
| 1411 | for(int i=0;i<nrspells;i++) |
|---|
| 1412 | { |
|---|
| 1413 | m_spellcheck[i] = false; |
|---|
| 1414 | } |
|---|
| 1415 | // ---------------------- |
|---|
| 1416 | |
|---|
| 1417 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 1418 | spells[0].info = dbcSpell.LookupEntry(MIND_FLAY); |
|---|
| 1419 | spells[0].targettype = TARGET_ATTACKING; |
|---|
| 1420 | spells[0].instant = false; |
|---|
| 1421 | spells[0].perctrigger = 20.0f; |
|---|
| 1422 | spells[0].attackstoptimer = 6000; // 1sec |
|---|
| 1423 | |
|---|
| 1424 | } |
|---|
| 1425 | |
|---|
| 1426 | void OnCombatStart(Unit* mTarget) |
|---|
| 1427 | { |
|---|
| 1428 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 1429 | } |
|---|
| 1430 | |
|---|
| 1431 | void OnCombatStop(Unit* mTarget) |
|---|
| 1432 | { |
|---|
| 1433 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 1434 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 1435 | RemoveAIUpdateEvent(); |
|---|
| 1436 | } |
|---|
| 1437 | |
|---|
| 1438 | void OnDied(Unit* mKiller) |
|---|
| 1439 | { |
|---|
| 1440 | RemoveAIUpdateEvent(); |
|---|
| 1441 | } |
|---|
| 1442 | |
|---|
| 1443 | void AIUpdate() |
|---|
| 1444 | { |
|---|
| 1445 | float val = (float)RandomFloat(100.0f); |
|---|
| 1446 | SpellCast(val); |
|---|
| 1447 | } |
|---|
| 1448 | |
|---|
| 1449 | void SpellCast(float val) |
|---|
| 1450 | { |
|---|
| 1451 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 1452 | { |
|---|
| 1453 | float comulativeperc = 0; |
|---|
| 1454 | Unit* target = NULL; |
|---|
| 1455 | for(int i=0;i<nrspells;i++) |
|---|
| 1456 | { |
|---|
| 1457 | if(!spells[i].perctrigger) continue; |
|---|
| 1458 | |
|---|
| 1459 | if(m_spellcheck[i]) |
|---|
| 1460 | { |
|---|
| 1461 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 1462 | switch(spells[i].targettype) |
|---|
| 1463 | { |
|---|
| 1464 | case TARGET_SELF: |
|---|
| 1465 | case TARGET_VARIOUS: |
|---|
| 1466 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 1467 | case TARGET_ATTACKING: |
|---|
| 1468 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 1469 | case TARGET_DESTINATION: |
|---|
| 1470 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 1471 | } |
|---|
| 1472 | m_spellcheck[i] = false; |
|---|
| 1473 | return; |
|---|
| 1474 | } |
|---|
| 1475 | |
|---|
| 1476 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 1477 | { |
|---|
| 1478 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 1479 | m_spellcheck[i] = true; |
|---|
| 1480 | } |
|---|
| 1481 | comulativeperc += spells[i].perctrigger; |
|---|
| 1482 | } |
|---|
| 1483 | } |
|---|
| 1484 | } |
|---|
| 1485 | |
|---|
| 1486 | protected: |
|---|
| 1487 | |
|---|
| 1488 | int nrspells; |
|---|
| 1489 | }; |
|---|
| 1490 | |
|---|
| 1491 | |
|---|
| 1492 | // Sludge Belcher AI |
|---|
| 1493 | #define CN_SLUDGE_BELCHER 16029 |
|---|
| 1494 | |
|---|
| 1495 | #define DISEISE_BUFFET 27891 |
|---|
| 1496 | #define SUMMON_BILE_SLIMES 27889 // TODO: GAWD :P |
|---|
| 1497 | |
|---|
| 1498 | class SludgeBelcherAI : public CreatureAIScript |
|---|
| 1499 | { |
|---|
| 1500 | public: |
|---|
| 1501 | ADD_CREATURE_FACTORY_FUNCTION(SludgeBelcherAI); |
|---|
| 1502 | SP_AI_Spell spells[2]; |
|---|
| 1503 | bool m_spellcheck[2]; |
|---|
| 1504 | |
|---|
| 1505 | SludgeBelcherAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 1506 | { |
|---|
| 1507 | // -- Number of spells to add -- |
|---|
| 1508 | nrspells = 2; |
|---|
| 1509 | |
|---|
| 1510 | // --- Initialization --- |
|---|
| 1511 | for(int i=0;i<nrspells;i++) |
|---|
| 1512 | { |
|---|
| 1513 | m_spellcheck[i] = false; |
|---|
| 1514 | } |
|---|
| 1515 | // ---------------------- |
|---|
| 1516 | |
|---|
| 1517 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 1518 | spells[0].info = dbcSpell.LookupEntry(DISEISE_BUFFET); |
|---|
| 1519 | spells[0].targettype = TARGET_ATTACKING; |
|---|
| 1520 | spells[0].instant = false; |
|---|
| 1521 | spells[0].perctrigger = 20.0f; |
|---|
| 1522 | spells[0].attackstoptimer = 1000; // 1sec |
|---|
| 1523 | |
|---|
| 1524 | spells[1].info = dbcSpell.LookupEntry(SUMMON_BILE_SLIMES); |
|---|
| 1525 | spells[1].targettype = TARGET_SELF; |
|---|
| 1526 | spells[1].instant = false; |
|---|
| 1527 | spells[1].perctrigger = 5.0f; |
|---|
| 1528 | spells[1].attackstoptimer = 3000; // 1sec |
|---|
| 1529 | |
|---|
| 1530 | } |
|---|
| 1531 | |
|---|
| 1532 | void OnCombatStart(Unit* mTarget) |
|---|
| 1533 | { |
|---|
| 1534 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 1535 | } |
|---|
| 1536 | |
|---|
| 1537 | void OnCombatStop(Unit* mTarget) |
|---|
| 1538 | { |
|---|
| 1539 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 1540 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 1541 | RemoveAIUpdateEvent(); |
|---|
| 1542 | } |
|---|
| 1543 | |
|---|
| 1544 | void OnDied(Unit* mKiller) |
|---|
| 1545 | { |
|---|
| 1546 | RemoveAIUpdateEvent(); |
|---|
| 1547 | } |
|---|
| 1548 | |
|---|
| 1549 | void AIUpdate() |
|---|
| 1550 | { |
|---|
| 1551 | float val = (float)RandomFloat(100.0f); |
|---|
| 1552 | SpellCast(val); |
|---|
| 1553 | } |
|---|
| 1554 | |
|---|
| 1555 | void SpellCast(float val) |
|---|
| 1556 | { |
|---|
| 1557 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 1558 | { |
|---|
| 1559 | float comulativeperc = 0; |
|---|
| 1560 | Unit* target = NULL; |
|---|
| 1561 | for(int i=0;i<nrspells;i++) |
|---|
| 1562 | { |
|---|
| 1563 | if(!spells[i].perctrigger) continue; |
|---|
| 1564 | |
|---|
| 1565 | if(m_spellcheck[i]) |
|---|
| 1566 | { |
|---|
| 1567 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 1568 | switch(spells[i].targettype) |
|---|
| 1569 | { |
|---|
| 1570 | case TARGET_SELF: |
|---|
| 1571 | case TARGET_VARIOUS: |
|---|
| 1572 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 1573 | case TARGET_ATTACKING: |
|---|
| 1574 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 1575 | case TARGET_DESTINATION: |
|---|
| 1576 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 1577 | } |
|---|
| 1578 | m_spellcheck[i] = false; |
|---|
| 1579 | return; |
|---|
| 1580 | } |
|---|
| 1581 | |
|---|
| 1582 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 1583 | { |
|---|
| 1584 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 1585 | m_spellcheck[i] = true; |
|---|
| 1586 | } |
|---|
| 1587 | comulativeperc += spells[i].perctrigger; |
|---|
| 1588 | } |
|---|
| 1589 | } |
|---|
| 1590 | } |
|---|
| 1591 | |
|---|
| 1592 | protected: |
|---|
| 1593 | |
|---|
| 1594 | int nrspells; |
|---|
| 1595 | }; |
|---|
| 1596 | |
|---|
| 1597 | // BOSS'S |
|---|
| 1598 | |
|---|
| 1599 | // Patchwerk AI |
|---|
| 1600 | |
|---|
| 1601 | |
|---|
| 1602 | // Grobbulus AI |
|---|
| 1603 | #define CN_GROBBULUS 15931 |
|---|
| 1604 | |
|---|
| 1605 | #define POISON_CLOUD_GROB 31259 // self |
|---|
| 1606 | #define SLIME_SPRAY 28157 // various |
|---|
| 1607 | #define SUMMON_FALLOUT_SLIME 28218 // TODO: cast on slime sprayd targets |
|---|
| 1608 | #define MUTATING_INJECTION 28169 // TODO: DUMMY AURA |
|---|
| 1609 | |
|---|
| 1610 | class GrobbulusAI : public CreatureAIScript |
|---|
| 1611 | { |
|---|
| 1612 | public: |
|---|
| 1613 | ADD_CREATURE_FACTORY_FUNCTION(GrobbulusAI); |
|---|
| 1614 | SP_AI_Spell spells[2]; |
|---|
| 1615 | bool m_spellcheck[2]; |
|---|
| 1616 | |
|---|
| 1617 | GrobbulusAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 1618 | { |
|---|
| 1619 | // -- Number of spells to add -- |
|---|
| 1620 | nrspells = 2; |
|---|
| 1621 | |
|---|
| 1622 | // --- Initialization --- |
|---|
| 1623 | for(int i=0;i<nrspells;i++) |
|---|
| 1624 | { |
|---|
| 1625 | m_spellcheck[i] = false; |
|---|
| 1626 | } |
|---|
| 1627 | // ---------------------- |
|---|
| 1628 | |
|---|
| 1629 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 1630 | spells[0].info = dbcSpell.LookupEntry(POISON_CLOUD_GROB); |
|---|
| 1631 | spells[0].targettype = TARGET_SELF; |
|---|
| 1632 | spells[0].instant = false; |
|---|
| 1633 | spells[0].perctrigger = 0.0f; |
|---|
| 1634 | spells[0].attackstoptimer = 1000; // 1sec |
|---|
| 1635 | |
|---|
| 1636 | spells[1].info = dbcSpell.LookupEntry(SLIME_SPRAY); |
|---|
| 1637 | spells[1].targettype = TARGET_VARIOUS; |
|---|
| 1638 | spells[1].instant = false; |
|---|
| 1639 | spells[1].perctrigger = 15.0f; |
|---|
| 1640 | spells[1].attackstoptimer = 3000; // 1sec |
|---|
| 1641 | |
|---|
| 1642 | } |
|---|
| 1643 | |
|---|
| 1644 | void OnCombatStart(Unit* mTarget) |
|---|
| 1645 | { |
|---|
| 1646 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 1647 | _unit->CastSpell(_unit, spells[0].info, spells[0].instant); |
|---|
| 1648 | } |
|---|
| 1649 | |
|---|
| 1650 | void OnCombatStop(Unit* mTarget) |
|---|
| 1651 | { |
|---|
| 1652 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 1653 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 1654 | RemoveAIUpdateEvent(); |
|---|
| 1655 | } |
|---|
| 1656 | |
|---|
| 1657 | void OnDied(Unit* mKiller) |
|---|
| 1658 | { |
|---|
| 1659 | RemoveAIUpdateEvent(); |
|---|
| 1660 | } |
|---|
| 1661 | |
|---|
| 1662 | void AIUpdate() |
|---|
| 1663 | { |
|---|
| 1664 | float val = (float)RandomFloat(100.0f); |
|---|
| 1665 | SpellCast(val); |
|---|
| 1666 | } |
|---|
| 1667 | |
|---|
| 1668 | void SpellCast(float val) |
|---|
| 1669 | { |
|---|
| 1670 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 1671 | { |
|---|
| 1672 | float comulativeperc = 0; |
|---|
| 1673 | Unit* target = NULL; |
|---|
| 1674 | for(int i=0;i<nrspells;i++) |
|---|
| 1675 | { |
|---|
| 1676 | if(!spells[i].perctrigger) continue; |
|---|
| 1677 | |
|---|
| 1678 | if(m_spellcheck[i]) |
|---|
| 1679 | { |
|---|
| 1680 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 1681 | switch(spells[i].targettype) |
|---|
| 1682 | { |
|---|
| 1683 | case TARGET_SELF: |
|---|
| 1684 | case TARGET_VARIOUS: |
|---|
| 1685 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 1686 | case TARGET_ATTACKING: |
|---|
| 1687 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 1688 | case TARGET_DESTINATION: |
|---|
| 1689 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 1690 | } |
|---|
| 1691 | m_spellcheck[i] = false; |
|---|
| 1692 | return; |
|---|
| 1693 | } |
|---|
| 1694 | |
|---|
| 1695 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 1696 | { |
|---|
| 1697 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 1698 | m_spellcheck[i] = true; |
|---|
| 1699 | } |
|---|
| 1700 | comulativeperc += spells[i].perctrigger; |
|---|
| 1701 | } |
|---|
| 1702 | } |
|---|
| 1703 | } |
|---|
| 1704 | |
|---|
| 1705 | protected: |
|---|
| 1706 | |
|---|
| 1707 | int nrspells; |
|---|
| 1708 | }; |
|---|
| 1709 | |
|---|
| 1710 | |
|---|
| 1711 | // Gluth AI |
|---|
| 1712 | #define CN_GLUTH 15932 |
|---|
| 1713 | |
|---|
| 1714 | #define MORTAL_WOUND 28308 // target |
|---|
| 1715 | #define DECIMATE 28374 // TODO: needs to be scripted |
|---|
| 1716 | #define TERRIFYING_ROAR 37939 |
|---|
| 1717 | #define FRENZY 38664 // self |
|---|
| 1718 | |
|---|
| 1719 | class GluthAI : public CreatureAIScript |
|---|
| 1720 | { |
|---|
| 1721 | public: |
|---|
| 1722 | ADD_CREATURE_FACTORY_FUNCTION(GluthAI); |
|---|
| 1723 | SP_AI_Spell spells[3]; |
|---|
| 1724 | bool m_spellcheck[3]; |
|---|
| 1725 | |
|---|
| 1726 | GluthAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 1727 | { |
|---|
| 1728 | // -- Number of spells to add -- |
|---|
| 1729 | nrspells = 3; |
|---|
| 1730 | |
|---|
| 1731 | // --- Initialization --- |
|---|
| 1732 | for(int i=0;i<nrspells;i++) |
|---|
| 1733 | { |
|---|
| 1734 | m_spellcheck[i] = false; |
|---|
| 1735 | } |
|---|
| 1736 | // ---------------------- |
|---|
| 1737 | |
|---|
| 1738 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 1739 | spells[0].info = dbcSpell.LookupEntry(MORTAL_WOUND); |
|---|
| 1740 | spells[0].targettype = TARGET_ATTACKING; |
|---|
| 1741 | spells[0].instant = false; |
|---|
| 1742 | spells[0].perctrigger = 15.0f; |
|---|
| 1743 | spells[0].attackstoptimer = 2000; // 1sec |
|---|
| 1744 | |
|---|
| 1745 | spells[1].info = dbcSpell.LookupEntry(TERRIFYING_ROAR); |
|---|
| 1746 | spells[1].targettype = TARGET_VARIOUS; |
|---|
| 1747 | spells[1].instant = false; |
|---|
| 1748 | spells[1].perctrigger = 5.0f; |
|---|
| 1749 | spells[1].attackstoptimer = 3000; // 1sec |
|---|
| 1750 | |
|---|
| 1751 | spells[2].info = dbcSpell.LookupEntry(FRENZY); |
|---|
| 1752 | spells[2].targettype = TARGET_SELF; |
|---|
| 1753 | spells[2].instant = false; |
|---|
| 1754 | spells[2].perctrigger = 5.0f; |
|---|
| 1755 | spells[2].attackstoptimer = 1000; // 1sec |
|---|
| 1756 | |
|---|
| 1757 | } |
|---|
| 1758 | |
|---|
| 1759 | void OnCombatStart(Unit* mTarget) |
|---|
| 1760 | { |
|---|
| 1761 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 1762 | } |
|---|
| 1763 | |
|---|
| 1764 | void OnCombatStop(Unit* mTarget) |
|---|
| 1765 | { |
|---|
| 1766 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 1767 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 1768 | RemoveAIUpdateEvent(); |
|---|
| 1769 | } |
|---|
| 1770 | |
|---|
| 1771 | void OnTargetDied(Unit* mTarget) |
|---|
| 1772 | { |
|---|
| 1773 | } |
|---|
| 1774 | |
|---|
| 1775 | void OnDied(Unit* mKiller) |
|---|
| 1776 | { |
|---|
| 1777 | RemoveAIUpdateEvent(); |
|---|
| 1778 | } |
|---|
| 1779 | |
|---|
| 1780 | void AIUpdate() |
|---|
| 1781 | { |
|---|
| 1782 | float val = (float)RandomFloat(100.0f); |
|---|
| 1783 | SpellCast(val); |
|---|
| 1784 | } |
|---|
| 1785 | |
|---|
| 1786 | void SpellCast(float val) |
|---|
| 1787 | { |
|---|
| 1788 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 1789 | { |
|---|
| 1790 | float comulativeperc = 0; |
|---|
| 1791 | Unit* target = NULL; |
|---|
| 1792 | for(int i=0;i<nrspells;i++) |
|---|
| 1793 | { |
|---|
| 1794 | if(!spells[i].perctrigger) continue; |
|---|
| 1795 | |
|---|
| 1796 | if(m_spellcheck[i]) |
|---|
| 1797 | { |
|---|
| 1798 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 1799 | switch(spells[i].targettype) |
|---|
| 1800 | { |
|---|
| 1801 | case TARGET_SELF: |
|---|
| 1802 | case TARGET_VARIOUS: |
|---|
| 1803 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 1804 | case TARGET_ATTACKING: |
|---|
| 1805 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 1806 | case TARGET_DESTINATION: |
|---|
| 1807 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 1808 | } |
|---|
| 1809 | m_spellcheck[i] = false; |
|---|
| 1810 | return; |
|---|
| 1811 | } |
|---|
| 1812 | |
|---|
| 1813 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 1814 | { |
|---|
| 1815 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 1816 | m_spellcheck[i] = true; |
|---|
| 1817 | } |
|---|
| 1818 | comulativeperc += spells[i].perctrigger; |
|---|
| 1819 | } |
|---|
| 1820 | } |
|---|
| 1821 | } |
|---|
| 1822 | |
|---|
| 1823 | protected: |
|---|
| 1824 | |
|---|
| 1825 | int nrspells; |
|---|
| 1826 | }; |
|---|
| 1827 | |
|---|
| 1828 | // ---- Deathknight Wing ---- |
|---|
| 1829 | |
|---|
| 1830 | // Bony Construct AI |
|---|
| 1831 | #define CN_BONY_CONSTRUCT 16167 |
|---|
| 1832 | |
|---|
| 1833 | #define SWEEPING_SLAM 25322 |
|---|
| 1834 | //TODO: Melee Chain Cleave - Strikes enemies in front of the Construct, chaining to anyone in melee range of the targets. |
|---|
| 1835 | |
|---|
| 1836 | class BonyConstructAI : public CreatureAIScript |
|---|
| 1837 | { |
|---|
| 1838 | public: |
|---|
| 1839 | ADD_CREATURE_FACTORY_FUNCTION(BonyConstructAI); |
|---|
| 1840 | SP_AI_Spell spells[1]; |
|---|
| 1841 | bool m_spellcheck[1]; |
|---|
| 1842 | |
|---|
| 1843 | BonyConstructAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 1844 | { |
|---|
| 1845 | // -- Number of spells to add -- |
|---|
| 1846 | nrspells = 1; |
|---|
| 1847 | |
|---|
| 1848 | // --- Initialization --- |
|---|
| 1849 | for(int i=0;i<nrspells;i++) |
|---|
| 1850 | { |
|---|
| 1851 | m_spellcheck[i] = false; |
|---|
| 1852 | } |
|---|
| 1853 | // ---------------------- |
|---|
| 1854 | |
|---|
| 1855 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 1856 | spells[0].info = dbcSpell.LookupEntry(SWEEPING_SLAM); |
|---|
| 1857 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 1858 | spells[0].instant = false; |
|---|
| 1859 | spells[0].perctrigger = 15.0f; |
|---|
| 1860 | spells[0].attackstoptimer = 2000; // 1sec |
|---|
| 1861 | |
|---|
| 1862 | } |
|---|
| 1863 | |
|---|
| 1864 | void OnCombatStart(Unit* mTarget) |
|---|
| 1865 | { |
|---|
| 1866 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 1867 | } |
|---|
| 1868 | |
|---|
| 1869 | void OnCombatStop(Unit* mTarget) |
|---|
| 1870 | { |
|---|
| 1871 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 1872 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 1873 | RemoveAIUpdateEvent(); |
|---|
| 1874 | } |
|---|
| 1875 | |
|---|
| 1876 | void OnDied(Unit* mKiller) |
|---|
| 1877 | { |
|---|
| 1878 | RemoveAIUpdateEvent(); |
|---|
| 1879 | } |
|---|
| 1880 | |
|---|
| 1881 | void AIUpdate() |
|---|
| 1882 | { |
|---|
| 1883 | float val = (float)RandomFloat(100.0f); |
|---|
| 1884 | SpellCast(val); |
|---|
| 1885 | } |
|---|
| 1886 | |
|---|
| 1887 | void SpellCast(float val) |
|---|
| 1888 | { |
|---|
| 1889 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 1890 | { |
|---|
| 1891 | float comulativeperc = 0; |
|---|
| 1892 | Unit* target = NULL; |
|---|
| 1893 | for(int i=0;i<nrspells;i++) |
|---|
| 1894 | { |
|---|
| 1895 | if(!spells[i].perctrigger) continue; |
|---|
| 1896 | |
|---|
| 1897 | if(m_spellcheck[i]) |
|---|
| 1898 | { |
|---|
| 1899 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 1900 | switch(spells[i].targettype) |
|---|
| 1901 | { |
|---|
| 1902 | case TARGET_SELF: |
|---|
| 1903 | case TARGET_VARIOUS: |
|---|
| 1904 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 1905 | case TARGET_ATTACKING: |
|---|
| 1906 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 1907 | case TARGET_DESTINATION: |
|---|
| 1908 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 1909 | } |
|---|
| 1910 | m_spellcheck[i] = false; |
|---|
| 1911 | return; |
|---|
| 1912 | } |
|---|
| 1913 | |
|---|
| 1914 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 1915 | { |
|---|
| 1916 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 1917 | m_spellcheck[i] = true; |
|---|
| 1918 | } |
|---|
| 1919 | comulativeperc += spells[i].perctrigger; |
|---|
| 1920 | } |
|---|
| 1921 | } |
|---|
| 1922 | } |
|---|
| 1923 | |
|---|
| 1924 | protected: |
|---|
| 1925 | |
|---|
| 1926 | int nrspells; |
|---|
| 1927 | }; |
|---|
| 1928 | |
|---|
| 1929 | |
|---|
| 1930 | |
|---|
| 1931 | // Death Lord AI |
|---|
| 1932 | #define CN_DEATH_LORD 16861 |
|---|
| 1933 | |
|---|
| 1934 | #define AURA_OF_AGONY 28413 |
|---|
| 1935 | |
|---|
| 1936 | class DeathLordAI : public CreatureAIScript |
|---|
| 1937 | { |
|---|
| 1938 | public: |
|---|
| 1939 | ADD_CREATURE_FACTORY_FUNCTION(DeathLordAI); |
|---|
| 1940 | SP_AI_Spell spells[1]; |
|---|
| 1941 | bool m_spellcheck[1]; |
|---|
| 1942 | |
|---|
| 1943 | DeathLordAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 1944 | { |
|---|
| 1945 | // -- Number of spells to add -- |
|---|
| 1946 | nrspells = 1; |
|---|
| 1947 | |
|---|
| 1948 | // --- Initialization --- |
|---|
| 1949 | for(int i=0;i<nrspells;i++) |
|---|
| 1950 | { |
|---|
| 1951 | m_spellcheck[i] = false; |
|---|
| 1952 | } |
|---|
| 1953 | // ---------------------- |
|---|
| 1954 | |
|---|
| 1955 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 1956 | spells[0].info = dbcSpell.LookupEntry(AURA_OF_AGONY); |
|---|
| 1957 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 1958 | spells[0].instant = false; |
|---|
| 1959 | spells[0].perctrigger = 15.0f; |
|---|
| 1960 | spells[0].attackstoptimer = 2000; // 1sec |
|---|
| 1961 | |
|---|
| 1962 | } |
|---|
| 1963 | |
|---|
| 1964 | void OnCombatStart(Unit* mTarget) |
|---|
| 1965 | { |
|---|
| 1966 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 1967 | } |
|---|
| 1968 | |
|---|
| 1969 | void OnCombatStop(Unit* mTarget) |
|---|
| 1970 | { |
|---|
| 1971 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 1972 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 1973 | RemoveAIUpdateEvent(); |
|---|
| 1974 | } |
|---|
| 1975 | |
|---|
| 1976 | void OnDied(Unit* mKiller) |
|---|
| 1977 | { |
|---|
| 1978 | RemoveAIUpdateEvent(); |
|---|
| 1979 | } |
|---|
| 1980 | |
|---|
| 1981 | void AIUpdate() |
|---|
| 1982 | { |
|---|
| 1983 | float val = (float)RandomFloat(100.0f); |
|---|
| 1984 | SpellCast(val); |
|---|
| 1985 | } |
|---|
| 1986 | |
|---|
| 1987 | void SpellCast(float val) |
|---|
| 1988 | { |
|---|
| 1989 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 1990 | { |
|---|
| 1991 | float comulativeperc = 0; |
|---|
| 1992 | Unit* target = NULL; |
|---|
| 1993 | for(int i=0;i<nrspells;i++) |
|---|
| 1994 | { |
|---|
| 1995 | if(!spells[i].perctrigger) continue; |
|---|
| 1996 | |
|---|
| 1997 | if(m_spellcheck[i]) |
|---|
| 1998 | { |
|---|
| 1999 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 2000 | switch(spells[i].targettype) |
|---|
| 2001 | { |
|---|
| 2002 | case TARGET_SELF: |
|---|
| 2003 | case TARGET_VARIOUS: |
|---|
| 2004 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 2005 | case TARGET_ATTACKING: |
|---|
| 2006 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 2007 | case TARGET_DESTINATION: |
|---|
| 2008 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 2009 | } |
|---|
| 2010 | m_spellcheck[i] = false; |
|---|
| 2011 | return; |
|---|
| 2012 | } |
|---|
| 2013 | |
|---|
| 2014 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 2015 | { |
|---|
| 2016 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 2017 | m_spellcheck[i] = true; |
|---|
| 2018 | } |
|---|
| 2019 | comulativeperc += spells[i].perctrigger; |
|---|
| 2020 | } |
|---|
| 2021 | } |
|---|
| 2022 | } |
|---|
| 2023 | |
|---|
| 2024 | protected: |
|---|
| 2025 | |
|---|
| 2026 | int nrspells; |
|---|
| 2027 | }; |
|---|
| 2028 | |
|---|
| 2029 | // -- BOSS'S -- |
|---|
| 2030 | |
|---|
| 2031 | // Instructor Razuvious AI |
|---|
| 2032 | #define CN_INSTRUCTOR_RAZUVIOUS 16061 |
|---|
| 2033 | |
|---|
| 2034 | #define UNBALANCING_STRIKE 26613 |
|---|
| 2035 | #define DISRUPTING_SHOUT 29107 |
|---|
| 2036 | |
|---|
| 2037 | class RazuviousAI : public CreatureAIScript |
|---|
| 2038 | { |
|---|
| 2039 | public: |
|---|
| 2040 | ADD_CREATURE_FACTORY_FUNCTION(RazuviousAI); |
|---|
| 2041 | SP_AI_Spell spells[2]; |
|---|
| 2042 | bool m_spellcheck[2]; |
|---|
| 2043 | |
|---|
| 2044 | RazuviousAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2045 | { |
|---|
| 2046 | // -- Number of spells to add -- |
|---|
| 2047 | nrspells = 2; |
|---|
| 2048 | |
|---|
| 2049 | // --- Initialization --- |
|---|
| 2050 | for(int i=0;i<nrspells;i++) |
|---|
| 2051 | { |
|---|
| 2052 | m_spellcheck[i] = false; |
|---|
| 2053 | } |
|---|
| 2054 | // ---------------------- |
|---|
| 2055 | |
|---|
| 2056 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 2057 | spells[0].info = dbcSpell.LookupEntry(DISRUPTING_SHOUT); |
|---|
| 2058 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 2059 | spells[0].instant = false; |
|---|
| 2060 | spells[0].perctrigger = 15.0f; |
|---|
| 2061 | spells[0].attackstoptimer = 3000; // 1sec |
|---|
| 2062 | |
|---|
| 2063 | spells[1].info = dbcSpell.LookupEntry(UNBALANCING_STRIKE); |
|---|
| 2064 | spells[1].targettype = TARGET_ATTACKING; |
|---|
| 2065 | spells[1].instant = false; |
|---|
| 2066 | spells[1].perctrigger = 35.0f; |
|---|
| 2067 | spells[1].attackstoptimer = 1000; // 1sec |
|---|
| 2068 | |
|---|
| 2069 | } |
|---|
| 2070 | |
|---|
| 2071 | void OnCombatStart(Unit* mTarget) |
|---|
| 2072 | { |
|---|
| 2073 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 2074 | } |
|---|
| 2075 | |
|---|
| 2076 | void OnCombatStop(Unit* mTarget) |
|---|
| 2077 | { |
|---|
| 2078 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2079 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2080 | RemoveAIUpdateEvent(); |
|---|
| 2081 | } |
|---|
| 2082 | |
|---|
| 2083 | void OnTargetDied(Unit* mTarget) |
|---|
| 2084 | { |
|---|
| 2085 | if(Rand(50.0f)) |
|---|
| 2086 | { |
|---|
| 2087 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You should've stayed home!"); |
|---|
| 2088 | _unit->PlaySoundToSet(8862); |
|---|
| 2089 | } |
|---|
| 2090 | else |
|---|
| 2091 | { |
|---|
| 2092 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You disappoint me, students!"); |
|---|
| 2093 | _unit->PlaySoundToSet(8863); |
|---|
| 2094 | } |
|---|
| 2095 | } |
|---|
| 2096 | |
|---|
| 2097 | void OnDied(Unit* mKiller) |
|---|
| 2098 | { |
|---|
| 2099 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "An honorable... death..."); |
|---|
| 2100 | _unit->PlaySoundToSet(8860); |
|---|
| 2101 | RemoveAIUpdateEvent(); |
|---|
| 2102 | } |
|---|
| 2103 | |
|---|
| 2104 | void AIUpdate() |
|---|
| 2105 | { |
|---|
| 2106 | float val = (float)RandomFloat(100.0f); |
|---|
| 2107 | SpellCast(val); |
|---|
| 2108 | } |
|---|
| 2109 | |
|---|
| 2110 | void SpellCast(float val) |
|---|
| 2111 | { |
|---|
| 2112 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 2113 | { |
|---|
| 2114 | float comulativeperc = 0; |
|---|
| 2115 | Unit* target = NULL; |
|---|
| 2116 | for(int i=0;i<nrspells;i++) |
|---|
| 2117 | { |
|---|
| 2118 | if(!spells[i].perctrigger) continue; |
|---|
| 2119 | |
|---|
| 2120 | if(m_spellcheck[i]) |
|---|
| 2121 | { |
|---|
| 2122 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 2123 | switch(spells[i].targettype) |
|---|
| 2124 | { |
|---|
| 2125 | case TARGET_SELF: |
|---|
| 2126 | case TARGET_VARIOUS: |
|---|
| 2127 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 2128 | case TARGET_ATTACKING: |
|---|
| 2129 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 2130 | case TARGET_DESTINATION: |
|---|
| 2131 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 2132 | } |
|---|
| 2133 | m_spellcheck[i] = false; |
|---|
| 2134 | return; |
|---|
| 2135 | } |
|---|
| 2136 | |
|---|
| 2137 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 2138 | { |
|---|
| 2139 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 2140 | m_spellcheck[i] = true; |
|---|
| 2141 | } |
|---|
| 2142 | comulativeperc += spells[i].perctrigger; |
|---|
| 2143 | } |
|---|
| 2144 | } |
|---|
| 2145 | } |
|---|
| 2146 | |
|---|
| 2147 | protected: |
|---|
| 2148 | |
|---|
| 2149 | int nrspells; |
|---|
| 2150 | }; |
|---|
| 2151 | // - The Four Horsemen: - |
|---|
| 2152 | |
|---|
| 2153 | // Thane Korth'azz AI |
|---|
| 2154 | #define CN_THANE_KORTHAZZ 16064 |
|---|
| 2155 | |
|---|
| 2156 | #define MARK_OF_KORTHAZZ 28832 |
|---|
| 2157 | #define METEOR 35181 // 1 target |
|---|
| 2158 | |
|---|
| 2159 | class KorthazzAI : public CreatureAIScript |
|---|
| 2160 | { |
|---|
| 2161 | public: |
|---|
| 2162 | ADD_CREATURE_FACTORY_FUNCTION(KorthazzAI); |
|---|
| 2163 | SP_AI_Spell spells[2]; |
|---|
| 2164 | bool m_spellcheck[2]; |
|---|
| 2165 | |
|---|
| 2166 | KorthazzAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2167 | { |
|---|
| 2168 | // -- Number of spells to add -- |
|---|
| 2169 | nrspells = 2; |
|---|
| 2170 | |
|---|
| 2171 | // --- Initialization --- |
|---|
| 2172 | for(int i=0;i<nrspells;i++) |
|---|
| 2173 | { |
|---|
| 2174 | m_spellcheck[i] = false; |
|---|
| 2175 | } |
|---|
| 2176 | // ---------------------- |
|---|
| 2177 | |
|---|
| 2178 | tountcooldown = 6; |
|---|
| 2179 | tountcont = 0; |
|---|
| 2180 | m_attackstart = false; |
|---|
| 2181 | |
|---|
| 2182 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 2183 | spells[0].info = dbcSpell.LookupEntry(MARK_OF_KORTHAZZ); |
|---|
| 2184 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 2185 | spells[0].instant = false; |
|---|
| 2186 | spells[0].perctrigger = 5.0f; |
|---|
| 2187 | spells[0].attackstoptimer = 1000; // 1sec |
|---|
| 2188 | |
|---|
| 2189 | spells[1].info = dbcSpell.LookupEntry(METEOR); |
|---|
| 2190 | spells[1].targettype = TARGET_ATTACKING; |
|---|
| 2191 | spells[1].instant = false; |
|---|
| 2192 | spells[1].perctrigger = 15.0f; |
|---|
| 2193 | spells[1].attackstoptimer = 3000; // 1sec |
|---|
| 2194 | |
|---|
| 2195 | } |
|---|
| 2196 | |
|---|
| 2197 | void OnCombatStart(Unit* mTarget) |
|---|
| 2198 | { |
|---|
| 2199 | m_attackstart = true; |
|---|
| 2200 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Come out and fight ye wee ninny!"); |
|---|
| 2201 | _unit->PlaySoundToSet(8899); |
|---|
| 2202 | |
|---|
| 2203 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 2204 | } |
|---|
| 2205 | |
|---|
| 2206 | void OnCombatStop(Unit* mTarget) |
|---|
| 2207 | { |
|---|
| 2208 | m_attackstart = false; |
|---|
| 2209 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2210 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2211 | RemoveAIUpdateEvent(); |
|---|
| 2212 | } |
|---|
| 2213 | |
|---|
| 2214 | void OnTargetDied(Unit* mTarget) |
|---|
| 2215 | { |
|---|
| 2216 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Next time, bring more friends!"); |
|---|
| 2217 | _unit->PlaySoundToSet(8901); |
|---|
| 2218 | } |
|---|
| 2219 | |
|---|
| 2220 | void OnDied(Unit* mKiller) |
|---|
| 2221 | { |
|---|
| 2222 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "What a bloody waste this is!"); |
|---|
| 2223 | _unit->PlaySoundToSet(8900); |
|---|
| 2224 | _unit->CastSpell(_unit, spells[1].info, spells[1].instant); |
|---|
| 2225 | RemoveAIUpdateEvent(); |
|---|
| 2226 | } |
|---|
| 2227 | |
|---|
| 2228 | void AIUpdate() |
|---|
| 2229 | { |
|---|
| 2230 | if(!m_attackstart) |
|---|
| 2231 | { |
|---|
| 2232 | if(!tountcooldown) |
|---|
| 2233 | { |
|---|
| 2234 | tountcooldown = 6; |
|---|
| 2235 | |
|---|
| 2236 | switch(tountcont) |
|---|
| 2237 | { |
|---|
| 2238 | case 0: |
|---|
| 2239 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "To arms, ye roustabouts! We've got company!"); |
|---|
| 2240 | _unit->PlaySoundToSet(8903); |
|---|
| 2241 | case 1: |
|---|
| 2242 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I heard about enough of yer sniveling. Shut yer fly trap 'afore I shut it for ye!"); |
|---|
| 2243 | _unit->PlaySoundToSet(8904); |
|---|
| 2244 | case 2: |
|---|
| 2245 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I'm gonna enjoy killin' these slack-jawed daffodils!"); |
|---|
| 2246 | _unit->PlaySoundToSet(8905); |
|---|
| 2247 | |
|---|
| 2248 | } |
|---|
| 2249 | tountcont++; |
|---|
| 2250 | if(tountcont >= 3) |
|---|
| 2251 | tountcont = 0; |
|---|
| 2252 | } |
|---|
| 2253 | tountcooldown--; |
|---|
| 2254 | } |
|---|
| 2255 | |
|---|
| 2256 | if(m_spellcheck[0]) |
|---|
| 2257 | { |
|---|
| 2258 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I like my meat extra crispy!"); |
|---|
| 2259 | _unit->PlaySoundToSet(8902); |
|---|
| 2260 | } |
|---|
| 2261 | |
|---|
| 2262 | float val = (float)RandomFloat(100.0f); |
|---|
| 2263 | SpellCast(val); |
|---|
| 2264 | } |
|---|
| 2265 | |
|---|
| 2266 | void SpellCast(float val) |
|---|
| 2267 | { |
|---|
| 2268 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 2269 | { |
|---|
| 2270 | float comulativeperc = 0; |
|---|
| 2271 | Unit* target = NULL; |
|---|
| 2272 | for(int i=0;i<nrspells;i++) |
|---|
| 2273 | { |
|---|
| 2274 | if(!spells[i].perctrigger) continue; |
|---|
| 2275 | |
|---|
| 2276 | if(m_spellcheck[i]) |
|---|
| 2277 | { |
|---|
| 2278 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 2279 | switch(spells[i].targettype) |
|---|
| 2280 | { |
|---|
| 2281 | case TARGET_SELF: |
|---|
| 2282 | case TARGET_VARIOUS: |
|---|
| 2283 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 2284 | case TARGET_ATTACKING: |
|---|
| 2285 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 2286 | case TARGET_DESTINATION: |
|---|
| 2287 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 2288 | } |
|---|
| 2289 | m_spellcheck[i] = false; |
|---|
| 2290 | return; |
|---|
| 2291 | } |
|---|
| 2292 | |
|---|
| 2293 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 2294 | { |
|---|
| 2295 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 2296 | m_spellcheck[i] = true; |
|---|
| 2297 | } |
|---|
| 2298 | comulativeperc += spells[i].perctrigger; |
|---|
| 2299 | } |
|---|
| 2300 | } |
|---|
| 2301 | } |
|---|
| 2302 | |
|---|
| 2303 | protected: |
|---|
| 2304 | |
|---|
| 2305 | bool m_attackstart; |
|---|
| 2306 | uint32 tountcooldown,tountcont; |
|---|
| 2307 | int nrspells; |
|---|
| 2308 | }; |
|---|
| 2309 | |
|---|
| 2310 | /* |
|---|
| 2311 | 8899 - Come out and fight ye wee ninny! |
|---|
| 2312 | 8900 - what a bloody waste this is! |
|---|
| 2313 | 8901 - next time. bring more friend |
|---|
| 2314 | 8902 - i like my meat extra crispy |
|---|
| 2315 | 8903 - To arms, ye roustabouts! We've got company! |
|---|
| 2316 | 8904 - I heard about enough of yer sniveling. Shut yer fly trap 'afore I shut it for ye! |
|---|
| 2317 | 8905 - I'm gonna enjoy killin' these slack-jawed daffodils! |
|---|
| 2318 | |
|---|
| 2319 | 8899, 'A_KOR_NAXX_AGGRO' |
|---|
| 2320 | 8900, 'A_KOR_NAXX_DEATH' |
|---|
| 2321 | 8901, 'A_KOR_NAXX_SLAY' |
|---|
| 2322 | 8902, 'A_KOR_NAXX_SPECIAL' |
|---|
| 2323 | 8903, 'A_KOR_NAXX_TAUNT01' |
|---|
| 2324 | 8904, 'A_KOR_NAXX_TAUNT02' |
|---|
| 2325 | 8905, 'A_KOR_NAXX_TAUNT03' |
|---|
| 2326 | */ |
|---|
| 2327 | |
|---|
| 2328 | // Baron Rivendare AI |
|---|
| 2329 | #define CN_Baron_Rivendare_4H 30549 //4H not to confuse with Strat UD Side.. |
|---|
| 2330 | //Gief new Strat boss blizz or you make Stab a sad panda |
|---|
| 2331 | |
|---|
| 2332 | |
|---|
| 2333 | // Lady Blaumeux AI |
|---|
| 2334 | #define CN_LADY_BLAUMEUX 16065 |
|---|
| 2335 | |
|---|
| 2336 | #define MARK_OF_BLAUMEUX 28833 |
|---|
| 2337 | #define VOID_ZONE 28863 // TODO: DUMMY PART |
|---|
| 2338 | |
|---|
| 2339 | class BlaumeuxAI : public CreatureAIScript |
|---|
| 2340 | { |
|---|
| 2341 | public: |
|---|
| 2342 | ADD_CREATURE_FACTORY_FUNCTION(BlaumeuxAI); |
|---|
| 2343 | SP_AI_Spell spells[2]; |
|---|
| 2344 | bool m_spellcheck[2]; |
|---|
| 2345 | |
|---|
| 2346 | BlaumeuxAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2347 | { |
|---|
| 2348 | // -- Number of spells to add -- |
|---|
| 2349 | nrspells = 2; |
|---|
| 2350 | |
|---|
| 2351 | // --- Initialization --- |
|---|
| 2352 | for(int i=0;i<nrspells;i++) |
|---|
| 2353 | { |
|---|
| 2354 | m_spellcheck[i] = false; |
|---|
| 2355 | } |
|---|
| 2356 | // ---------------------- |
|---|
| 2357 | |
|---|
| 2358 | tountcooldown = 16; |
|---|
| 2359 | tountcont = 0; |
|---|
| 2360 | m_attackstart = false; |
|---|
| 2361 | |
|---|
| 2362 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 2363 | spells[0].info = dbcSpell.LookupEntry(MARK_OF_BLAUMEUX); |
|---|
| 2364 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 2365 | spells[0].instant = false; |
|---|
| 2366 | spells[0].perctrigger = 5.0f; |
|---|
| 2367 | spells[0].attackstoptimer = 1000; // 1sec |
|---|
| 2368 | |
|---|
| 2369 | spells[1].info = dbcSpell.LookupEntry(VOID_ZONE); |
|---|
| 2370 | spells[1].targettype = TARGET_VARIOUS; |
|---|
| 2371 | spells[1].instant = false; |
|---|
| 2372 | spells[1].perctrigger = 15.0f; |
|---|
| 2373 | spells[1].attackstoptimer = 3000; // 1sec |
|---|
| 2374 | |
|---|
| 2375 | } |
|---|
| 2376 | |
|---|
| 2377 | void OnCombatStart(Unit* mTarget) |
|---|
| 2378 | { |
|---|
| 2379 | m_attackstart = true; |
|---|
| 2380 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Defend yourself!"); |
|---|
| 2381 | _unit->PlaySoundToSet(8892); |
|---|
| 2382 | |
|---|
| 2383 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 2384 | } |
|---|
| 2385 | |
|---|
| 2386 | void OnCombatStop(Unit* mTarget) |
|---|
| 2387 | { |
|---|
| 2388 | m_attackstart = false; |
|---|
| 2389 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2390 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2391 | RemoveAIUpdateEvent(); |
|---|
| 2392 | } |
|---|
| 2393 | |
|---|
| 2394 | void OnTargetDied(Unit* mTarget) |
|---|
| 2395 | { |
|---|
| 2396 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Who's next?"); |
|---|
| 2397 | _unit->PlaySoundToSet(8894); |
|---|
| 2398 | } |
|---|
| 2399 | |
|---|
| 2400 | void OnDied(Unit* mKiller) |
|---|
| 2401 | { |
|---|
| 2402 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Tou...che."); |
|---|
| 2403 | _unit->PlaySoundToSet(8893); |
|---|
| 2404 | _unit->CastSpell(_unit, spells[1].info, spells[1].instant); |
|---|
| 2405 | RemoveAIUpdateEvent(); |
|---|
| 2406 | } |
|---|
| 2407 | |
|---|
| 2408 | void AIUpdate() |
|---|
| 2409 | { |
|---|
| 2410 | if(!m_attackstart) |
|---|
| 2411 | { |
|---|
| 2412 | if(!tountcooldown) |
|---|
| 2413 | { |
|---|
| 2414 | tountcooldown = 16; |
|---|
| 2415 | |
|---|
| 2416 | switch(tountcont) |
|---|
| 2417 | { |
|---|
| 2418 | case 0: |
|---|
| 2419 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Come, Zeliek, do not drive them out. Not before we've had our fun."); |
|---|
| 2420 | _unit->PlaySoundToSet(8896); |
|---|
| 2421 | case 1: |
|---|
| 2422 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I do hope they stay alive long enough for me to... introduce myself."); |
|---|
| 2423 | _unit->PlaySoundToSet(8897); |
|---|
| 2424 | case 2: |
|---|
| 2425 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "The first kill goes to me! Anyone care to wager?"); |
|---|
| 2426 | _unit->PlaySoundToSet(8898); |
|---|
| 2427 | |
|---|
| 2428 | } |
|---|
| 2429 | tountcont++; |
|---|
| 2430 | if(tountcont >= 3) |
|---|
| 2431 | tountcont = 0; |
|---|
| 2432 | } |
|---|
| 2433 | tountcooldown--; |
|---|
| 2434 | } |
|---|
| 2435 | |
|---|
| 2436 | if(m_spellcheck[0]) |
|---|
| 2437 | { |
|---|
| 2438 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your life is mine!"); |
|---|
| 2439 | _unit->PlaySoundToSet(8895); |
|---|
| 2440 | } |
|---|
| 2441 | |
|---|
| 2442 | float val = (float)RandomFloat(100.0f); |
|---|
| 2443 | SpellCast(val); |
|---|
| 2444 | } |
|---|
| 2445 | |
|---|
| 2446 | void SpellCast(float val) |
|---|
| 2447 | { |
|---|
| 2448 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 2449 | { |
|---|
| 2450 | float comulativeperc = 0; |
|---|
| 2451 | Unit* target = NULL; |
|---|
| 2452 | for(int i=0;i<nrspells;i++) |
|---|
| 2453 | { |
|---|
| 2454 | if(!spells[i].perctrigger) continue; |
|---|
| 2455 | |
|---|
| 2456 | if(m_spellcheck[i]) |
|---|
| 2457 | { |
|---|
| 2458 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 2459 | switch(spells[i].targettype) |
|---|
| 2460 | { |
|---|
| 2461 | case TARGET_SELF: |
|---|
| 2462 | case TARGET_VARIOUS: |
|---|
| 2463 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 2464 | case TARGET_ATTACKING: |
|---|
| 2465 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 2466 | case TARGET_DESTINATION: |
|---|
| 2467 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 2468 | } |
|---|
| 2469 | m_spellcheck[i] = false; |
|---|
| 2470 | return; |
|---|
| 2471 | } |
|---|
| 2472 | |
|---|
| 2473 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 2474 | { |
|---|
| 2475 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 2476 | m_spellcheck[i] = true; |
|---|
| 2477 | } |
|---|
| 2478 | comulativeperc += spells[i].perctrigger; |
|---|
| 2479 | } |
|---|
| 2480 | } |
|---|
| 2481 | } |
|---|
| 2482 | |
|---|
| 2483 | protected: |
|---|
| 2484 | |
|---|
| 2485 | bool m_attackstart; |
|---|
| 2486 | uint32 tountcooldown,tountcont; |
|---|
| 2487 | int nrspells; |
|---|
| 2488 | }; |
|---|
| 2489 | |
|---|
| 2490 | /* |
|---|
| 2491 | 8892 - Defend yourself |
|---|
| 2492 | 8893 - Tou...che |
|---|
| 2493 | 8894 - Who's next? |
|---|
| 2494 | 8895 - Your life is mine! |
|---|
| 2495 | 8896 - Come, Zeliek, do not drive them out. Not before we've had our fun |
|---|
| 2496 | 8897 - I do hope they stay alive long enough for me to... introduce myself, |
|---|
| 2497 | 8898 - The first kill goes to me! Anyone care to wager? |
|---|
| 2498 | |
|---|
| 2499 | 8892, 'A_BLA_NAXX_AGGRO' |
|---|
| 2500 | 8893, 'A_BLA_NAXX_DEATH' |
|---|
| 2501 | 8894, 'A_BLA_NAXX_SLAY' |
|---|
| 2502 | 8895, 'A_BLA_NAXX_SPECIAL' |
|---|
| 2503 | 8896, 'A_BLA_NAXX_TAUNT01' |
|---|
| 2504 | 8897, 'A_BLA_NAXX_TAUNT02' |
|---|
| 2505 | 8898, 'A_BLA_NAXX_TAUNT03' |
|---|
| 2506 | */ |
|---|
| 2507 | |
|---|
| 2508 | // Sir Zeliek AI |
|---|
| 2509 | #define CN_SIR_ZELIEK 16063 |
|---|
| 2510 | |
|---|
| 2511 | #define MARK_OF_ZELIEK 28835 |
|---|
| 2512 | #define HOLY_WRATH 32445 // 1target |
|---|
| 2513 | |
|---|
| 2514 | class ZeliekAI : public CreatureAIScript |
|---|
| 2515 | { |
|---|
| 2516 | public: |
|---|
| 2517 | ADD_CREATURE_FACTORY_FUNCTION(ZeliekAI); |
|---|
| 2518 | SP_AI_Spell spells[2]; |
|---|
| 2519 | bool m_spellcheck[2]; |
|---|
| 2520 | |
|---|
| 2521 | ZeliekAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2522 | { |
|---|
| 2523 | // -- Number of spells to add -- |
|---|
| 2524 | nrspells = 2; |
|---|
| 2525 | |
|---|
| 2526 | // --- Initialization --- |
|---|
| 2527 | for(int i=0;i<nrspells;i++) |
|---|
| 2528 | { |
|---|
| 2529 | m_spellcheck[i] = false; |
|---|
| 2530 | } |
|---|
| 2531 | // ---------------------- |
|---|
| 2532 | |
|---|
| 2533 | tountcooldown = 13; |
|---|
| 2534 | tountcont = 0; |
|---|
| 2535 | m_attackstart = false; |
|---|
| 2536 | |
|---|
| 2537 | // Create basic info for spells here, and play with it later , fill always the info, targettype and if is instant or not! |
|---|
| 2538 | spells[0].info = dbcSpell.LookupEntry(MARK_OF_ZELIEK); |
|---|
| 2539 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 2540 | spells[0].instant = false; |
|---|
| 2541 | spells[0].perctrigger = 5.0f; |
|---|
| 2542 | spells[0].attackstoptimer = 1000; // 1sec |
|---|
| 2543 | |
|---|
| 2544 | spells[1].info = dbcSpell.LookupEntry(HOLY_WRATH); |
|---|
| 2545 | spells[1].targettype = TARGET_ATTACKING; |
|---|
| 2546 | spells[1].instant = false; |
|---|
| 2547 | spells[1].perctrigger = 15.0f; |
|---|
| 2548 | spells[1].attackstoptimer = 1000; // 1sec |
|---|
| 2549 | |
|---|
| 2550 | } |
|---|
| 2551 | |
|---|
| 2552 | void OnCombatStart(Unit* mTarget) |
|---|
| 2553 | { |
|---|
| 2554 | m_attackstart = true; |
|---|
| 2555 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Flee before its too late!"); |
|---|
| 2556 | _unit->PlaySoundToSet(8913); |
|---|
| 2557 | |
|---|
| 2558 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 2559 | } |
|---|
| 2560 | |
|---|
| 2561 | void OnCombatStop(Unit* mTarget) |
|---|
| 2562 | { |
|---|
| 2563 | m_attackstart = false; |
|---|
| 2564 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2565 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2566 | RemoveAIUpdateEvent(); |
|---|
| 2567 | } |
|---|
| 2568 | |
|---|
| 2569 | void OnTargetDied(Unit* mTarget) |
|---|
| 2570 | { |
|---|
| 2571 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Forgive me!"); |
|---|
| 2572 | _unit->PlaySoundToSet(8915); |
|---|
| 2573 | } |
|---|
| 2574 | |
|---|
| 2575 | void OnDied(Unit* mKiller) |
|---|
| 2576 | { |
|---|
| 2577 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "It is... as it should be."); |
|---|
| 2578 | _unit->PlaySoundToSet(8914); |
|---|
| 2579 | _unit->CastSpell(_unit, spells[1].info, spells[1].instant); |
|---|
| 2580 | RemoveAIUpdateEvent(); |
|---|
| 2581 | } |
|---|
| 2582 | |
|---|
| 2583 | void AIUpdate() |
|---|
| 2584 | { |
|---|
| 2585 | if(!m_attackstart) |
|---|
| 2586 | { |
|---|
| 2587 | if(!tountcooldown) |
|---|
| 2588 | { |
|---|
| 2589 | tountcooldown = 13; |
|---|
| 2590 | |
|---|
| 2591 | switch(tountcont) |
|---|
| 2592 | { |
|---|
| 2593 | case 0: |
|---|
| 2594 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Invaders, cease this foolish venture at once! Turn away while you still can!"); |
|---|
| 2595 | _unit->PlaySoundToSet(8917); |
|---|
| 2596 | case 1: |
|---|
| 2597 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Perhaps they will come to their senses, and run away as fast as they can!"); |
|---|
| 2598 | _unit->PlaySoundToSet(8918); |
|---|
| 2599 | case 2: |
|---|
| 2600 | _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Do not continue! Turn back while there's still time!"); |
|---|
| 2601 | _unit->PlaySoundToSet(8919); |
|---|
| 2602 | |
|---|
| 2603 | } |
|---|
| 2604 | tountcont++; |
|---|
| 2605 | if(tountcont >= 3) |
|---|
| 2606 | tountcont = 0; |
|---|
| 2607 | } |
|---|
| 2608 | tountcooldown--; |
|---|
| 2609 | } |
|---|
| 2610 | |
|---|
| 2611 | if(m_spellcheck[0]) |
|---|
| 2612 | { |
|---|
| 2613 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "i have no choice but to obey!"); |
|---|
| 2614 | _unit->PlaySoundToSet(8916); |
|---|
| 2615 | } |
|---|
| 2616 | |
|---|
| 2617 | float val = (float)RandomFloat(100.0f); |
|---|
| 2618 | SpellCast(val); |
|---|
| 2619 | } |
|---|
| 2620 | |
|---|
| 2621 | void SpellCast(float val) |
|---|
| 2622 | { |
|---|
| 2623 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 2624 | { |
|---|
| 2625 | float comulativeperc = 0; |
|---|
| 2626 | Unit* target = NULL; |
|---|
| 2627 | for(int i=0;i<nrspells;i++) |
|---|
| 2628 | { |
|---|
| 2629 | if(!spells[i].perctrigger) continue; |
|---|
| 2630 | |
|---|
| 2631 | if(m_spellcheck[i]) |
|---|
| 2632 | { |
|---|
| 2633 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 2634 | switch(spells[i].targettype) |
|---|
| 2635 | { |
|---|
| 2636 | case TARGET_SELF: |
|---|
| 2637 | case TARGET_VARIOUS: |
|---|
| 2638 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 2639 | case TARGET_ATTACKING: |
|---|
| 2640 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 2641 | case TARGET_DESTINATION: |
|---|
| 2642 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 2643 | } |
|---|
| 2644 | m_spellcheck[i] = false; |
|---|
| 2645 | return; |
|---|
| 2646 | } |
|---|
| 2647 | |
|---|
| 2648 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) |
|---|
| 2649 | { |
|---|
| 2650 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 2651 | m_spellcheck[i] = true; |
|---|
| 2652 | } |
|---|
| 2653 | comulativeperc += spells[i].perctrigger; |
|---|
| 2654 | } |
|---|
| 2655 | } |
|---|
| 2656 | } |
|---|
| 2657 | |
|---|
| 2658 | protected: |
|---|
| 2659 | |
|---|
| 2660 | bool m_attackstart; |
|---|
| 2661 | uint32 tountcooldown,tountcont; |
|---|
| 2662 | int nrspells; |
|---|
| 2663 | }; |
|---|
| 2664 | |
|---|
| 2665 | // -- Sapphiron Encounter by M4ksiu -- // |
|---|
| 2666 | |
|---|
| 2667 | // Settings |
|---|
| 2668 | |
|---|
| 2669 | #define DISABLE_FROST_BREATH |
|---|
| 2670 | |
|---|
| 2671 | // Frost Breath TrgiggerAI |
|---|
| 2672 | |
|---|
| 2673 | #define CN_FROST_BREATH_TRIGGER 50010 // Flying "ball" of frost energy |
|---|
| 2674 | #define CN_FROST_BREATH_TRIGGER2 50011 // Explosion |
|---|
| 2675 | #define CN_FROST_BREATH_TRIGGER3 50012 // Wing Buffet |
|---|
| 2676 | #define CN_CHILL_TRIGGER 50013 // Mass chill trigger (used, because we can't cast many aoe triggers on one character >_>) |
|---|
| 2677 | |
|---|
| 2678 | // Air phase spells |
|---|
| 2679 | #define FROST_BREATH 28524 |
|---|
| 2680 | #define FROST_BREATH_EFFECT 30101 |
|---|
| 2681 | #define FROST_BREATH_DAMAGE 29318 |
|---|
| 2682 | |
|---|
| 2683 | // Additional spells |
|---|
| 2684 | #define SAPPHIRONS_WING_BUFFET 29328 |
|---|
| 2685 | |
|---|
| 2686 | struct Spawns |
|---|
| 2687 | { |
|---|
| 2688 | float x; |
|---|
| 2689 | float y; |
|---|
| 2690 | float z; |
|---|
| 2691 | float o; |
|---|
| 2692 | }; |
|---|
| 2693 | |
|---|
| 2694 | struct Spawns PhaseTwoWP[]= |
|---|
| 2695 | { |
|---|
| 2696 | { }, |
|---|
| 2697 | { 3520.820068f, -5233.799805f, 137.626007f, 4.553010f } |
|---|
| 2698 | }; |
|---|
| 2699 | |
|---|
| 2700 | struct Spawns IceBlocks[]= // Those are not blizzlike pos, because those blocks are spawned randomly |
|---|
| 2701 | { |
|---|
| 2702 | { }, |
|---|
| 2703 | { 3580.986084f, -5241.330078f, 137.627304f, 3.006957f }, |
|---|
| 2704 | { 3562.967285f, -5257.952148f, 137.860916f, 2.468959f }, |
|---|
| 2705 | { 3569.620850f, -5276.108398f, 137.582733f, 2.480744f }, |
|---|
| 2706 | { 3551.420410f, -5283.535156f, 137.731903f, 2.009505f }, |
|---|
| 2707 | { 3535.933594f, -5294.710938f, 138.080002f, 1.823366f }, |
|---|
| 2708 | { 3522.235107f, -5286.610352f, 138.115601f, 1.532768f }, |
|---|
| 2709 | { 3503.184814f, -5296.418945f, 138.111252f, 1.222535f }, |
|---|
| 2710 | { 3489.055664f, -5278.863770f, 138.119934f, 0.884814f }, |
|---|
| 2711 | { 3473.002686f, -5277.641602f, 137.733414f, 0.680609f }, |
|---|
| 2712 | { 3472.302734f, -5255.734863f, 137.755569f, 0.331107f }, |
|---|
| 2713 | { 3458.193848f, -5241.013672f, 137.566147f, 0.111195f }, |
|---|
| 2714 | { 3463.324463f, -5221.530273f, 137.634888f, 6.084152f }, |
|---|
| 2715 | { 3467.574219f, -5200.617676f, 137.559662f, 5.860314f }, |
|---|
| 2716 | { 3479.394775f, -5178.301758f, 140.904312f, 5.405583f }, |
|---|
| 2717 | { 3507.219727f, -5180.725098f, 140.625473f, 4.431685f }, |
|---|
| 2718 | { 3518.371338f, -5172.666504f, 142.269135f, 4.694800f }, |
|---|
| 2719 | { 3542.516846f, -5184.699707f, 140.655182f, 4.470973f }, |
|---|
| 2720 | { 3559.013916f, -5183.916016f, 140.899689f, 4.644558f }, |
|---|
| 2721 | { 3559.006592f, -5183.923340f, 140.895554f, 3.952624f }, |
|---|
| 2722 | { 3571.978760f, -5209.633301f, 137.671906f, 3.514374f } |
|---|
| 2723 | }; |
|---|
| 2724 | |
|---|
| 2725 | /*struct Spawns IceBlocks[]= // Those are not blizzlike pos, because those blocks are spawned randomly |
|---|
| 2726 | { |
|---|
| 2727 | { }, |
|---|
| 2728 | { 3580.986084f, -5241.330078f, 137.627304f, 3.006957f }, |
|---|
| 2729 | { 3562.967285f, -5257.952148f, 137.860916f, 2.468959f }, |
|---|
| 2730 | { 3569.620850f, -5276.108398f, 137.582733f, 2.480744f }, |
|---|
| 2731 | |
|---|
| 2732 | { 3535.933594f, -5294.710938f, 138.080002f, 1.823366f }, |
|---|
| 2733 | { 3522.235107f, -5286.610352f, 138.115601f, 1.532768f }, |
|---|
| 2734 | { 3503.184814f, -5296.418945f, 138.111252f, 1.222535f }, |
|---|
| 2735 | |
|---|
| 2736 | { 3473.002686f, -5277.641602f, 137.733414f, 0.680609f }, |
|---|
| 2737 | { 3472.302734f, -5255.734863f, 137.755569f, 0.331107f }, |
|---|
| 2738 | { 3458.193848f, -5241.013672f, 137.566147f, 0.111195f }, |
|---|
| 2739 | |
|---|
| 2740 | { 3467.574219f, -5200.617676f, 137.559662f, 5.860314f }, |
|---|
| 2741 | { 3479.394775f, -5178.301758f, 140.904312f, 5.405583f }, |
|---|
| 2742 | { 3507.219727f, -5180.725098f, 140.625473f, 4.431685f }, |
|---|
| 2743 | |
|---|
| 2744 | { 3542.516846f, -5184.699707f, 140.655182f, 4.470973f }, |
|---|
| 2745 | { 3559.013916f, -5183.916016f, 140.899689f, 4.644558f }, |
|---|
| 2746 | { 3559.006592f, -5183.923340f, 140.895554f, 3.952624f }, |
|---|
| 2747 | |
|---|
| 2748 | { 3551.420410f, -5283.535156f, 137.731903f, 2.009505f }, |
|---|
| 2749 | { 3489.055664f, -5278.863770f, 138.119934f, 0.884814f }, |
|---|
| 2750 | { 3463.324463f, -5221.530273f, 137.634888f, 6.084152f }, |
|---|
| 2751 | { 3518.371338f, -5172.666504f, 142.269135f, 4.694800f }, |
|---|
| 2752 | { 3571.978760f, -5209.633301f, 137.671906f, 3.514374f } |
|---|
| 2753 | };*/ |
|---|
| 2754 | |
|---|
| 2755 | class FrostBreathTriggerAI : public CreatureAIScript |
|---|
| 2756 | { |
|---|
| 2757 | public: |
|---|
| 2758 | ADD_CREATURE_FACTORY_FUNCTION(FrostBreathTriggerAI); |
|---|
| 2759 | |
|---|
| 2760 | FrostBreathTriggerAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2761 | { |
|---|
| 2762 | _unit->GetAIInterface()->MoveTo(PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z + 10.5f, PhaseTwoWP[1].o); |
|---|
| 2763 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); |
|---|
| 2764 | _unit->GetAIInterface()->m_moveFly = true; |
|---|
| 2765 | _unit->m_noRespawn = true; |
|---|
| 2766 | _unit->Despawn(7000, 0); |
|---|
| 2767 | |
|---|
| 2768 | RegisterAIUpdateEvent(1000); |
|---|
| 2769 | |
|---|
| 2770 | AICounter = 7; |
|---|
| 2771 | } |
|---|
| 2772 | |
|---|
| 2773 | void OnCombatStart(Unit* mTarget) {} |
|---|
| 2774 | |
|---|
| 2775 | void OnCombatStop(Unit* mTarget) |
|---|
| 2776 | { |
|---|
| 2777 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2778 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2779 | } |
|---|
| 2780 | |
|---|
| 2781 | void OnDied(Unit* mKiller) |
|---|
| 2782 | { |
|---|
| 2783 | RemoveAIUpdateEvent(); |
|---|
| 2784 | } |
|---|
| 2785 | |
|---|
| 2786 | void AIUpdate() |
|---|
| 2787 | { |
|---|
| 2788 | _unit->CastSpell(_unit, FROST_BREATH_EFFECT, true); |
|---|
| 2789 | |
|---|
| 2790 | AICounter--; |
|---|
| 2791 | if (AICounter == 6) |
|---|
| 2792 | _unit->GetAIInterface()->MoveTo(PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z + AICounter * 1.5f, PhaseTwoWP[1].o); |
|---|
| 2793 | else |
|---|
| 2794 | _unit->GetAIInterface()->MoveTo(PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z, PhaseTwoWP[1].o); |
|---|
| 2795 | } |
|---|
| 2796 | |
|---|
| 2797 | protected: |
|---|
| 2798 | |
|---|
| 2799 | int AICounter; |
|---|
| 2800 | }; |
|---|
| 2801 | |
|---|
| 2802 | class FrostBreathTrigger2AI : public CreatureAIScript |
|---|
| 2803 | { |
|---|
| 2804 | public: |
|---|
| 2805 | ADD_CREATURE_FACTORY_FUNCTION(FrostBreathTrigger2AI); |
|---|
| 2806 | |
|---|
| 2807 | FrostBreathTrigger2AI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2808 | { |
|---|
| 2809 | #ifdef DISABLE_FROST_BREATH |
|---|
| 2810 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); |
|---|
| 2811 | #else |
|---|
| 2812 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); |
|---|
| 2813 | #endif |
|---|
| 2814 | _unit->GetAIInterface()->disable_melee = true; |
|---|
| 2815 | _unit->GetAIInterface()->m_canMove = false; |
|---|
| 2816 | _unit->m_noRespawn = true; |
|---|
| 2817 | _unit->Despawn(8000, 0); |
|---|
| 2818 | |
|---|
| 2819 | _unit->CastSpell(_unit, FROST_BREATH, false); |
|---|
| 2820 | } |
|---|
| 2821 | |
|---|
| 2822 | void OnCombatStop(Unit* mTarget) |
|---|
| 2823 | { |
|---|
| 2824 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2825 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2826 | } |
|---|
| 2827 | |
|---|
| 2828 | void OnDied(Unit* mKiller) |
|---|
| 2829 | { |
|---|
| 2830 | RemoveAIUpdateEvent(); |
|---|
| 2831 | } |
|---|
| 2832 | }; |
|---|
| 2833 | |
|---|
| 2834 | class FrostBreathTrigger3AI : public CreatureAIScript |
|---|
| 2835 | { |
|---|
| 2836 | public: |
|---|
| 2837 | ADD_CREATURE_FACTORY_FUNCTION(FrostBreathTrigger3AI); |
|---|
| 2838 | |
|---|
| 2839 | FrostBreathTrigger3AI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2840 | { |
|---|
| 2841 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); |
|---|
| 2842 | _unit->CastSpell(_unit, SAPPHIRONS_WING_BUFFET, true); |
|---|
| 2843 | _unit->GetAIInterface()->disable_melee = true; |
|---|
| 2844 | _unit->GetAIInterface()->m_canMove = false; |
|---|
| 2845 | _unit->m_noRespawn = true; |
|---|
| 2846 | |
|---|
| 2847 | RegisterAIUpdateEvent(1000); |
|---|
| 2848 | } |
|---|
| 2849 | |
|---|
| 2850 | void OnCombatStop(Unit* mTarget) |
|---|
| 2851 | { |
|---|
| 2852 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2853 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2854 | } |
|---|
| 2855 | |
|---|
| 2856 | void OnDied(Unit* mKiller) |
|---|
| 2857 | { |
|---|
| 2858 | RemoveAIUpdateEvent(); |
|---|
| 2859 | } |
|---|
| 2860 | |
|---|
| 2861 | void AIUpdate() |
|---|
| 2862 | { |
|---|
| 2863 | _unit->CastSpell(_unit, SAPPHIRONS_WING_BUFFET, true); |
|---|
| 2864 | } |
|---|
| 2865 | }; |
|---|
| 2866 | |
|---|
| 2867 | class ChillTriggerAI : public CreatureAIScript |
|---|
| 2868 | { |
|---|
| 2869 | public: |
|---|
| 2870 | ADD_CREATURE_FACTORY_FUNCTION(ChillTriggerAI); |
|---|
| 2871 | |
|---|
| 2872 | ChillTriggerAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2873 | { |
|---|
| 2874 | _unit->CastSpellAoF(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), dbcSpell.LookupEntry(28547), true); |
|---|
| 2875 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); |
|---|
| 2876 | _unit->GetAIInterface()->disable_melee = true; |
|---|
| 2877 | _unit->GetAIInterface()->m_canMove = false; |
|---|
| 2878 | _unit->m_noRespawn = true; |
|---|
| 2879 | _unit->Despawn(15000, 0); |
|---|
| 2880 | } |
|---|
| 2881 | |
|---|
| 2882 | void OnCombatStop(Unit* mTarget) |
|---|
| 2883 | { |
|---|
| 2884 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 2885 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 2886 | } |
|---|
| 2887 | }; |
|---|
| 2888 | |
|---|
| 2889 | // SapphironAI |
|---|
| 2890 | // Missing spawning effect with building skeleton of Sappiron |
|---|
| 2891 | #define CN_SAPPHIRON 15989 |
|---|
| 2892 | |
|---|
| 2893 | // Land phase spells |
|---|
| 2894 | #define LIFE_DRAIN 28542 |
|---|
| 2895 | #define CHILL 28547 |
|---|
| 2896 | #define FROST_AURA 28531 |
|---|
| 2897 | |
|---|
| 2898 | // Air phase spells |
|---|
| 2899 | #define ICEBOLT 28522 |
|---|
| 2900 | |
|---|
| 2901 | // Additional spells |
|---|
| 2902 | #define SAPPHIRON_DIES 29357 |
|---|
| 2903 | #define BERSERK 26662 // 28498 - casts frostbolt (would be cool for Sapphiron), but every 2 sec for 5 min (~16k dmg per hit); |
|---|
| 2904 | // 27680 - 10 mins instead 5 mins |
|---|
| 2905 | // Researches |
|---|
| 2906 | #define SAPPHIRON_BIRTH 181356 |
|---|
| 2907 | #define FROSTWYRM_WATERFALL_DOOR 181225 |
|---|
| 2908 | #define ICE_BLOCK_GO 181247 |
|---|
| 2909 | |
|---|
| 2910 | // Move types |
|---|
| 2911 | #define WALK 0 |
|---|
| 2912 | #define RUN 256 |
|---|
| 2913 | #define FLY 768 |
|---|
| 2914 | |
|---|
| 2915 | // Immunities |
|---|
| 2916 | #define IMMUNITY_DISEASE 6681 |
|---|
| 2917 | #define IMMUNITY_SHADOW 7743 |
|---|
| 2918 | #define IMMUNITY_FROST 7940 |
|---|
| 2919 | #define IMMUNITY_NATURE 7941 |
|---|
| 2920 | #define IMMUNITY_FIRE 7942 |
|---|
| 2921 | #define IMMUNITY_HOLY 34182 |
|---|
| 2922 | #define IMMUNITY_ARCANE 34184 |
|---|
| 2923 | #define IMMUNITY_PHYSICAL 34310 |
|---|
| 2924 | |
|---|
| 2925 | class SapphironAI : public CreatureAIScript |
|---|
| 2926 | { |
|---|
| 2927 | public: |
|---|
| 2928 | ADD_CREATURE_FACTORY_FUNCTION(SapphironAI); |
|---|
| 2929 | SP_AI_Spell spells[4]; |
|---|
| 2930 | bool m_spellcheck[4]; |
|---|
| 2931 | |
|---|
| 2932 | SapphironAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 2933 | { |
|---|
| 2934 | _unit->GetAIInterface()->addWayPoint(CreateWaypoint(1, 3000, RUN)); |
|---|
| 2935 | |
|---|
| 2936 | nrspells = 2; |
|---|
| 2937 | for(int i = 0; i < nrspells; i++) |
|---|
| 2938 | { |
|---|
| 2939 | m_spellcheck[i] = false; |
|---|
| 2940 | spells[i].casttime = 0; |
|---|
| 2941 | } |
|---|
| 2942 | |
|---|
| 2943 | spells[0].info = dbcSpell.LookupEntry(LIFE_DRAIN); |
|---|
| 2944 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 2945 | spells[0].instant = true; |
|---|
| 2946 | spells[0].perctrigger = 8.0f; |
|---|
| 2947 | spells[0].cooldown = 20; |
|---|
| 2948 | spells[0].attackstoptimer = 2000; |
|---|
| 2949 | |
|---|
| 2950 | spells[1].info = dbcSpell.LookupEntry(CHILL); |
|---|
| 2951 | spells[1].targettype = TARGET_RANDOM_DESTINATION; |
|---|
| 2952 | spells[1].instant = true; |
|---|
| 2953 | spells[1].perctrigger = 10.0f; |
|---|
| 2954 | spells[1].cooldown = 15; |
|---|
| 2955 | spells[1].attackstoptimer = 1000; |
|---|
| 2956 | spells[1].mindist2cast = 0.0f; |
|---|
| 2957 | spells[1].maxdist2cast = 40.0f; |
|---|
| 2958 | spells[1].minhp2cast = 0; |
|---|
| 2959 | spells[1].maxhp2cast = 100; |
|---|
| 2960 | |
|---|
| 2961 | spells[2].info = dbcSpell.LookupEntry(ICEBOLT); |
|---|
| 2962 | spells[2].targettype = TARGET_RANDOM_SINGLE; |
|---|
| 2963 | spells[2].instant = true; |
|---|
| 2964 | spells[2].perctrigger = 0.0f; |
|---|
| 2965 | spells[2].cooldown = 0; |
|---|
| 2966 | spells[2].attackstoptimer = 1000; |
|---|
| 2967 | spells[2].mindist2cast = 0.0f; |
|---|
| 2968 | spells[2].maxdist2cast = 70.0f; |
|---|
| 2969 | spells[2].minhp2cast = 0; |
|---|
| 2970 | spells[2].maxhp2cast = 100; |
|---|
| 2971 | |
|---|
| 2972 | spells[3].info = dbcSpell.LookupEntry(BERSERK); |
|---|
| 2973 | spells[3].targettype = TARGET_SELF; |
|---|
| 2974 | spells[3].instant = true; |
|---|
| 2975 | spells[3].perctrigger = 0.0f; |
|---|
| 2976 | spells[3].cooldown = 900; |
|---|
| 2977 | spells[3].attackstoptimer = 1000; |
|---|
| 2978 | |
|---|
| 2979 | _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); |
|---|
| 2980 | _unit->GetAIInterface()->SetAllowedToEnterCombat(true); |
|---|
| 2981 | _unit->GetAIInterface()->m_moveFly = false; |
|---|
| 2982 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 2983 | _unit->CastSpell(_unit, IMMUNITY_FROST, true); |
|---|
| 2984 | |
|---|
| 2985 | WorldPacket data(SMSG_MOVE_UNSET_HOVER, 13); |
|---|
| 2986 | data << _unit->GetNewGUID(); |
|---|
| 2987 | data << uint32(0); |
|---|
| 2988 | _unit->SendMessageToSet(&data, false); |
|---|
| 2989 | |
|---|
| 2990 | ChillCounter = NULL; |
|---|
| 2991 | FlightActions = 0; |
|---|
| 2992 | ChillCounter = 0; |
|---|
| 2993 | PhaseTimer = 0; |
|---|
| 2994 | m_phase = 1; |
|---|
| 2995 | } |
|---|
| 2996 | |
|---|
| 2997 | void OnCombatStart(Unit* mTarget) |
|---|
| 2998 | { |
|---|
| 2999 | for(int i = 0; i < nrspells; i++) |
|---|
| 3000 | spells[i].casttime = 0; |
|---|
| 3001 | |
|---|
| 3002 | spells[3].casttime = (uint32)time(NULL) + spells[3].cooldown; |
|---|
| 3003 | |
|---|
| 3004 | _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); |
|---|
| 3005 | _unit->GetAIInterface()->SetAllowedToEnterCombat(true); |
|---|
| 3006 | _unit->GetAIInterface()->m_moveFly = false; |
|---|
| 3007 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 3008 | |
|---|
| 3009 | WorldPacket data(SMSG_MOVE_UNSET_HOVER, 13); |
|---|
| 3010 | data << _unit->GetNewGUID(); |
|---|
| 3011 | data << uint32(0); |
|---|
| 3012 | _unit->SendMessageToSet(&data, false); |
|---|
| 3013 | |
|---|
| 3014 | GameObject* Waterfall = NULL; |
|---|
| 3015 | Waterfall = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(3536.852783f, -5159.951172f, 143.636139f, FROSTWYRM_WATERFALL_DOOR); |
|---|
| 3016 | if (Waterfall != NULL) |
|---|
| 3017 | { |
|---|
| 3018 | Waterfall->SetState(1); |
|---|
| 3019 | } |
|---|
| 3020 | |
|---|
| 3021 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 3022 | |
|---|
| 3023 | PhaseTimer = (uint32)time(NULL) + 35; |
|---|
| 3024 | ChillCounter = NULL; |
|---|
| 3025 | FlightActions = 0; |
|---|
| 3026 | ChillCounter = 0; |
|---|
| 3027 | m_phase = 1; |
|---|
| 3028 | } |
|---|
| 3029 | |
|---|
| 3030 | void OnCombatStop(Unit* mTarget) |
|---|
| 3031 | { |
|---|
| 3032 | Creature* BreathTrigger = NULL; |
|---|
| 3033 | BreathTrigger = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z, CN_FROST_BREATH_TRIGGER3); |
|---|
| 3034 | if (BreathTrigger != NULL) |
|---|
| 3035 | BreathTrigger->Despawn(0,0); |
|---|
| 3036 | |
|---|
| 3037 | for (int i = 1; i < 21; i++) |
|---|
| 3038 | { |
|---|
| 3039 | GameObject* IceBlock = NULL; |
|---|
| 3040 | IceBlock = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(IceBlocks[i].x, IceBlocks[i].y, IceBlocks[i].z, ICE_BLOCK_GO); |
|---|
| 3041 | if (IceBlock != NULL) |
|---|
| 3042 | { |
|---|
| 3043 | IceBlock->Delete(); |
|---|
| 3044 | } |
|---|
| 3045 | } |
|---|
| 3046 | |
|---|
| 3047 | GameObject* Waterfall = NULL; |
|---|
| 3048 | Waterfall = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(3536.852783f, -5159.951172f, 143.636139f, FROSTWYRM_WATERFALL_DOOR); |
|---|
| 3049 | if (Waterfall != NULL) |
|---|
| 3050 | { |
|---|
| 3051 | Waterfall->SetState(0); |
|---|
| 3052 | } |
|---|
| 3053 | |
|---|
| 3054 | _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); |
|---|
| 3055 | _unit->GetAIInterface()->SetAllowedToEnterCombat(true); |
|---|
| 3056 | _unit->GetAIInterface()->m_moveFly = false; |
|---|
| 3057 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 3058 | |
|---|
| 3059 | WorldPacket data(SMSG_MOVE_UNSET_HOVER, 13); |
|---|
| 3060 | data << _unit->GetNewGUID(); |
|---|
| 3061 | data << uint32(0); |
|---|
| 3062 | _unit->SendMessageToSet(&data, false); |
|---|
| 3063 | |
|---|
| 3064 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 3065 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 3066 | |
|---|
| 3067 | RemoveAIUpdateEvent(); |
|---|
| 3068 | } |
|---|
| 3069 | |
|---|
| 3070 | void OnTargetDied(Unit* mTarget) |
|---|
| 3071 | { |
|---|
| 3072 | } |
|---|
| 3073 | |
|---|
| 3074 | void OnDied(Unit* mKiller) |
|---|
| 3075 | { |
|---|
| 3076 | _unit->CastSpell(_unit, SAPPHIRON_DIES, true); |
|---|
| 3077 | |
|---|
| 3078 | RemoveAIUpdateEvent(); |
|---|
| 3079 | } |
|---|
| 3080 | |
|---|
| 3081 | void AIUpdate() |
|---|
| 3082 | { |
|---|
| 3083 | uint32 t = (uint32)time(NULL); |
|---|
| 3084 | if (t > spells[3].casttime && _unit->GetCurrentSpell() == NULL) |
|---|
| 3085 | { |
|---|
| 3086 | _unit->CastSpell(_unit, spells[3].info, spells[3].instant); |
|---|
| 3087 | |
|---|
| 3088 | spells[3].casttime = t + spells[3].cooldown; |
|---|
| 3089 | } |
|---|
| 3090 | |
|---|
| 3091 | switch (m_phase) |
|---|
| 3092 | { |
|---|
| 3093 | case 1: |
|---|
| 3094 | PhaseOne(); |
|---|
| 3095 | break; |
|---|
| 3096 | case 2: |
|---|
| 3097 | PhaseTwo(); |
|---|
| 3098 | break; |
|---|
| 3099 | default: |
|---|
| 3100 | { |
|---|
| 3101 | } |
|---|
| 3102 | } |
|---|
| 3103 | } |
|---|
| 3104 | |
|---|
| 3105 | void PhaseOne() |
|---|
| 3106 | { |
|---|
| 3107 | _unit->CastSpell(_unit, FROST_AURA, true); |
|---|
| 3108 | |
|---|
| 3109 | if (_unit->GetAIInterface()->getMoveType() == MOVEMENTTYPE_WANTEDWP) |
|---|
| 3110 | return; |
|---|
| 3111 | |
|---|
| 3112 | if (_unit->GetHealthPct() > 10) |
|---|
| 3113 | { |
|---|
| 3114 | uint32 t = (uint32)time(NULL); |
|---|
| 3115 | if (t > PhaseTimer) |
|---|
| 3116 | { |
|---|
| 3117 | if (_unit->GetCurrentSpell() != NULL) |
|---|
| 3118 | _unit->GetCurrentSpell()->cancel(); |
|---|
| 3119 | |
|---|
| 3120 | _unit->GetAIInterface()->SetAllowedToEnterCombat(false); |
|---|
| 3121 | _unit->GetAIInterface()->StopMovement(0); |
|---|
| 3122 | _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); |
|---|
| 3123 | _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); |
|---|
| 3124 | _unit->GetAIInterface()->setWaypointToMove(1); |
|---|
| 3125 | |
|---|
| 3126 | return; |
|---|
| 3127 | } |
|---|
| 3128 | } |
|---|
| 3129 | |
|---|
| 3130 | if (ChillCounter > 0) |
|---|
| 3131 | { |
|---|
| 3132 | ChillCounter--; |
|---|
| 3133 | if (ChillTarget != NULL) |
|---|
| 3134 | { |
|---|
| 3135 | _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_CHILL_TRIGGER, ChillTarget->GetPositionX(), ChillTarget->GetPositionY(), ChillTarget->GetPositionZ(), ChillTarget->GetOrientation(), true, false, 0, 0); |
|---|
| 3136 | } |
|---|
| 3137 | |
|---|
| 3138 | if (ChillCounter == 0) |
|---|
| 3139 | { |
|---|
| 3140 | ChillTarget = NULL; |
|---|
| 3141 | } |
|---|
| 3142 | } |
|---|
| 3143 | |
|---|
| 3144 | float val = (float)RandomFloat(100.0f); |
|---|
| 3145 | SpellCast(val); |
|---|
| 3146 | } |
|---|
| 3147 | |
|---|
| 3148 | void PhaseTwo() |
|---|
| 3149 | { |
|---|
| 3150 | if (FlightActions == 0) |
|---|
| 3151 | { |
|---|
| 3152 | _unit->GetAIInterface()->m_canMove = false; |
|---|
| 3153 | _unit->GetAIInterface()->SetAllowedToEnterCombat(true); |
|---|
| 3154 | _unit->GetAIInterface()->setCurrentAgent(AGENT_SPELL); |
|---|
| 3155 | _unit->GetAIInterface()->SetAIState(STATE_SCRIPTIDLE); |
|---|
| 3156 | _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); |
|---|
| 3157 | _unit->GetAIInterface()->setWaypointToMove(0); |
|---|
| 3158 | } |
|---|
| 3159 | |
|---|
| 3160 | if (FlightActions < 5) |
|---|
| 3161 | { |
|---|
| 3162 | if (_unit->GetCurrentSpell() == NULL) |
|---|
| 3163 | { |
|---|
| 3164 | if (_unit->GetAIInterface()->GetNextTarget() != NULL) |
|---|
| 3165 | { |
|---|
| 3166 | CastSpellOnRandomTarget(2, 0.0f, 40.0f, 0, 100); |
|---|
| 3167 | |
|---|
| 3168 | FlightActions++; |
|---|
| 3169 | if (FlightActions >= 5) |
|---|
| 3170 | { |
|---|
| 3171 | uint32 LastOne = 0; |
|---|
| 3172 | for (int i = 0; i < 2; i++) |
|---|
| 3173 | { |
|---|
| 3174 | uint32 Block = 0; |
|---|
| 3175 | while (LastOne == Block) |
|---|
| 3176 | { |
|---|
| 3177 | Block = RandomUInt(5) + 15; |
|---|
| 3178 | } |
|---|
| 3179 | |
|---|
| 3180 | LastOne = Block; |
|---|
| 3181 | |
|---|
| 3182 | GameObject* IceBlock = NULL; |
|---|
| 3183 | IceBlock = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(ICE_BLOCK_GO, IceBlocks[Block].x, IceBlocks[Block].y, IceBlocks[Block].z, IceBlocks[Block].o, true, 0, 0); |
|---|
| 3184 | if (IceBlock != NULL) |
|---|
| 3185 | { |
|---|
| 3186 | IceBlock->SetUInt32Value(GAMEOBJECT_FLAGS, 1); |
|---|
| 3187 | } |
|---|
| 3188 | } |
|---|
| 3189 | |
|---|
| 3190 | RemoveAIUpdateEvent(); |
|---|
| 3191 | RegisterAIUpdateEvent(3000); |
|---|
| 3192 | |
|---|
| 3193 | FlightActions = 5; |
|---|
| 3194 | } |
|---|
| 3195 | |
|---|
| 3196 | if (FlightActions == 2) |
|---|
| 3197 | { |
|---|
| 3198 | for (int i = 0; i < 2; i++) |
|---|
| 3199 | { |
|---|
| 3200 | uint32 Block = 0; |
|---|
| 3201 | if (i == 0) |
|---|
| 3202 | Block = RandomUInt(3) + 1; |
|---|
| 3203 | else |
|---|
| 3204 | Block = RandomUInt(3) + 10; |
|---|
| 3205 | |
|---|
| 3206 | GameObject* IceBlock = NULL; |
|---|
| 3207 | IceBlock = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(ICE_BLOCK_GO, IceBlocks[Block].x, IceBlocks[Block].y, IceBlocks[Block].z, IceBlocks[Block].o, true, 0, 0); |
|---|
| 3208 | if (IceBlock != NULL) |
|---|
| 3209 | { |
|---|
| 3210 | IceBlock->SetUInt32Value(GAMEOBJECT_FLAGS, 1); |
|---|
| 3211 | } |
|---|
| 3212 | } |
|---|
| 3213 | } |
|---|
| 3214 | |
|---|
| 3215 | if (FlightActions == 4) |
|---|
| 3216 | { |
|---|
| 3217 | for (int i = 0; i < 2; i++) |
|---|
| 3218 | { |
|---|
| 3219 | uint32 Block = 0; |
|---|
| 3220 | if (i == 0) |
|---|
| 3221 | Block = RandomUInt(3) + 7; |
|---|
| 3222 | else |
|---|
| 3223 | Block = RandomUInt(9) + 13; |
|---|
| 3224 | |
|---|
| 3225 | GameObject* IceBlock = NULL; |
|---|
| 3226 | IceBlock = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(ICE_BLOCK_GO, IceBlocks[Block].x, IceBlocks[Block].y, IceBlocks[Block].z, IceBlocks[Block].o, true, 0, 0); |
|---|
| 3227 | if (IceBlock != NULL) |
|---|
| 3228 | { |
|---|
| 3229 | IceBlock->SetUInt32Value(GAMEOBJECT_FLAGS, 1); |
|---|
| 3230 | } |
|---|
| 3231 | } |
|---|
| 3232 | } |
|---|
| 3233 | } |
|---|
| 3234 | } |
|---|
| 3235 | } |
|---|
| 3236 | |
|---|
| 3237 | else |
|---|
| 3238 | { |
|---|
| 3239 | if (FlightActions == 5) |
|---|
| 3240 | { |
|---|
| 3241 | Unit* FlyingFrostBreath = NULL; |
|---|
| 3242 | FlyingFrostBreath =_unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_FROST_BREATH_TRIGGER, PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z + 18.0f, _unit->GetOrientation(), true, false, 0, 0); |
|---|
| 3243 | if (FlyingFrostBreath != NULL) |
|---|
| 3244 | { |
|---|
| 3245 | FlyingFrostBreath->GetAIInterface()->MoveTo(PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z, PhaseTwoWP[1].o); |
|---|
| 3246 | } |
|---|
| 3247 | |
|---|
| 3248 | _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_FROST_BREATH_TRIGGER2, PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z, _unit->GetOrientation(), true, false, 0, 0); |
|---|
| 3249 | |
|---|
| 3250 | RemoveAIUpdateEvent(); |
|---|
| 3251 | RegisterAIUpdateEvent(10000); |
|---|
| 3252 | |
|---|
| 3253 | Creature* BreathTrigger = NULL; |
|---|
| 3254 | BreathTrigger = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z, CN_FROST_BREATH_TRIGGER3); |
|---|
| 3255 | if (BreathTrigger != NULL) |
|---|
| 3256 | BreathTrigger->Despawn(0,0); |
|---|
| 3257 | } |
|---|
| 3258 | |
|---|
| 3259 | if (FlightActions == 6) |
|---|
| 3260 | { |
|---|
| 3261 | for (int i = 1; i < 21; i++) |
|---|
| 3262 | { |
|---|
| 3263 | GameObject* IceBlock = NULL; |
|---|
| 3264 | IceBlock = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(IceBlocks[i].x, IceBlocks[i].y, IceBlocks[i].z, ICE_BLOCK_GO); |
|---|
| 3265 | if (IceBlock != NULL) |
|---|
| 3266 | { |
|---|
| 3267 | IceBlock->Delete(); |
|---|
| 3268 | } |
|---|
| 3269 | } |
|---|
| 3270 | |
|---|
| 3271 | _unit->GetAIInterface()->m_moveFly = false; |
|---|
| 3272 | _unit->Emote(EMOTE_ONESHOT_LAND); |
|---|
| 3273 | |
|---|
| 3274 | WorldPacket data(SMSG_MOVE_UNSET_HOVER, 13); |
|---|
| 3275 | data << _unit->GetNewGUID(); |
|---|
| 3276 | data << uint32(0); |
|---|
| 3277 | _unit->SendMessageToSet(&data, false); |
|---|
| 3278 | |
|---|
| 3279 | RemoveAIUpdateEvent(); |
|---|
| 3280 | RegisterAIUpdateEvent(3000); |
|---|
| 3281 | } |
|---|
| 3282 | |
|---|
| 3283 | if (FlightActions == 7) |
|---|
| 3284 | { |
|---|
| 3285 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 3286 | _unit->GetAIInterface()->SetAllowedToEnterCombat(true); |
|---|
| 3287 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 3288 | _unit->GetAIInterface()->SetAIState(STATE_SCRIPTIDLE); |
|---|
| 3289 | _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); |
|---|
| 3290 | _unit->GetAIInterface()->setWaypointToMove(0); |
|---|
| 3291 | |
|---|
| 3292 | RemoveAIUpdateEvent(); |
|---|
| 3293 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 3294 | |
|---|
| 3295 | PhaseTimer = (uint32)time(NULL) + 67; |
|---|
| 3296 | ChillTarget = NULL; |
|---|
| 3297 | FlightActions = 0; |
|---|
| 3298 | ChillCounter = 0; |
|---|
| 3299 | m_phase = 1; |
|---|
| 3300 | } |
|---|
| 3301 | |
|---|
| 3302 | FlightActions++; |
|---|
| 3303 | } |
|---|
| 3304 | } |
|---|
| 3305 | |
|---|
| 3306 | void SpellCast(float val) |
|---|
| 3307 | { |
|---|
| 3308 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget() != NULL) |
|---|
| 3309 | { |
|---|
| 3310 | float comulativeperc = 0; |
|---|
| 3311 | Unit* target = NULL; |
|---|
| 3312 | for (int i = 0; i < nrspells; i++) |
|---|
| 3313 | { |
|---|
| 3314 | if(!spells[i].perctrigger) continue; |
|---|
| 3315 | |
|---|
| 3316 | if(m_spellcheck[i]) |
|---|
| 3317 | { |
|---|
| 3318 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 3319 | switch(spells[i].targettype) |
|---|
| 3320 | { |
|---|
| 3321 | case TARGET_SELF: |
|---|
| 3322 | case TARGET_VARIOUS: |
|---|
| 3323 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 3324 | case TARGET_ATTACKING: |
|---|
| 3325 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 3326 | case TARGET_DESTINATION: |
|---|
| 3327 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 3328 | case TARGET_RANDOM_FRIEND: |
|---|
| 3329 | case TARGET_RANDOM_SINGLE: |
|---|
| 3330 | case TARGET_RANDOM_DESTINATION: |
|---|
| 3331 | CastSpellOnRandomTarget(i, spells[i].mindist2cast, spells[i].maxdist2cast, spells[i].minhp2cast, spells[i].maxhp2cast); break; |
|---|
| 3332 | } |
|---|
| 3333 | |
|---|
| 3334 | if (spells[i].speech != "") |
|---|
| 3335 | { |
|---|
| 3336 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, spells[i].speech.c_str()); |
|---|
| 3337 | _unit->PlaySoundToSet(spells[i].soundid); |
|---|
| 3338 | } |
|---|
| 3339 | |
|---|
| 3340 | m_spellcheck[i] = false; |
|---|
| 3341 | return; |
|---|
| 3342 | } |
|---|
| 3343 | |
|---|
| 3344 | uint32 t = (uint32)time(NULL); |
|---|
| 3345 | if((val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) && t > spells[i].casttime) |
|---|
| 3346 | { |
|---|
| 3347 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 3348 | spells[i].casttime = t + spells[i].cooldown; |
|---|
| 3349 | m_spellcheck[i] = true; |
|---|
| 3350 | } |
|---|
| 3351 | |
|---|
| 3352 | comulativeperc += spells[i].perctrigger; |
|---|
| 3353 | } |
|---|
| 3354 | } |
|---|
| 3355 | } |
|---|
| 3356 | |
|---|
| 3357 | void CastSpellOnRandomTarget(uint32 i, float mindist2cast, float maxdist2cast, int minhp2cast, int maxhp2cast) |
|---|
| 3358 | { |
|---|
| 3359 | if (!maxdist2cast) maxdist2cast = 100.0f; |
|---|
| 3360 | if (!maxhp2cast) maxhp2cast = 100; |
|---|
| 3361 | |
|---|
| 3362 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget() != NULL) |
|---|
| 3363 | { |
|---|
| 3364 | std::vector<Unit*> TargetTable; /* From M4ksiu - Big THX to Capt who helped me with std stuff to make it simple and fully working <3 */ |
|---|
| 3365 | /* If anyone wants to use this function, then leave this note! */ |
|---|
| 3366 | for(set<Object*>::iterator itr = _unit->GetInRangeSetBegin(); itr != _unit->GetInRangeSetEnd(); ++itr) |
|---|
| 3367 | { |
|---|
| 3368 | if (isHostile(_unit, (*itr)) && (*itr) != _unit && ((*itr)->GetTypeId()== TYPEID_UNIT || (*itr)->GetTypeId() == TYPEID_PLAYER) && (*itr)->GetInstanceID() == _unit->GetInstanceID()) |
|---|
| 3369 | { |
|---|
| 3370 | Unit* RandomTarget = NULL; |
|---|
| 3371 | RandomTarget = TO_UNIT(*itr); |
|---|
| 3372 | |
|---|
| 3373 | if (RandomTarget->isAlive() && _unit->GetDistance2dSq(RandomTarget) >= mindist2cast*mindist2cast && _unit->GetDistance2dSq(RandomTarget) <= maxdist2cast*maxdist2cast && _unit->GetAIInterface()->getThreatByPtr(RandomTarget) > 0 && isHostile(_unit, RandomTarget)) |
|---|
| 3374 | { |
|---|
| 3375 | TargetTable.push_back(RandomTarget); |
|---|
| 3376 | } |
|---|
| 3377 | } |
|---|
| 3378 | } |
|---|
| 3379 | |
|---|
| 3380 | if (!TargetTable.size()) |
|---|
| 3381 | return; |
|---|
| 3382 | |
|---|
| 3383 | size_t RandTarget = rand()%TargetTable.size(); |
|---|
| 3384 | |
|---|
| 3385 | Unit* RTarget = TargetTable[RandTarget]; |
|---|
| 3386 | |
|---|
| 3387 | if (RTarget == NULL) |
|---|
| 3388 | return; |
|---|
| 3389 | |
|---|
| 3390 | if (i == 1) |
|---|
| 3391 | { |
|---|
| 3392 | ChillCounter = RandomUInt(3) + 3; |
|---|
| 3393 | ChillTarget = RTarget; |
|---|
| 3394 | } |
|---|
| 3395 | |
|---|
| 3396 | else |
|---|
| 3397 | { |
|---|
| 3398 | switch (spells[i].targettype) |
|---|
| 3399 | { |
|---|
| 3400 | case TARGET_RANDOM_FRIEND: |
|---|
| 3401 | case TARGET_RANDOM_SINGLE: |
|---|
| 3402 | _unit->CastSpell(RTarget, spells[i].info, spells[i].instant); break; |
|---|
| 3403 | case TARGET_RANDOM_DESTINATION: |
|---|
| 3404 | _unit->CastSpellAoF(RTarget->GetPositionX(), RTarget->GetPositionY(), RTarget->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 3405 | } |
|---|
| 3406 | } |
|---|
| 3407 | |
|---|
| 3408 | TargetTable.clear(); |
|---|
| 3409 | } |
|---|
| 3410 | } |
|---|
| 3411 | |
|---|
| 3412 | void OnReachWP(uint32 iWaypointId, bool bForwards) |
|---|
| 3413 | { |
|---|
| 3414 | if (iWaypointId == 1) |
|---|
| 3415 | { |
|---|
| 3416 | _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_FROST_BREATH_TRIGGER3, PhaseTwoWP[1].x, PhaseTwoWP[1].y, PhaseTwoWP[1].z, _unit->GetOrientation(), true, false, 0, 0); |
|---|
| 3417 | _unit->GetAIInterface()->m_moveFly = true; |
|---|
| 3418 | _unit->Emote(EMOTE_ONESHOT_LIFTOFF); |
|---|
| 3419 | |
|---|
| 3420 | WorldPacket data(SMSG_MOVE_SET_HOVER, 13); |
|---|
| 3421 | data << _unit->GetNewGUID(); |
|---|
| 3422 | data << uint32(0); |
|---|
| 3423 | _unit->SendMessageToSet(&data, false); |
|---|
| 3424 | |
|---|
| 3425 | RemoveAIUpdateEvent(); |
|---|
| 3426 | RegisterAIUpdateEvent(3500); |
|---|
| 3427 | |
|---|
| 3428 | ChillTarget = NULL; |
|---|
| 3429 | FlightActions = 0; |
|---|
| 3430 | ChillCounter = 0; |
|---|
| 3431 | m_phase = 2; |
|---|
| 3432 | } |
|---|
| 3433 | } |
|---|
| 3434 | |
|---|
| 3435 | inline WayPoint* CreateWaypoint(int id, uint32 waittime, uint32 flags) |
|---|
| 3436 | { |
|---|
| 3437 | WayPoint * wp = _unit->CreateWaypointStruct(); |
|---|
| 3438 | wp->id = id; |
|---|
| 3439 | wp->x = PhaseTwoWP[id].x; |
|---|
| 3440 | wp->y = PhaseTwoWP[id].y; |
|---|
| 3441 | wp->z = PhaseTwoWP[id].z; |
|---|
| 3442 | wp->o = PhaseTwoWP[id].o; |
|---|
| 3443 | wp->waittime = waittime; |
|---|
| 3444 | wp->flags = flags; |
|---|
| 3445 | wp->forwardemoteoneshot = 0; |
|---|
| 3446 | wp->forwardemoteid = 0; |
|---|
| 3447 | wp->backwardemoteoneshot = 0; |
|---|
| 3448 | wp->backwardemoteid = 0; |
|---|
| 3449 | wp->forwardskinid = 0; |
|---|
| 3450 | wp->backwardskinid = 0; |
|---|
| 3451 | return wp; |
|---|
| 3452 | } |
|---|
| 3453 | |
|---|
| 3454 | protected: |
|---|
| 3455 | |
|---|
| 3456 | Unit* ChillTarget; // I don't like it >_> |
|---|
| 3457 | |
|---|
| 3458 | uint32 FlightActions; |
|---|
| 3459 | uint32 ChillCounter; |
|---|
| 3460 | uint32 PhaseTimer; |
|---|
| 3461 | uint32 m_phase; |
|---|
| 3462 | int nrspells; |
|---|
| 3463 | }; |
|---|
| 3464 | |
|---|
| 3465 | // -- Kel'thuzad Encounter by M4ksiu -- // |
|---|
| 3466 | |
|---|
| 3467 | // Encounter mobs |
|---|
| 3468 | |
|---|
| 3469 | #define CN_THE_LICH_KING 16980 |
|---|
| 3470 | #define CN_SOLDIER_OF_THE_FROZEN_WASTES 16427 |
|---|
| 3471 | #define CN_UNSTOPPABLE_ABOMINATION 16428 |
|---|
| 3472 | #define CN_SOUL_WEAVER 16429 |
|---|
| 3473 | #define CN_GUARDIAN_OF_ICECROWN 16441 |
|---|
| 3474 | |
|---|
| 3475 | /* |
|---|
| 3476 | _____ |
|---|
| 3477 | / K \ |
|---|
| 3478 | /1 4\ |
|---|
| 3479 | | | |
|---|
| 3480 | |2 5| |
|---|
| 3481 | | | |
|---|
| 3482 | \3 6/ |
|---|
| 3483 | \_ 7 _/ |
|---|
| 3484 | | | |
|---|
| 3485 | |
|---|
| 3486 | */ |
|---|
| 3487 | |
|---|
| 3488 | static Spawns SFrozenWastes[] = // Soldier of the Frozen Wastes (no idea about those :| ) |
|---|
| 3489 | { |
|---|
| 3490 | { 3759.149902f, -5074.879883f, 143.175003f, 1.203640f }, // 1 |
|---|
| 3491 | { 3762.959961f, -5067.399902f, 143.453003f, 0.893413f }, |
|---|
| 3492 | { 3772.419922f, -5076.379883f, 143.466995f, 3.606970f }, |
|---|
| 3493 | { 3779.699951f, -5078.180176f, 143.764008f, 4.038940f }, |
|---|
| 3494 | { 3770.219971f, -5065.740234f, 143.477005f, 0.630304f }, |
|---|
| 3495 | { 3765.709961f, -5060.799805f, 143.748001f, 1.608120f }, |
|---|
| 3496 | { 3776.909912f, -5066.100098f, 143.550003f, 5.130640f }, |
|---|
| 3497 | { 3782.659912f, -5069.529785f, 143.757004f, 5.150280f }, |
|---|
| 3498 | { 3773.909912f, -5059.589844f, 143.774002f, 6.257680f }, |
|---|
| 3499 | { 3780.260010f, -5061.580078f, 143.742996f, 5.169910f }, |
|---|
| 3500 | { 3721.429932f, -5052.759766f, 143.442993f, 1.457330f }, // 2 |
|---|
| 3501 | { 3732.149902f, -5051.589844f, 143.444000f, 1.017500f }, |
|---|
| 3502 | { 3741.889893f, -5047.439941f, 143.886002f, 3.075250f }, |
|---|
| 3503 | { 3726.229980f, -5043.410156f, 143.455994f, 6.150070f }, |
|---|
| 3504 | { 3718.679932f, -5042.520020f, 143.768005f, 1.614410f }, |
|---|
| 3505 | { 3733.060059f, -5040.979980f, 143.557007f, 1.669380f }, |
|---|
| 3506 | { 3741.860107f, -5038.410156f, 143.917999f, 4.410420f }, |
|---|
| 3507 | { 3736.189941f, -5032.810059f, 143.847000f, 5.026970f }, |
|---|
| 3508 | { 3723.219971f, -5035.770020f, 143.764999f, 4.701020f }, |
|---|
| 3509 | { 3728.760010f, -5031.759766f, 143.785995f, 3.723200f }, |
|---|
| 3510 | { 3683.189941f, -5062.419922f, 143.175995f, 0.559623f }, // 3 |
|---|
| 3511 | { 3687.739990f, -5057.779785f, 143.175995f, 1.345020f }, |
|---|
| 3512 | { 3674.040039f, -5067.899902f, 143.524994f, 0.005909f }, |
|---|
| 3513 | { 3688.340088f, -5052.009766f, 143.473007f, 2.299280f }, |
|---|
| 3514 | { 3681.659912f, -5052.549805f, 143.263000f, 3.343860f }, |
|---|
| 3515 | { 3678.840080f, -5055.529785f, 143.332993f, 3.512720f }, |
|---|
| 3516 | { 3685.800049f, -5045.779785f, 143.615997f, 6.253750f }, |
|---|
| 3517 | { 3673.479980f, -5053.350098f, 143.554993f, 1.945840f }, |
|---|
| 3518 | { 3670.649902f, -5061.149902f, 143.820007f, 4.266700f }, |
|---|
| 3519 | { 3688.018311f, -5061.541992f, 143.178223f, 0.512497f }, |
|---|
| 3520 | { 3742.659912f, -5157.009766f, 143.171005f, 0.773261f }, // 4 |
|---|
| 3521 | { 3750.310059f, -5153.779785f, 143.179993f, 5.603460f }, |
|---|
| 3522 | { 3739.770020f, -5163.000000f, 143.662994f, 1.095270f }, |
|---|
| 3523 | { 3746.649902f, -5164.560059f, 143.520004f, 1.970990f }, |
|---|
| 3524 | { 3748.479980f, -5169.109863f, 143.649002f, 2.591460f }, |
|---|
| 3525 | { 3744.560059f, -5173.520020f, 143.895996f, 1.370160f }, |
|---|
| 3526 | { 3758.260010f, -5156.299805f, 143.570999f, 6.192510f }, |
|---|
| 3527 | { 3762.620117f, -5159.149902f, 143.712997f, 4.433220f }, |
|---|
| 3528 | { 3760.840088f, -5162.959961f, 143.649002f, 4.280060f }, |
|---|
| 3529 | { 3756.580078f, -5170.060059f, 143.623001f, 3.031280f }, |
|---|
| 3530 | { 3705.229980f, -5163.189941f, 143.266998f, 5.692200f }, // 5 |
|---|
| 3531 | { 3696.949951f, -5163.370117f, 143.608002f, 0.901274f }, |
|---|
| 3532 | { 3710.080078f, -5168.709961f, 143.585999f, 4.675110f }, |
|---|
| 3533 | { 3697.030029f, -5170.220215f, 143.606003f, 0.343642f }, |
|---|
| 3534 | { 3692.030029f, -5170.020020f, 143.815994f, 0.932691f }, |
|---|
| 3535 | { 3710.320068f, -5175.319824f, 143.705002f, 4.639770f }, |
|---|
| 3536 | { 3694.550049f, -5177.540039f, 143.839005f, 1.549230f }, |
|---|
| 3537 | { 3705.830078f, -5179.120117f, 143.729996f, 3.956480f }, |
|---|
| 3538 | { 3712.800049f, -5179.109863f, 143.891006f, 3.855950f }, |
|---|
| 3539 | { 3701.669922f, -5181.859863f, 143.804001f, 1.380370f }, |
|---|
| 3540 | { 3676.590088f, -5144.899902f, 143.186005f, 3.575550f }, // 6 |
|---|
| 3541 | { 3670.649902f, -5142.629883f, 143.173996f, 4.313820f }, |
|---|
| 3542 | { 3665.689941f, -5136.279785f, 143.177994f, 1.176150f }, |
|---|
| 3543 | { 3664.870117f, -5132.330078f, 143.205002f, 3.249600f }, |
|---|
| 3544 | { 3662.120117f, -5144.299805f, 143.320007f, 2.256080f }, |
|---|
| 3545 | { 3658.979980f, -5139.490234f, 143.421997f, 6.077040f }, |
|---|
| 3546 | { 3651.850098f, -5137.140137f, 143.764999f, 0.799161f }, |
|---|
| 3547 | { 3654.689941f, -5144.009766f, 143.546997f, 2.519180f }, |
|---|
| 3548 | { 3666.020020f, -5149.500000f, 143.587006f, 3.359560f }, |
|---|
| 3549 | { 3667.959961f, -5153.120117f, 143.791000f, 4.015380f }, |
|---|
| 3550 | { 3659.979980f, -5100.450195f, 143.453003f, 5.168254f }, // 7 |
|---|
| 3551 | { 3662.800049f, -5088.189941f, 143.557999f, 4.409650f }, |
|---|
| 3552 | { 3658.439941f, -5090.649902f, 143.470001f, 5.528840f }, |
|---|
| 3553 | { 3652.810059f, -5090.450195f, 143.475998f, 1.362310f }, |
|---|
| 3554 | { 3651.780029f, -5095.339844f, 143.388000f, 0.981387f }, |
|---|
| 3555 | { 3652.629883f, -5098.970215f, 143.544998f, 2.799580f }, |
|---|
| 3556 | { 3652.679932f, -5083.479980f, 143.774994f, 0.482659f }, |
|---|
| 3557 | { 3647.189941f, -5085.490234f, 143.570999f, 1.919940f }, |
|---|
| 3558 | { 3645.120117f, -5097.240234f, 143.487000f, 0.765403f }, |
|---|
| 3559 | { 3646.360107f, -5101.200195f, 143.681000f, 2.909540f } |
|---|
| 3560 | }; |
|---|
| 3561 | |
|---|
| 3562 | static Spawns Abomination[] = // Unstoppable Abomination |
|---|
| 3563 | { |
|---|
| 3564 | { 3776.229980f, -5081.439941f, 143.779999f, 4.043730f }, // 1 |
|---|
| 3565 | { 3774.419922f, -5071.490234f, 143.423996f, 4.214940f }, |
|---|
| 3566 | { 3759.850098f, -5064.479980f, 143.636002f, 6.255410f }, |
|---|
| 3567 | { 3740.899902f, -5052.740234f, 143.785995f, 1.836760f }, // 2 |
|---|
| 3568 | { 3726.919922f, -5040.020020f, 143.535995f, 2.481570f }, |
|---|
| 3569 | { 3715.010010f, -5049.259766f, 143.632004f, 5.071810f }, |
|---|
| 3570 | { 3695.060059f, -5052.160156f, 143.548004f, 3.792400f }, // 3 |
|---|
| 3571 | { 3678.129883f, -5048.060059f, 143.436996f, 5.363980f }, |
|---|
| 3572 | { 3676.120117f, -5061.359863f, 143.492004f, 5.726840f }, |
|---|
| 3573 | { 3756.780029f, -5149.419922f, 143.460007f, 2.774530f }, // 4 |
|---|
| 3574 | { 3752.262695f, -5164.782227f, 143.409119f, 0.383768f }, |
|---|
| 3575 | { 3740.669922f, -5168.600098f, 143.873993f, 1.051360f }, |
|---|
| 3576 | { 3714.020020f, -5171.129883f, 143.776993f, 1.742510f }, // 5 |
|---|
| 3577 | { 3702.185303f, -5174.303711f, 143.532303f, 5.443298f }, |
|---|
| 3578 | { 3693.739990f, -5162.149902f, 143.748001f, 5.696990f }, |
|---|
| 3579 | { 3673.189941f, -5150.500000f, 143.751999f, 3.030570f }, // 6 |
|---|
| 3580 | { 3658.570068f, -5147.799805f, 143.494003f, 1.230440f }, |
|---|
| 3581 | { 3659.560059f, -5132.129883f, 143.677002f, 5.988380f }, |
|---|
| 3582 | { 3651.130859f, -5104.800293f, 143.798248f, 5.374194f }, // 7 |
|---|
| 3583 | { 3646.947021f, -5092.266113f, 143.305878f, 5.005841f }, |
|---|
| 3584 | { 3658.618408f, -5083.832031f, 143.778641f, 5.951464f } |
|---|
| 3585 | }; |
|---|
| 3586 | |
|---|
| 3587 | static Spawns SoulWeaver[] = // Soul Weaver |
|---|
| 3588 | { |
|---|
| 3589 | { 3768.540039f, -5075.140137f, 143.203995f, 5.096160f }, |
|---|
| 3590 | { 3728.030029f, -5047.359863f, 143.306000f, 5.230460f }, |
|---|
| 3591 | { 3682.929932f, -5055.819824f, 143.184006f, 5.368690f }, |
|---|
| 3592 | { 3749.429932f, -5160.419922f, 143.283997f, 4.723090f }, |
|---|
| 3593 | { 3706.120117f, -5169.250000f, 143.436996f, 2.682630f }, |
|---|
| 3594 | { 3665.310059f, -5142.339844f, 143.220001f, 1.147180f }, |
|---|
| 3595 | { 3656.365234f, -5094.724121f, 143.306641f, 6.203571f } |
|---|
| 3596 | }; |
|---|
| 3597 | |
|---|
| 3598 | static Spawns Guardians[] = // Guardians of Icecrown |
|---|
| 3599 | { |
|---|
| 3600 | { 3778.371582f, -5065.141113f, 143.614639f, 3.700061f }, |
|---|
| 3601 | { 3731.733398f, -5032.681152f, 143.775040f, 4.485459f }, |
|---|
| 3602 | { 3758.592285f, -5170.157715f, 143.667297f, 2.144972f }, |
|---|
| 3603 | { 3700.936279f, -5183.230469f, 143.858582f, 1.314648f } |
|---|
| 3604 | }; |
|---|
| 3605 | |
|---|
| 3606 | static Spawns Waves[] = // Spawn positions of units that attack circle |
|---|
| 3607 | { |
|---|
| 3608 | { 3756.380615f, -5080.560059f, 142.906921f, 3.762599f }, |
|---|
| 3609 | { 3726.448242f, -5058.546387f, 142.467331f, 4.262112f }, |
|---|
| 3610 | { 3690.084229f, -5066.993164f, 142.705917f, 5.245427f }, |
|---|
| 3611 | { 3742.711670f, -5146.786133f, 142.964890f, 2.178441f }, |
|---|
| 3612 | { 3706.024902f, -5155.362793f, 142.655304f, 1.294868f }, |
|---|
| 3613 | { 3676.363281f, -5133.007324f, 142.806168f, 0.615499f }, |
|---|
| 3614 | { 3668.310303f, -5096.927246f, 142.307312f, 6.128994f } |
|---|
| 3615 | }; |
|---|
| 3616 | |
|---|
| 3617 | // Kel'thuzad AI |
|---|
| 3618 | // each ~10-20 sec new mob |
|---|
| 3619 | |
|---|
| 3620 | #define CN_KELTHUZAD 15990 |
|---|
| 3621 | |
|---|
| 3622 | #define SFROSTBOLT 28478 |
|---|
| 3623 | #define MFROSTBOLT 28479 |
|---|
| 3624 | #define CHAINS_OF_KELTHUZAD 28410 |
|---|
| 3625 | #define DETONATE_MANA 27819 |
|---|
| 3626 | #define SHADOW_FISSURE 27810 |
|---|
| 3627 | #define FROST_BLAST 27808 |
|---|
| 3628 | |
|---|
| 3629 | #define KELTHUZAD_CHANNEL 29423 |
|---|
| 3630 | |
|---|
| 3631 | class KelthuzadAI : public CreatureAIScript |
|---|
| 3632 | { |
|---|
| 3633 | public: |
|---|
| 3634 | ADD_CREATURE_FACTORY_FUNCTION(KelthuzadAI); |
|---|
| 3635 | SP_AI_Spell spells[7]; |
|---|
| 3636 | bool m_spellcheck[7]; |
|---|
| 3637 | bool FrozenWastes[7]; |
|---|
| 3638 | bool Abominations[7]; |
|---|
| 3639 | bool SoulWeavers[7]; |
|---|
| 3640 | |
|---|
| 3641 | KelthuzadAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 3642 | { |
|---|
| 3643 | nrspells = 6; |
|---|
| 3644 | |
|---|
| 3645 | for(int i=0;i<nrspells;i++) |
|---|
| 3646 | { |
|---|
| 3647 | m_spellcheck[i] = false; |
|---|
| 3648 | spells[i].casttime = 0; |
|---|
| 3649 | } |
|---|
| 3650 | |
|---|
| 3651 | for (int i = 0; i < 7; i++) |
|---|
| 3652 | { |
|---|
| 3653 | FrozenWastes[i] = false; |
|---|
| 3654 | Abominations[i] = false; |
|---|
| 3655 | SoulWeavers[i] = false; |
|---|
| 3656 | } |
|---|
| 3657 | |
|---|
| 3658 | spells[0].info = dbcSpell.LookupEntry(SFROSTBOLT); |
|---|
| 3659 | spells[0].targettype = TARGET_ATTACKING; |
|---|
| 3660 | spells[0].instant = false; |
|---|
| 3661 | spells[0].perctrigger = 7.0f; |
|---|
| 3662 | spells[0].cooldown = 0; |
|---|
| 3663 | spells[0].attackstoptimer = 2000; |
|---|
| 3664 | |
|---|
| 3665 | spells[1].info = dbcSpell.LookupEntry(MFROSTBOLT); |
|---|
| 3666 | spells[1].targettype = TARGET_VARIOUS; |
|---|
| 3667 | spells[1].instant = true; |
|---|
| 3668 | spells[1].perctrigger = 0.1f; |
|---|
| 3669 | spells[1].cooldown = 15; // it's casted after 15 sec anyway, so it does need additional perctrigger |
|---|
| 3670 | spells[1].attackstoptimer = 1000; |
|---|
| 3671 | |
|---|
| 3672 | spells[2].info = dbcSpell.LookupEntry(CHAINS_OF_KELTHUZAD); |
|---|
| 3673 | spells[2].targettype = TARGET_RANDOM_SINGLE; |
|---|
| 3674 | spells[2].instant = true; |
|---|
| 3675 | spells[2].perctrigger = 5.0f; |
|---|
| 3676 | spells[2].cooldown = 20; |
|---|
| 3677 | spells[2].attackstoptimer = 1000; |
|---|
| 3678 | spells[2].mindist2cast = 0.0f; |
|---|
| 3679 | spells[2].maxdist2cast = 40.0f; |
|---|
| 3680 | spells[2].minhp2cast = 0; |
|---|
| 3681 | spells[2].maxhp2cast = 100; |
|---|
| 3682 | |
|---|
| 3683 | spells[3].info = dbcSpell.LookupEntry(DETONATE_MANA); |
|---|
| 3684 | spells[3].targettype = TARGET_RANDOM_SINGLE; |
|---|
| 3685 | spells[3].instant = true; |
|---|
| 3686 | spells[3].perctrigger = 6.0f; |
|---|
| 3687 | spells[3].cooldown = 7; |
|---|
| 3688 | spells[3].attackstoptimer = 2000; |
|---|
| 3689 | spells[3].mindist2cast = 0.0f; |
|---|
| 3690 | spells[3].maxdist2cast = 40.0f; |
|---|
| 3691 | spells[3].minhp2cast = 0; |
|---|
| 3692 | spells[3].maxhp2cast = 100; |
|---|
| 3693 | |
|---|
| 3694 | spells[4].info = dbcSpell.LookupEntry(SHADOW_FISSURE); |
|---|
| 3695 | spells[4].targettype = TARGET_ATTACKING; |
|---|
| 3696 | spells[4].instant = true; |
|---|
| 3697 | spells[4].perctrigger = 5.0f; |
|---|
| 3698 | spells[4].cooldown = 10; |
|---|
| 3699 | spells[4].attackstoptimer = 2000; |
|---|
| 3700 | |
|---|
| 3701 | spells[5].info = dbcSpell.LookupEntry(FROST_BLAST); |
|---|
| 3702 | spells[5].targettype = TARGET_RANDOM_SINGLE; |
|---|
| 3703 | spells[5].instant = true; |
|---|
| 3704 | spells[5].perctrigger = 6.0f; |
|---|
| 3705 | spells[5].cooldown = 10; |
|---|
| 3706 | spells[5].attackstoptimer = 2000; |
|---|
| 3707 | spells[5].soundid = 8815; |
|---|
| 3708 | spells[5].speech = "I shall freeze the blood in your veins!"; // not sure if it's to this one or to one of bolt spells |
|---|
| 3709 | spells[5].mindist2cast = 0.0f; |
|---|
| 3710 | spells[5].maxdist2cast = 40.0f; |
|---|
| 3711 | spells[5].minhp2cast = 0; |
|---|
| 3712 | spells[5].maxhp2cast = 100; |
|---|
| 3713 | |
|---|
| 3714 | spells[6].info = dbcSpell.LookupEntry(KELTHUZAD_CHANNEL); |
|---|
| 3715 | spells[6].targettype = TARGET_SELF; |
|---|
| 3716 | spells[6].instant = false; |
|---|
| 3717 | spells[6].perctrigger = 0.0f; |
|---|
| 3718 | spells[6].cooldown = 0; |
|---|
| 3719 | spells[6].attackstoptimer = 1000; |
|---|
| 3720 | |
|---|
| 3721 | _unit->GetAIInterface()->disable_melee = false; |
|---|
| 3722 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, 0); |
|---|
| 3723 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 3724 | |
|---|
| 3725 | DespawnTrash = false; |
|---|
| 3726 | EventStart = false; |
|---|
| 3727 | SpawnCounter = 0; |
|---|
| 3728 | PhaseTimer = 310; |
|---|
| 3729 | SpawnTimer = 0; |
|---|
| 3730 | GCounter = 0; |
|---|
| 3731 | m_phase = 0; |
|---|
| 3732 | } |
|---|
| 3733 | |
|---|
| 3734 | void OnCombatStart(Unit* mTarget) |
|---|
| 3735 | { |
|---|
| 3736 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Minions, servants, soldiers of the cold dark, obey the call of Kel'Thuzad!"); |
|---|
| 3737 | _unit->PlaySoundToSet(8819); |
|---|
| 3738 | |
|---|
| 3739 | Unit* TheLichKing = NULL; |
|---|
| 3740 | TheLichKing = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(3767.58f, -5117.15f, 174.49f, CN_THE_LICH_KING); |
|---|
| 3741 | if (TheLichKing != NULL) |
|---|
| 3742 | { |
|---|
| 3743 | _unit->SetChannelSpellTargetGUID(TheLichKing->GetGUID()); |
|---|
| 3744 | _unit->SetChannelSpellId(29423); |
|---|
| 3745 | } |
|---|
| 3746 | |
|---|
| 3747 | GameObject* KelGate = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(3635.44f, -5090.33f, 143.205f, 181228); |
|---|
| 3748 | |
|---|
| 3749 | if (KelGate) |
|---|
| 3750 | KelGate->SetState(1); |
|---|
| 3751 | |
|---|
| 3752 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); |
|---|
| 3753 | _unit->GetAIInterface()->disable_melee = true; |
|---|
| 3754 | _unit->GetAIInterface()->m_canMove = false; |
|---|
| 3755 | |
|---|
| 3756 | RegisterAIUpdateEvent(1000); |
|---|
| 3757 | CastTime(); |
|---|
| 3758 | |
|---|
| 3759 | DespawnTrash = false; |
|---|
| 3760 | EventStart = true; |
|---|
| 3761 | SpawnCounter = 0; |
|---|
| 3762 | PhaseTimer = 310; |
|---|
| 3763 | SpawnTimer = 0; |
|---|
| 3764 | GCounter = 0; |
|---|
| 3765 | m_phase = 1; |
|---|
| 3766 | } |
|---|
| 3767 | |
|---|
| 3768 | void OnCombatStop(Unit* mTarget) |
|---|
| 3769 | { |
|---|
| 3770 | GameObject* KelGate = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(3635.44f, -5090.33f, 143.205f, 181228); |
|---|
| 3771 | if (KelGate != NULL) |
|---|
| 3772 | KelGate->SetState(0); |
|---|
| 3773 | |
|---|
| 3774 | for (int i = 0; i < 4; i++) |
|---|
| 3775 | { |
|---|
| 3776 | GameObject* WindowGate = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(Guardians[i].x, Guardians[i].y, Guardians[i].z, 200002); |
|---|
| 3777 | if (WindowGate != NULL) |
|---|
| 3778 | WindowGate->SetState(1); |
|---|
| 3779 | } |
|---|
| 3780 | |
|---|
| 3781 | _unit->SetChannelSpellTargetGUID(0); |
|---|
| 3782 | _unit->SetChannelSpellId(0); |
|---|
| 3783 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 3784 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 3785 | _unit->GetAIInterface()->disable_melee = false; |
|---|
| 3786 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, 0); |
|---|
| 3787 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 3788 | RemoveAIUpdateEvent(); |
|---|
| 3789 | |
|---|
| 3790 | DespawnTrash = true; |
|---|
| 3791 | EventStart = false; |
|---|
| 3792 | SpawnCounter = 0; |
|---|
| 3793 | PhaseTimer = 310; |
|---|
| 3794 | SpawnTimer = 0; |
|---|
| 3795 | GCounter = 0; |
|---|
| 3796 | m_phase = 0; |
|---|
| 3797 | } |
|---|
| 3798 | |
|---|
| 3799 | void CastTime() |
|---|
| 3800 | { |
|---|
| 3801 | for(int i=0;i<nrspells;i++) |
|---|
| 3802 | spells[i].casttime = 0; |
|---|
| 3803 | } |
|---|
| 3804 | |
|---|
| 3805 | void OnTargetDied(Unit* mTarget) |
|---|
| 3806 | { |
|---|
| 3807 | if (_unit->GetHealthPct() == 0) return; |
|---|
| 3808 | |
|---|
| 3809 | uint32 RandomSpeach = rand()%2; |
|---|
| 3810 | switch (RandomSpeach) |
|---|
| 3811 | { |
|---|
| 3812 | case 0: |
|---|
| 3813 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "The dark void awaits you!"); |
|---|
| 3814 | _unit->PlaySoundToSet(8817); |
|---|
| 3815 | break; |
|---|
| 3816 | case 1: |
|---|
| 3817 | //_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, ""); // no text? |
|---|
| 3818 | _unit->PlaySoundToSet(8818); |
|---|
| 3819 | break; |
|---|
| 3820 | } |
|---|
| 3821 | } |
|---|
| 3822 | |
|---|
| 3823 | void OnDied(Unit* mKiller) |
|---|
| 3824 | { |
|---|
| 3825 | GameObject* KelGate = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(3635.44f, -5090.33f, 143.205f, 181228); |
|---|
| 3826 | if (KelGate != NULL) |
|---|
| 3827 | KelGate->SetState(0); |
|---|
| 3828 | |
|---|
| 3829 | for (int i = 0; i < 4; i++) |
|---|
| 3830 | { |
|---|
| 3831 | GameObject* WindowGate = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(Guardians[i].x, Guardians[i].y, Guardians[i].z, 200002); |
|---|
| 3832 | if (WindowGate != NULL) |
|---|
| 3833 | WindowGate->SetState(1); |
|---|
| 3834 | } |
|---|
| 3835 | |
|---|
| 3836 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Do not rejoice... your victory is a hollow one... for I shall return with powers beyond your imagining!"); |
|---|
| 3837 | _unit->PlaySoundToSet(8814); |
|---|
| 3838 | |
|---|
| 3839 | _unit->GetAIInterface()->disable_melee = false; |
|---|
| 3840 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, 0); |
|---|
| 3841 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 3842 | RemoveAIUpdateEvent(); |
|---|
| 3843 | |
|---|
| 3844 | EventStart = false; |
|---|
| 3845 | SpawnCounter = 0; |
|---|
| 3846 | PhaseTimer = 310; |
|---|
| 3847 | SpawnTimer = 0; |
|---|
| 3848 | GCounter = 0; |
|---|
| 3849 | m_phase = 0; |
|---|
| 3850 | } |
|---|
| 3851 | |
|---|
| 3852 | void AIUpdate() |
|---|
| 3853 | { |
|---|
| 3854 | switch (m_phase) |
|---|
| 3855 | { |
|---|
| 3856 | case 1: |
|---|
| 3857 | PhaseOne(); |
|---|
| 3858 | break; |
|---|
| 3859 | case 2: |
|---|
| 3860 | PhaseTwo(); |
|---|
| 3861 | break; |
|---|
| 3862 | case 3: |
|---|
| 3863 | PhaseThree(); |
|---|
| 3864 | break; |
|---|
| 3865 | default: |
|---|
| 3866 | { |
|---|
| 3867 | } |
|---|
| 3868 | } |
|---|
| 3869 | } |
|---|
| 3870 | |
|---|
| 3871 | void PhaseOne() |
|---|
| 3872 | { |
|---|
| 3873 | if (EventStart == true) |
|---|
| 3874 | { |
|---|
| 3875 | SpawnTimer++; |
|---|
| 3876 | if (SpawnTimer == 5 || SpawnTimer == 10) |
|---|
| 3877 | { |
|---|
| 3878 | for (int i = 0; i < 7; i++) |
|---|
| 3879 | { |
|---|
| 3880 | int Counter = 0; |
|---|
| 3881 | |
|---|
| 3882 | while (Counter == 0) |
|---|
| 3883 | { |
|---|
| 3884 | if (FrozenWastes[i] == false && (rand()%3 == 0 || SpawnCounter > 0)) |
|---|
| 3885 | { |
|---|
| 3886 | for (int x = 0; x < 10; x++) |
|---|
| 3887 | { |
|---|
| 3888 | uint32 SpawnID = 10*i + x; |
|---|
| 3889 | _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SOLDIER_OF_THE_FROZEN_WASTES, SFrozenWastes[SpawnID].x, SFrozenWastes[SpawnID].y, SFrozenWastes[SpawnID].z, SFrozenWastes[SpawnID].o, true, false, 0, 0); |
|---|
| 3890 | } |
|---|
| 3891 | |
|---|
| 3892 | FrozenWastes[i] = true; |
|---|
| 3893 | Counter++; |
|---|
| 3894 | } |
|---|
| 3895 | |
|---|
| 3896 | if (Abominations[i] == false && (rand()%3 == 0 || SpawnCounter > 0)) |
|---|
| 3897 | { |
|---|
| 3898 | for (int x = 0; x < 3; x++) |
|---|
| 3899 | { |
|---|
| 3900 | uint32 SpawnID = 3*i + x; |
|---|
| 3901 | _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_UNSTOPPABLE_ABOMINATION, Abomination[SpawnID].x, Abomination[SpawnID].y, Abomination[SpawnID].z, Abomination[SpawnID].o, true, false, 0, 0); |
|---|
| 3902 | } |
|---|
| 3903 | |
|---|
| 3904 | Abominations[i] = true; |
|---|
| 3905 | Counter++; |
|---|
| 3906 | } |
|---|
| 3907 | |
|---|
| 3908 | if (SoulWeavers[i] == false && ((rand()%3 == 0 && Counter < 2) || Counter == 0 || SpawnCounter > 0)) |
|---|
| 3909 | { |
|---|
| 3910 | uint32 SpawnID = i; |
|---|
| 3911 | _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SOUL_WEAVER, SoulWeaver[SpawnID].x, SoulWeaver[SpawnID].y, SoulWeaver[SpawnID].z, SoulWeaver[SpawnID].o, true, false, 0, 0); |
|---|
| 3912 | |
|---|
| 3913 | SoulWeavers[i] = true; |
|---|
| 3914 | Counter++; |
|---|
| 3915 | } |
|---|
| 3916 | |
|---|
| 3917 | if (SoulWeavers[i] == true && Abominations[i] == true && FrozenWastes[i] == true) |
|---|
| 3918 | Counter = 1; |
|---|
| 3919 | } |
|---|
| 3920 | } |
|---|
| 3921 | |
|---|
| 3922 | SpawnCounter++; |
|---|
| 3923 | } |
|---|
| 3924 | |
|---|
| 3925 | if (SpawnCounter == 2) |
|---|
| 3926 | { |
|---|
| 3927 | for (int i = 0; i < 7; i++) |
|---|
| 3928 | { |
|---|
| 3929 | FrozenWastes[i] = false; |
|---|
| 3930 | Abominations[i] = false; |
|---|
| 3931 | SoulWeavers[i] = false; |
|---|
| 3932 | } |
|---|
| 3933 | |
|---|
| 3934 | WaveTimer = rand()%6+10; |
|---|
| 3935 | EventStart = false; |
|---|
| 3936 | SpawnCounter = 0; |
|---|
| 3937 | PhaseTimer = 310; |
|---|
| 3938 | SpawnTimer = 0; |
|---|
| 3939 | } |
|---|
| 3940 | } |
|---|
| 3941 | |
|---|
| 3942 | else |
|---|
| 3943 | { |
|---|
| 3944 | PhaseTimer--; |
|---|
| 3945 | WaveTimer--; |
|---|
| 3946 | |
|---|
| 3947 | if (PhaseTimer == 5) |
|---|
| 3948 | { |
|---|
| 3949 | uint32 RandomSpeach = rand()%3; |
|---|
| 3950 | switch (RandomSpeach) |
|---|
| 3951 | { |
|---|
| 3952 | case 0: |
|---|
| 3953 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Pray for mercy!"); |
|---|
| 3954 | _unit->PlaySoundToSet(8809); |
|---|
| 3955 | break; |
|---|
| 3956 | case 1: |
|---|
| 3957 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Scream your dying breath!"); |
|---|
| 3958 | _unit->PlaySoundToSet(8810); |
|---|
| 3959 | break; |
|---|
| 3960 | case 2: |
|---|
| 3961 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "The end is upon you!"); |
|---|
| 3962 | _unit->PlaySoundToSet(8811); |
|---|
| 3963 | break; |
|---|
| 3964 | } |
|---|
| 3965 | } |
|---|
| 3966 | |
|---|
| 3967 | if (PhaseTimer == 3) |
|---|
| 3968 | DespawnTrash = true; |
|---|
| 3969 | |
|---|
| 3970 | if (!PhaseTimer) |
|---|
| 3971 | { |
|---|
| 3972 | _unit->SetChannelSpellTargetGUID(0); |
|---|
| 3973 | _unit->SetChannelSpellId(0); |
|---|
| 3974 | _unit->GetAIInterface()->disable_melee = false; |
|---|
| 3975 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, 0); |
|---|
| 3976 | _unit->GetAIInterface()->m_canMove = true; |
|---|
| 3977 | |
|---|
| 3978 | DespawnTrash = false; |
|---|
| 3979 | HelpDialog = 0; |
|---|
| 3980 | GCounter = 0; |
|---|
| 3981 | m_phase = 2; |
|---|
| 3982 | return; |
|---|
| 3983 | } |
|---|
| 3984 | |
|---|
| 3985 | else if (!WaveTimer && PhaseTimer > 5) |
|---|
| 3986 | { |
|---|
| 3987 | uint32 SpawnPoint = RandomUInt(7); |
|---|
| 3988 | uint32 RandomSU = 0; |
|---|
| 3989 | if (PhaseTimer > 250) |
|---|
| 3990 | RandomSU = RandomUInt(4); |
|---|
| 3991 | if (PhaseTimer <= 250 && PhaseTimer >= 150) |
|---|
| 3992 | RandomSU = RandomUInt(5); |
|---|
| 3993 | if (PhaseTimer <= 150 && PhaseTimer > 100) |
|---|
| 3994 | RandomSU = RandomUInt(6); |
|---|
| 3995 | if (PhaseTimer <= 100) |
|---|
| 3996 | RandomSU = RandomUInt(7); |
|---|
| 3997 | |
|---|
| 3998 | uint32 UnitType; |
|---|
| 3999 | |
|---|
| 4000 | switch (RandomSU) |
|---|
| 4001 | { |
|---|
| 4002 | case 0: |
|---|
| 4003 | case 1: UnitType = CN_SOLDIER_OF_THE_FROZEN_WASTES; break; |
|---|
| 4004 | case 2: |
|---|
| 4005 | case 4: UnitType = CN_SOUL_WEAVER; break; |
|---|
| 4006 | case 3: |
|---|
| 4007 | case 5: |
|---|
| 4008 | case 6: UnitType = CN_UNSTOPPABLE_ABOMINATION; break; |
|---|
| 4009 | default: |
|---|
| 4010 | { |
|---|
| 4011 | UnitType = CN_UNSTOPPABLE_ABOMINATION; |
|---|
| 4012 | } |
|---|
| 4013 | } |
|---|
| 4014 | |
|---|
| 4015 | _unit->GetMapMgr()->GetInterface()->SpawnCreature(UnitType, Waves[SpawnPoint].x, Waves[SpawnPoint].y, Waves[SpawnPoint].z, Waves[SpawnPoint].o, true, false, 0, 0); |
|---|
| 4016 | WaveTimer = rand()%11+10; |
|---|
| 4017 | } |
|---|
| 4018 | } |
|---|
| 4019 | } |
|---|
| 4020 | |
|---|
| 4021 | void PhaseTwo() |
|---|
| 4022 | { |
|---|
| 4023 | if (_unit->GetHealthPct() <= 40) |
|---|
| 4024 | { |
|---|
| 4025 | HelpDialog++; |
|---|
| 4026 | if (HelpDialog == 1) |
|---|
| 4027 | { |
|---|
| 4028 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Master! I require aid!"); |
|---|
| 4029 | _unit->PlaySoundToSet(8816); |
|---|
| 4030 | } |
|---|
| 4031 | |
|---|
| 4032 | if (HelpDialog == 4) |
|---|
| 4033 | { |
|---|
| 4034 | Unit* TheLichKing = NULL; |
|---|
| 4035 | TheLichKing = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(3767.58f, -5117.15f, 174.49f, CN_THE_LICH_KING); |
|---|
| 4036 | if (TheLichKing != NULL) |
|---|
| 4037 | { |
|---|
| 4038 | TheLichKing->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Very well... warriors of the frozen wastes, rise up, I command you to fight, kill, and die for your master. Let none survive..."); |
|---|
| 4039 | TheLichKing->PlaySoundToSet(8824); |
|---|
| 4040 | } |
|---|
| 4041 | |
|---|
| 4042 | else |
|---|
| 4043 | { |
|---|
| 4044 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Very well... warriors of the frozen wastes, rise up, I command you to fight, kill, and die for your master. Let none survive..."); |
|---|
| 4045 | _unit->PlaySoundToSet(8824); |
|---|
| 4046 | } |
|---|
| 4047 | |
|---|
| 4048 | for (int i = 0; i < 4; i++) |
|---|
| 4049 | { |
|---|
| 4050 | GameObject* WindowGate = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(Guardians[i].x, Guardians[i].y, Guardians[i].z, 200002); |
|---|
| 4051 | if (WindowGate) |
|---|
| 4052 | WindowGate->SetState(0); |
|---|
| 4053 | } |
|---|
| 4054 | } |
|---|
| 4055 | |
|---|
| 4056 | if (HelpDialog == 10 || HelpDialog == 12 || HelpDialog == 14 || HelpDialog == 16 || HelpDialog == 18) |
|---|
| 4057 | { |
|---|
| 4058 | Unit* Guardian = NULL; |
|---|
| 4059 | uint32 i = RandomUInt(4); |
|---|
| 4060 | Guardian =_unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_GUARDIAN_OF_ICECROWN, Guardians[i].x, Guardians[i].y, Guardians[i].z, Guardians[i].o, true, false, 0, 0); |
|---|
| 4061 | if (Guardian != NULL) |
|---|
| 4062 | { |
|---|
| 4063 | if (Guardian->GetAIInterface()->GetNextTarget() != NULL) |
|---|
| 4064 | Guardian->GetAIInterface()->AttackReaction(Guardian->GetAIInterface()->GetNextTarget(), 1, 0); |
|---|
| 4065 | } |
|---|
| 4066 | |
|---|
| 4067 | GCounter++; |
|---|
| 4068 | if (GCounter == 5) |
|---|
| 4069 | { |
|---|
| 4070 | GCounter = 0; |
|---|
| 4071 | m_phase = 3; |
|---|
| 4072 | } |
|---|
| 4073 | } |
|---|
| 4074 | } |
|---|
| 4075 | |
|---|
| 4076 | float val = (float)RandomFloat(100.0f); |
|---|
| 4077 | SpellCast(val); |
|---|
| 4078 | } |
|---|
| 4079 | |
|---|
| 4080 | void PhaseThree() |
|---|
| 4081 | { |
|---|
| 4082 | float val = (float)RandomFloat(100.0f); |
|---|
| 4083 | SpellCast(val); |
|---|
| 4084 | } |
|---|
| 4085 | |
|---|
| 4086 | void SpellCast(float val) |
|---|
| 4087 | { |
|---|
| 4088 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 4089 | { |
|---|
| 4090 | float comulativeperc = 0; |
|---|
| 4091 | Unit* target = NULL; |
|---|
| 4092 | for(int i=0;i<nrspells;i++) |
|---|
| 4093 | { |
|---|
| 4094 | if(!spells[i].perctrigger) continue; |
|---|
| 4095 | |
|---|
| 4096 | if(m_spellcheck[i]) |
|---|
| 4097 | { |
|---|
| 4098 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 4099 | switch(spells[i].targettype) |
|---|
| 4100 | { |
|---|
| 4101 | case TARGET_SELF: |
|---|
| 4102 | case TARGET_VARIOUS: |
|---|
| 4103 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 4104 | case TARGET_ATTACKING: |
|---|
| 4105 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 4106 | case TARGET_DESTINATION: |
|---|
| 4107 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 4108 | case TARGET_RANDOM_FRIEND: |
|---|
| 4109 | case TARGET_RANDOM_SINGLE: |
|---|
| 4110 | case TARGET_RANDOM_DESTINATION: |
|---|
| 4111 | CastSpellOnRandomTarget(i, spells[i].mindist2cast, spells[i].maxdist2cast, spells[i].minhp2cast, spells[i].maxhp2cast); break; |
|---|
| 4112 | } |
|---|
| 4113 | |
|---|
| 4114 | if (i == 2) |
|---|
| 4115 | ChainSound(); |
|---|
| 4116 | |
|---|
| 4117 | if (spells[i].speech != "") |
|---|
| 4118 | { |
|---|
| 4119 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, spells[i].speech.c_str()); |
|---|
| 4120 | _unit->PlaySoundToSet(spells[i].soundid); |
|---|
| 4121 | } |
|---|
| 4122 | |
|---|
| 4123 | m_spellcheck[i] = false; |
|---|
| 4124 | return; |
|---|
| 4125 | } |
|---|
| 4126 | |
|---|
| 4127 | uint32 t = (uint32)time(NULL); |
|---|
| 4128 | if(((val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) || i == 1) && t > spells[i].casttime) |
|---|
| 4129 | { |
|---|
| 4130 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 4131 | spells[i].casttime = t + spells[i].cooldown; |
|---|
| 4132 | m_spellcheck[i] = true; |
|---|
| 4133 | } |
|---|
| 4134 | comulativeperc += spells[i].perctrigger; |
|---|
| 4135 | } |
|---|
| 4136 | } |
|---|
| 4137 | } |
|---|
| 4138 | |
|---|
| 4139 | void CastSpellOnRandomTarget(uint32 i, float mindist2cast, float maxdist2cast, int minhp2cast, int maxhp2cast) |
|---|
| 4140 | { |
|---|
| 4141 | if (!maxdist2cast) maxdist2cast = 100.0f; |
|---|
| 4142 | if (!maxhp2cast) maxhp2cast = 100; |
|---|
| 4143 | |
|---|
| 4144 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 4145 | { |
|---|
| 4146 | std::vector<Unit*> TargetTable; /* From M4ksiu - Big THX to Capt who helped me with std stuff to make it simple and fully working <3 */ |
|---|
| 4147 | /* If anyone wants to use this function, then leave this note! */ |
|---|
| 4148 | for(set<Object*>::iterator itr = _unit->GetInRangeSetBegin(); itr != _unit->GetInRangeSetEnd(); ++itr) |
|---|
| 4149 | { |
|---|
| 4150 | if (((spells[i].targettype == TARGET_RANDOM_FRIEND && isFriendly(_unit, (*itr))) || (spells[i].targettype != TARGET_RANDOM_FRIEND && isHostile(_unit, (*itr)) && (*itr) != _unit)) && ((*itr)->GetTypeId()== TYPEID_UNIT || (*itr)->GetTypeId() == TYPEID_PLAYER) && (*itr)->GetInstanceID() == _unit->GetInstanceID()) // isAttackable(_unit, (*itr)) && |
|---|
| 4151 | { |
|---|
| 4152 | Unit* RandomTarget = NULL; |
|---|
| 4153 | RandomTarget = TO_UNIT(*itr); |
|---|
| 4154 | |
|---|
| 4155 | if (RandomTarget->isAlive() && _unit->GetDistance2dSq(RandomTarget) >= mindist2cast*mindist2cast && _unit->GetDistance2dSq(RandomTarget) <= maxdist2cast*maxdist2cast && ((RandomTarget->GetHealthPct() >= minhp2cast && RandomTarget->GetHealthPct() <= maxhp2cast && spells[i].targettype == TARGET_RANDOM_FRIEND) || (_unit->GetAIInterface()->getThreatByPtr(RandomTarget) > 0 && isHostile(_unit, RandomTarget)))) |
|---|
| 4156 | { |
|---|
| 4157 | TargetTable.push_back(RandomTarget); |
|---|
| 4158 | } |
|---|
| 4159 | } |
|---|
| 4160 | } |
|---|
| 4161 | |
|---|
| 4162 | if (_unit->GetHealthPct() >= minhp2cast && _unit->GetHealthPct() <= maxhp2cast && spells[i].targettype == TARGET_RANDOM_FRIEND) |
|---|
| 4163 | TargetTable.push_back(_unit); |
|---|
| 4164 | |
|---|
| 4165 | if (!TargetTable.size()) |
|---|
| 4166 | return; |
|---|
| 4167 | |
|---|
| 4168 | size_t RandTarget = rand()%TargetTable.size(); |
|---|
| 4169 | |
|---|
| 4170 | Unit* RTarget = TargetTable[RandTarget]; |
|---|
| 4171 | |
|---|
| 4172 | if (!RTarget) |
|---|
| 4173 | return; |
|---|
| 4174 | |
|---|
| 4175 | switch (spells[i].targettype) |
|---|
| 4176 | { |
|---|
| 4177 | case TARGET_RANDOM_FRIEND: |
|---|
| 4178 | case TARGET_RANDOM_SINGLE: |
|---|
| 4179 | _unit->CastSpell(RTarget, spells[i].info, spells[i].instant); break; |
|---|
| 4180 | case TARGET_RANDOM_DESTINATION: |
|---|
| 4181 | _unit->CastSpellAoF(RTarget->GetPositionX(), RTarget->GetPositionY(), RTarget->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 4182 | } |
|---|
| 4183 | |
|---|
| 4184 | TargetTable.clear(); |
|---|
| 4185 | } |
|---|
| 4186 | } |
|---|
| 4187 | |
|---|
| 4188 | void ChainSound() |
|---|
| 4189 | { |
|---|
| 4190 | uint32 RandomSpeach = rand()%2; |
|---|
| 4191 | switch (RandomSpeach) |
|---|
| 4192 | { |
|---|
| 4193 | case 0: |
|---|
| 4194 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Your soul is bound to me now!"); |
|---|
| 4195 | _unit->PlaySoundToSet(8812); |
|---|
| 4196 | break; |
|---|
| 4197 | case 1: |
|---|
| 4198 | _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "There will be no escape!"); |
|---|
| 4199 | _unit->PlaySoundToSet(8813); |
|---|
| 4200 | break; |
|---|
| 4201 | } |
|---|
| 4202 | } |
|---|
| 4203 | |
|---|
| 4204 | bool GetDespawnTrash() { return DespawnTrash; } |
|---|
| 4205 | |
|---|
| 4206 | protected: |
|---|
| 4207 | |
|---|
| 4208 | bool DespawnTrash, EventStart; |
|---|
| 4209 | uint32 SpawnCounter; |
|---|
| 4210 | uint32 HelpDialog; |
|---|
| 4211 | uint32 SpawnTimer; |
|---|
| 4212 | uint32 PhaseTimer; |
|---|
| 4213 | uint32 WaveTimer; |
|---|
| 4214 | uint32 GCounter; |
|---|
| 4215 | uint32 m_phase; |
|---|
| 4216 | int nrspells; |
|---|
| 4217 | }; |
|---|
| 4218 | |
|---|
| 4219 | // The Lich KingAI |
|---|
| 4220 | |
|---|
| 4221 | class TheLichKingAI : public CreatureAIScript |
|---|
| 4222 | { |
|---|
| 4223 | public: |
|---|
| 4224 | ADD_CREATURE_FACTORY_FUNCTION(TheLichKingAI); |
|---|
| 4225 | |
|---|
| 4226 | TheLichKingAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 4227 | { |
|---|
| 4228 | _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); |
|---|
| 4229 | } |
|---|
| 4230 | }; |
|---|
| 4231 | |
|---|
| 4232 | // Soldier of the Frozen WastesAI |
|---|
| 4233 | |
|---|
| 4234 | #define DARK_BLAST 28457 // 28458 |
|---|
| 4235 | |
|---|
| 4236 | class SoldierOfTheFrozenWastesAI : public CreatureAIScript |
|---|
| 4237 | { |
|---|
| 4238 | public: |
|---|
| 4239 | ADD_CREATURE_FACTORY_FUNCTION(SoldierOfTheFrozenWastesAI); |
|---|
| 4240 | SoldierOfTheFrozenWastesAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 4241 | { |
|---|
| 4242 | _unit->m_noRespawn = true; |
|---|
| 4243 | |
|---|
| 4244 | OnStart = false; |
|---|
| 4245 | |
|---|
| 4246 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4247 | } |
|---|
| 4248 | |
|---|
| 4249 | void OnCombatStart(Unit* mTarget) |
|---|
| 4250 | { |
|---|
| 4251 | LastPosX = _unit->GetPositionX(); |
|---|
| 4252 | LastPosY = _unit->GetPositionY(); |
|---|
| 4253 | LastPosZ = _unit->GetPositionZ(); |
|---|
| 4254 | |
|---|
| 4255 | //RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4256 | } |
|---|
| 4257 | |
|---|
| 4258 | void OnCombatStop(Unit* mTarget) |
|---|
| 4259 | { |
|---|
| 4260 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 4261 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 4262 | |
|---|
| 4263 | //RemoveAIUpdateEvent(); |
|---|
| 4264 | } |
|---|
| 4265 | |
|---|
| 4266 | void OnDied(Unit* mKiller) |
|---|
| 4267 | { |
|---|
| 4268 | RemoveAIUpdateEvent(); |
|---|
| 4269 | } |
|---|
| 4270 | |
|---|
| 4271 | void AIUpdate() |
|---|
| 4272 | { |
|---|
| 4273 | Creature* Kelthuzad = NULL; |
|---|
| 4274 | Kelthuzad = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(3749.950195f, -5113.451660f, 141.288635f, 15990); |
|---|
| 4275 | if (Kelthuzad == NULL || !Kelthuzad->isAlive()) |
|---|
| 4276 | { |
|---|
| 4277 | _unit->Despawn(0,0); |
|---|
| 4278 | return; |
|---|
| 4279 | } |
|---|
| 4280 | else if (Kelthuzad->GetScript()) |
|---|
| 4281 | { |
|---|
| 4282 | CreatureAIScript *pScript = Kelthuzad->GetScript(); |
|---|
| 4283 | if (static_cast<KelthuzadAI*>(pScript)->GetDespawnTrash()) |
|---|
| 4284 | { |
|---|
| 4285 | _unit->Despawn(0,0); |
|---|
| 4286 | return; |
|---|
| 4287 | } |
|---|
| 4288 | } |
|---|
| 4289 | if (_unit->GetPositionX() == LastPosX && _unit->GetPositionY() == LastPosY && _unit->GetPositionZ() == LastPosZ) |
|---|
| 4290 | { |
|---|
| 4291 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4292 | } |
|---|
| 4293 | if (OnStart == false) |
|---|
| 4294 | { |
|---|
| 4295 | for (int i = 0; i < 7; i++) |
|---|
| 4296 | { |
|---|
| 4297 | if (_unit->GetPositionX() == Waves[i].x && _unit->GetPositionY() == Waves[i].y && _unit->GetPositionZ() == Waves[i].z) |
|---|
| 4298 | { |
|---|
| 4299 | float xchange = (float)RandomFloat(10.0f); |
|---|
| 4300 | float distance = 10.0f; |
|---|
| 4301 | |
|---|
| 4302 | float ychange = sqrt(distance*distance - xchange*xchange); |
|---|
| 4303 | |
|---|
| 4304 | if (rand()%2 == 1) |
|---|
| 4305 | xchange *= -1; |
|---|
| 4306 | if (rand()%2 == 1) |
|---|
| 4307 | ychange *= -1; |
|---|
| 4308 | |
|---|
| 4309 | newposx = 3715.845703f + xchange; |
|---|
| 4310 | newposy = -5106.928223f + ychange; |
|---|
| 4311 | |
|---|
| 4312 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4313 | } |
|---|
| 4314 | } |
|---|
| 4315 | |
|---|
| 4316 | OnStart = true; |
|---|
| 4317 | } |
|---|
| 4318 | |
|---|
| 4319 | if (_unit->GetAIInterface()->GetNextTarget() != NULL) |
|---|
| 4320 | { |
|---|
| 4321 | Unit* target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 4322 | if (_unit->GetDistance2dSq(target) <= 49.0f) |
|---|
| 4323 | _unit->CastSpell(_unit, DARK_BLAST, true); |
|---|
| 4324 | } |
|---|
| 4325 | } |
|---|
| 4326 | |
|---|
| 4327 | protected: |
|---|
| 4328 | |
|---|
| 4329 | float LastPosX, LastPosY, LastPosZ; |
|---|
| 4330 | float newposx; |
|---|
| 4331 | float newposy; |
|---|
| 4332 | bool OnStart; |
|---|
| 4333 | }; |
|---|
| 4334 | |
|---|
| 4335 | // Unstoppable Abomination AI |
|---|
| 4336 | |
|---|
| 4337 | #define UA_MORTAL_WOUND 25646 // 36814 |
|---|
| 4338 | |
|---|
| 4339 | class UnstoppableAbominationAI : public CreatureAIScript |
|---|
| 4340 | { |
|---|
| 4341 | public: |
|---|
| 4342 | ADD_CREATURE_FACTORY_FUNCTION(UnstoppableAbominationAI); |
|---|
| 4343 | SP_AI_Spell spells[1]; |
|---|
| 4344 | bool m_spellcheck[1]; |
|---|
| 4345 | |
|---|
| 4346 | UnstoppableAbominationAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 4347 | { |
|---|
| 4348 | nrspells = 1; |
|---|
| 4349 | for(int i=0;i<nrspells;i++) |
|---|
| 4350 | { |
|---|
| 4351 | m_spellcheck[i] = false; |
|---|
| 4352 | spells[i].casttime = 0; |
|---|
| 4353 | } |
|---|
| 4354 | |
|---|
| 4355 | spells[0].info = dbcSpell.LookupEntry(UA_MORTAL_WOUND); |
|---|
| 4356 | spells[0].targettype = TARGET_ATTACKING; |
|---|
| 4357 | spells[0].instant = true; |
|---|
| 4358 | spells[0].cooldown = 10; |
|---|
| 4359 | spells[0].perctrigger = 15.0f; |
|---|
| 4360 | spells[0].attackstoptimer = 1000; |
|---|
| 4361 | |
|---|
| 4362 | _unit->m_noRespawn = true; |
|---|
| 4363 | |
|---|
| 4364 | OnStart = false; |
|---|
| 4365 | |
|---|
| 4366 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4367 | } |
|---|
| 4368 | |
|---|
| 4369 | void OnCombatStart(Unit* mTarget) |
|---|
| 4370 | { |
|---|
| 4371 | LastPosX = _unit->GetPositionX(); |
|---|
| 4372 | LastPosY = _unit->GetPositionY(); |
|---|
| 4373 | LastPosZ = _unit->GetPositionZ(); |
|---|
| 4374 | |
|---|
| 4375 | //RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4376 | |
|---|
| 4377 | for (int i = 0; i < nrspells; i++) |
|---|
| 4378 | spells[i].casttime = 0; |
|---|
| 4379 | } |
|---|
| 4380 | |
|---|
| 4381 | void OnCombatStop(Unit* mTarget) |
|---|
| 4382 | { |
|---|
| 4383 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 4384 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 4385 | |
|---|
| 4386 | //RemoveAIUpdateEvent(); |
|---|
| 4387 | } |
|---|
| 4388 | |
|---|
| 4389 | void OnDied(Unit* mKiller) |
|---|
| 4390 | { |
|---|
| 4391 | RemoveAIUpdateEvent(); |
|---|
| 4392 | } |
|---|
| 4393 | |
|---|
| 4394 | void AIUpdate() |
|---|
| 4395 | { |
|---|
| 4396 | Creature* Kelthuzad = NULL; |
|---|
| 4397 | Kelthuzad = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(3749.950195f, -5113.451660f, 141.288635f, 15990); |
|---|
| 4398 | if (Kelthuzad == NULL || !Kelthuzad->isAlive()) |
|---|
| 4399 | { |
|---|
| 4400 | _unit->Despawn(0,0); |
|---|
| 4401 | return; |
|---|
| 4402 | } |
|---|
| 4403 | else if (Kelthuzad->GetScript()) |
|---|
| 4404 | { |
|---|
| 4405 | CreatureAIScript *pScript = Kelthuzad->GetScript(); |
|---|
| 4406 | if (static_cast<KelthuzadAI*>(pScript)->GetDespawnTrash()) |
|---|
| 4407 | { |
|---|
| 4408 | _unit->Despawn(0,0); |
|---|
| 4409 | return; |
|---|
| 4410 | } |
|---|
| 4411 | } |
|---|
| 4412 | if (_unit->GetPositionX() == LastPosX && _unit->GetPositionY() == LastPosY && _unit->GetPositionZ() == LastPosZ) |
|---|
| 4413 | { |
|---|
| 4414 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4415 | } |
|---|
| 4416 | if (OnStart == false) |
|---|
| 4417 | { |
|---|
| 4418 | for (int i = 0; i < 7; i++) |
|---|
| 4419 | { |
|---|
| 4420 | if (_unit->GetPositionX() == Waves[i].x && _unit->GetPositionY() == Waves[i].y && _unit->GetPositionZ() == Waves[i].z) |
|---|
| 4421 | { |
|---|
| 4422 | float xchange = (float)RandomFloat(10.0f); |
|---|
| 4423 | float distance = 10.0f; |
|---|
| 4424 | |
|---|
| 4425 | float ychange = sqrt(distance*distance - xchange*xchange); |
|---|
| 4426 | |
|---|
| 4427 | if (rand()%2 == 1) |
|---|
| 4428 | xchange *= -1; |
|---|
| 4429 | if (rand()%2 == 1) |
|---|
| 4430 | ychange *= -1; |
|---|
| 4431 | |
|---|
| 4432 | newposx = 3715.845703f + xchange; |
|---|
| 4433 | newposy = -5106.928223f + ychange; |
|---|
| 4434 | |
|---|
| 4435 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4436 | } |
|---|
| 4437 | } |
|---|
| 4438 | |
|---|
| 4439 | OnStart = true; |
|---|
| 4440 | } |
|---|
| 4441 | |
|---|
| 4442 | float val = (float)RandomFloat(100.0f); |
|---|
| 4443 | SpellCast(val); |
|---|
| 4444 | } |
|---|
| 4445 | |
|---|
| 4446 | void SpellCast(float val) |
|---|
| 4447 | { |
|---|
| 4448 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 4449 | { |
|---|
| 4450 | float comulativeperc = 0; |
|---|
| 4451 | Unit* target = NULL; |
|---|
| 4452 | for(int i=0;i<nrspells;i++) |
|---|
| 4453 | { |
|---|
| 4454 | if(!spells[i].perctrigger) continue; |
|---|
| 4455 | |
|---|
| 4456 | if(m_spellcheck[i]) |
|---|
| 4457 | { |
|---|
| 4458 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 4459 | |
|---|
| 4460 | if (i == 0 && _unit->GetDistance2dSq(target) > 25.0f) return; |
|---|
| 4461 | |
|---|
| 4462 | switch(spells[i].targettype) |
|---|
| 4463 | { |
|---|
| 4464 | case TARGET_SELF: |
|---|
| 4465 | case TARGET_VARIOUS: |
|---|
| 4466 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 4467 | case TARGET_ATTACKING: |
|---|
| 4468 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 4469 | case TARGET_DESTINATION: |
|---|
| 4470 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 4471 | } |
|---|
| 4472 | m_spellcheck[i] = false; |
|---|
| 4473 | return; |
|---|
| 4474 | } |
|---|
| 4475 | |
|---|
| 4476 | uint32 t = (uint32)time(NULL); |
|---|
| 4477 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger) && t > spells[i].casttime) |
|---|
| 4478 | { |
|---|
| 4479 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 4480 | spells[i].casttime = t + spells[i].cooldown; |
|---|
| 4481 | m_spellcheck[i] = true; |
|---|
| 4482 | } |
|---|
| 4483 | comulativeperc += spells[i].perctrigger; |
|---|
| 4484 | } |
|---|
| 4485 | } |
|---|
| 4486 | } |
|---|
| 4487 | |
|---|
| 4488 | protected: |
|---|
| 4489 | |
|---|
| 4490 | float LastPosX, LastPosY, LastPosZ; |
|---|
| 4491 | float newposx; |
|---|
| 4492 | float newposy; |
|---|
| 4493 | bool OnStart; |
|---|
| 4494 | int nrspells; |
|---|
| 4495 | }; |
|---|
| 4496 | |
|---|
| 4497 | // Soul Weaver AI |
|---|
| 4498 | |
|---|
| 4499 | #define WAIL_OF_SOULS 28459 |
|---|
| 4500 | |
|---|
| 4501 | class SoulWeaverAI : public CreatureAIScript |
|---|
| 4502 | { |
|---|
| 4503 | public: |
|---|
| 4504 | ADD_CREATURE_FACTORY_FUNCTION(SoulWeaverAI); |
|---|
| 4505 | SP_AI_Spell spells[1]; |
|---|
| 4506 | bool m_spellcheck[1]; |
|---|
| 4507 | |
|---|
| 4508 | SoulWeaverAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 4509 | { |
|---|
| 4510 | nrspells = 1; |
|---|
| 4511 | for(int i=0;i<nrspells;i++) |
|---|
| 4512 | { |
|---|
| 4513 | m_spellcheck[i] = false; |
|---|
| 4514 | spells[i].casttime = 0; |
|---|
| 4515 | } |
|---|
| 4516 | |
|---|
| 4517 | spells[0].info = dbcSpell.LookupEntry(WAIL_OF_SOULS); |
|---|
| 4518 | spells[0].targettype = TARGET_VARIOUS; |
|---|
| 4519 | spells[0].instant = true; |
|---|
| 4520 | spells[0].cooldown = 10; |
|---|
| 4521 | spells[0].perctrigger = 15.0f; |
|---|
| 4522 | spells[0].attackstoptimer = 1000; |
|---|
| 4523 | |
|---|
| 4524 | _unit->m_noRespawn = true; |
|---|
| 4525 | |
|---|
| 4526 | OnStart = false; |
|---|
| 4527 | |
|---|
| 4528 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4529 | } |
|---|
| 4530 | |
|---|
| 4531 | void OnCombatStart(Unit* mTarget) |
|---|
| 4532 | { |
|---|
| 4533 | LastPosX = _unit->GetPositionX(); |
|---|
| 4534 | LastPosY = _unit->GetPositionY(); |
|---|
| 4535 | LastPosZ = _unit->GetPositionZ(); |
|---|
| 4536 | |
|---|
| 4537 | //RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4538 | |
|---|
| 4539 | for (int i = 0; i < nrspells; i++) |
|---|
| 4540 | spells[i].casttime = 0; |
|---|
| 4541 | } |
|---|
| 4542 | |
|---|
| 4543 | void OnCombatStop(Unit* mTarget) |
|---|
| 4544 | { |
|---|
| 4545 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 4546 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 4547 | |
|---|
| 4548 | //RemoveAIUpdateEvent(); |
|---|
| 4549 | } |
|---|
| 4550 | |
|---|
| 4551 | void OnDied(Unit* mKiller) |
|---|
| 4552 | { |
|---|
| 4553 | RemoveAIUpdateEvent(); |
|---|
| 4554 | } |
|---|
| 4555 | |
|---|
| 4556 | void AIUpdate() |
|---|
| 4557 | { |
|---|
| 4558 | Creature* Kelthuzad = NULL; |
|---|
| 4559 | Kelthuzad = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(3749.950195f, -5113.451660f, 141.288635f, 15990); |
|---|
| 4560 | if (Kelthuzad == NULL || !Kelthuzad->isAlive()) |
|---|
| 4561 | { |
|---|
| 4562 | _unit->Despawn(0,0); |
|---|
| 4563 | return; |
|---|
| 4564 | } |
|---|
| 4565 | else if (Kelthuzad->GetScript()) |
|---|
| 4566 | { |
|---|
| 4567 | CreatureAIScript *pScript = Kelthuzad->GetScript(); |
|---|
| 4568 | if (static_cast<KelthuzadAI*>(pScript)->GetDespawnTrash()) |
|---|
| 4569 | { |
|---|
| 4570 | _unit->Despawn(0,0); |
|---|
| 4571 | return; |
|---|
| 4572 | } |
|---|
| 4573 | } |
|---|
| 4574 | if (_unit->GetPositionX() == LastPosX && _unit->GetPositionY() == LastPosY && _unit->GetPositionZ() == LastPosZ) |
|---|
| 4575 | { |
|---|
| 4576 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4577 | } |
|---|
| 4578 | if (OnStart == false) |
|---|
| 4579 | { |
|---|
| 4580 | for (int i = 0; i < 7; i++) |
|---|
| 4581 | { |
|---|
| 4582 | if (_unit->GetPositionX() == Waves[i].x && _unit->GetPositionY() == Waves[i].y && _unit->GetPositionZ() == Waves[i].z) |
|---|
| 4583 | { |
|---|
| 4584 | float xchange = (float)RandomFloat(10.0f); |
|---|
| 4585 | float distance = 10.0f; |
|---|
| 4586 | |
|---|
| 4587 | float ychange = sqrt(distance*distance - xchange*xchange); |
|---|
| 4588 | |
|---|
| 4589 | if (rand()%2 == 1) |
|---|
| 4590 | xchange *= -1; |
|---|
| 4591 | if (rand()%2 == 1) |
|---|
| 4592 | ychange *= -1; |
|---|
| 4593 | |
|---|
| 4594 | newposx = 3715.845703f + xchange; |
|---|
| 4595 | newposy = -5106.928223f + ychange; |
|---|
| 4596 | |
|---|
| 4597 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4598 | } |
|---|
| 4599 | } |
|---|
| 4600 | |
|---|
| 4601 | OnStart = true; |
|---|
| 4602 | } |
|---|
| 4603 | |
|---|
| 4604 | float val = (float)RandomFloat(100.0f); |
|---|
| 4605 | SpellCast(val); |
|---|
| 4606 | } |
|---|
| 4607 | |
|---|
| 4608 | void SpellCast(float val) |
|---|
| 4609 | { |
|---|
| 4610 | if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) |
|---|
| 4611 | { |
|---|
| 4612 | float comulativeperc = 0; |
|---|
| 4613 | Unit* target = NULL; |
|---|
| 4614 | for(int i=0;i<nrspells;i++) |
|---|
| 4615 | { |
|---|
| 4616 | if(!spells[i].perctrigger) continue; |
|---|
| 4617 | |
|---|
| 4618 | if(m_spellcheck[i]) |
|---|
| 4619 | { |
|---|
| 4620 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 4621 | |
|---|
| 4622 | if (i == 0 && _unit->GetDistance2dSq(target) > 64.0f) return; // 8yards |
|---|
| 4623 | |
|---|
| 4624 | switch(spells[i].targettype) |
|---|
| 4625 | { |
|---|
| 4626 | case TARGET_SELF: |
|---|
| 4627 | case TARGET_VARIOUS: |
|---|
| 4628 | _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; |
|---|
| 4629 | case TARGET_ATTACKING: |
|---|
| 4630 | _unit->CastSpell(target, spells[i].info, spells[i].instant); break; |
|---|
| 4631 | case TARGET_DESTINATION: |
|---|
| 4632 | _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; |
|---|
| 4633 | } |
|---|
| 4634 | m_spellcheck[i] = false; |
|---|
| 4635 | return; |
|---|
| 4636 | } |
|---|
| 4637 | |
|---|
| 4638 | uint32 t = (uint32)time(NULL); |
|---|
| 4639 | if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger) && t > spells[i].casttime) |
|---|
| 4640 | { |
|---|
| 4641 | _unit->setAttackTimer(spells[i].attackstoptimer, false); |
|---|
| 4642 | spells[i].casttime = t + spells[i].cooldown; |
|---|
| 4643 | m_spellcheck[i] = true; |
|---|
| 4644 | } |
|---|
| 4645 | comulativeperc += spells[i].perctrigger; |
|---|
| 4646 | } |
|---|
| 4647 | } |
|---|
| 4648 | } |
|---|
| 4649 | |
|---|
| 4650 | protected: |
|---|
| 4651 | |
|---|
| 4652 | float LastPosX, LastPosY, LastPosZ; |
|---|
| 4653 | float newposx; |
|---|
| 4654 | float newposy; |
|---|
| 4655 | bool OnStart; |
|---|
| 4656 | int nrspells; |
|---|
| 4657 | }; |
|---|
| 4658 | |
|---|
| 4659 | // Guardian of Icecrown AI |
|---|
| 4660 | |
|---|
| 4661 | #define BLOOD_TAP 28459 |
|---|
| 4662 | |
|---|
| 4663 | class GuardianOfIcecrownAI : public CreatureAIScript |
|---|
| 4664 | { |
|---|
| 4665 | public: |
|---|
| 4666 | ADD_CREATURE_FACTORY_FUNCTION(GuardianOfIcecrownAI); |
|---|
| 4667 | SP_AI_Spell spells[1]; |
|---|
| 4668 | bool m_spellcheck[1]; |
|---|
| 4669 | |
|---|
| 4670 | GuardianOfIcecrownAI(Creature* pCreature) : CreatureAIScript(pCreature) |
|---|
| 4671 | { |
|---|
| 4672 | nrspells = 1; |
|---|
| 4673 | for(int i=0;i<nrspells;i++) |
|---|
| 4674 | { |
|---|
| 4675 | m_spellcheck[i] = false; |
|---|
| 4676 | } |
|---|
| 4677 | |
|---|
| 4678 | spells[0].info = dbcSpell.LookupEntry(BLOOD_TAP); |
|---|
| 4679 | spells[0].targettype = TARGET_SELF; |
|---|
| 4680 | spells[0].instant = true; |
|---|
| 4681 | spells[0].cooldown = 0; |
|---|
| 4682 | spells[0].perctrigger = 0.0f; |
|---|
| 4683 | spells[0].attackstoptimer = 1000; |
|---|
| 4684 | |
|---|
| 4685 | _unit->GetAIInterface()->m_moveRun = true; |
|---|
| 4686 | _unit->m_noRespawn = true; |
|---|
| 4687 | |
|---|
| 4688 | OnStart = false; |
|---|
| 4689 | |
|---|
| 4690 | RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4691 | } |
|---|
| 4692 | |
|---|
| 4693 | void OnCombatStart(Unit* mTarget) |
|---|
| 4694 | { |
|---|
| 4695 | if (_unit->GetAIInterface()->GetNextTarget()) |
|---|
| 4696 | LastTarget = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 4697 | |
|---|
| 4698 | LastPosX = _unit->GetPositionX(); |
|---|
| 4699 | LastPosY = _unit->GetPositionY(); |
|---|
| 4700 | LastPosZ = _unit->GetPositionZ(); |
|---|
| 4701 | |
|---|
| 4702 | //RegisterAIUpdateEvent(_unit->GetBaseAttackTime(MELEE)); |
|---|
| 4703 | } |
|---|
| 4704 | |
|---|
| 4705 | void OnCombatStop(Unit* mTarget) |
|---|
| 4706 | { |
|---|
| 4707 | _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); |
|---|
| 4708 | _unit->GetAIInterface()->SetAIState(STATE_IDLE); |
|---|
| 4709 | |
|---|
| 4710 | //RemoveAIUpdateEvent(); |
|---|
| 4711 | } |
|---|
| 4712 | |
|---|
| 4713 | void OnDied(Unit* mKiller) |
|---|
| 4714 | { |
|---|
| 4715 | RemoveAIUpdateEvent(); |
|---|
| 4716 | } |
|---|
| 4717 | |
|---|
| 4718 | void AIUpdate() |
|---|
| 4719 | { |
|---|
| 4720 | Unit* Kelthuzad = NULL; |
|---|
| 4721 | Kelthuzad = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(3715.950195f, -5106.451660f, 141.288635f, 15990); |
|---|
| 4722 | if (Kelthuzad && !Kelthuzad->isAlive()) |
|---|
| 4723 | { |
|---|
| 4724 | _unit->Despawn(0,0); |
|---|
| 4725 | } |
|---|
| 4726 | if (_unit->GetPositionX() == LastPosX && _unit->GetPositionY() == LastPosY && _unit->GetPositionZ() == LastPosZ) |
|---|
| 4727 | { |
|---|
| 4728 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4729 | } |
|---|
| 4730 | if (OnStart == false) |
|---|
| 4731 | { |
|---|
| 4732 | for (int i = 0; i < 7; i++) |
|---|
| 4733 | { |
|---|
| 4734 | if (_unit->GetPositionX() == Guardians[i].x && _unit->GetPositionY() == Guardians[i].y && _unit->GetPositionZ() == Guardians[i].z) |
|---|
| 4735 | { |
|---|
| 4736 | float xchange = (float)RandomFloat(10.0f); |
|---|
| 4737 | float distance = 10.0f; |
|---|
| 4738 | |
|---|
| 4739 | float ychange = sqrt(distance*distance - xchange*xchange); |
|---|
| 4740 | |
|---|
| 4741 | if (rand()%2 == 1) |
|---|
| 4742 | xchange *= -1; |
|---|
| 4743 | if (rand()%2 == 1) |
|---|
| 4744 | ychange *= -1; |
|---|
| 4745 | |
|---|
| 4746 | newposx = 3715.845703f + xchange; |
|---|
| 4747 | newposy = -5106.928223f + ychange; |
|---|
| 4748 | |
|---|
| 4749 | _unit->GetAIInterface()->MoveTo(newposx, newposy, 141.290451f, _unit->GetOrientation()); |
|---|
| 4750 | } |
|---|
| 4751 | } |
|---|
| 4752 | |
|---|
| 4753 | OnStart = true; |
|---|
| 4754 | } |
|---|
| 4755 | |
|---|
| 4756 | if (_unit->GetAIInterface()->GetNextTarget()) |
|---|
| 4757 | { |
|---|
| 4758 | Unit* target = NULL; |
|---|
| 4759 | target = _unit->GetAIInterface()->GetNextTarget(); |
|---|
| 4760 | |
|---|
| 4761 | if (!LastTarget) { LastTarget = target; return; } |
|---|
| 4762 | |
|---|
| 4763 | if (LastTarget != target) |
|---|
| 4764 | _unit->CastSpell(_unit, spells[0].info, spells[0].instant); |
|---|
| 4765 | |
|---|
| 4766 | LastTarget = target; |
|---|
| 4767 | } |
|---|
| 4768 | } |
|---|
| 4769 | |
|---|
| 4770 | protected: |
|---|
| 4771 | |
|---|
| 4772 | float LastPosX, LastPosY, LastPosZ; |
|---|
| 4773 | Unit* LastTarget; |
|---|
| 4774 | float newposx; |
|---|
| 4775 | float newposy; |
|---|
| 4776 | bool OnStart; |
|---|
| 4777 | int nrspells; |
|---|
| 4778 | }; |
|---|
| 4779 | |
|---|
| 4780 | void SetupNaxxramas( ScriptMgr* pScriptMgr ); |
|---|