Changeset 137
- Timestamp:
- 11/19/08 13:39:29 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_felblood_kaelthas.cpp
r90 r137 25 25 #include "def_magisters_terrace.h" 26 26 #include "WorldPacket.h" 27 #include "ObjectMgr.h" 27 28 28 29 /*** Spells ***/ … … 35 36 #define SPELL_PHOENIX 44194 // Summons a phoenix (Doesn't work?) 36 37 #define SPELL_PHOENIX_BURN 44198 // A spell Phoenix uses to damage everything around 38 #define SPELL_PHOENIX_FIREBALL 44202 // Phoenix casts this in phase 2 and stops moving 37 39 38 40 #define SPELL_FLAMESTRIKE1_NORMAL 44190 // Damage part … … 82 84 83 85 /** Locations **/ 84 float KaelLocations[3][2]= 85 { 86 {148.744659, 181.377426}, 87 {140.823883, 195.403046}, 88 {156.574188, 195.650482}, 86 float KaelLocations[6][2]= 87 { 88 {148.744659, 181.377426},//center 89 {140.823883, 195.403046},//phoenixpos1 90 {156.574188, 195.650482},//phoenixpos2 91 {149.813, 160.917},//spherepos1 92 {167.223, 173.594},//spherepos2 93 {130.68, 173.007},//spherepos3 89 94 }; 90 95 #define LOCATION_Z -16.727455 … … 143 148 144 149 if(pInstance) 145 pInstance->SetData(DATA_KAELTHAS_EVENT, 0); 146 } 147 150 { 151 if(m_creature->isDead()) 152 pInstance->SetData(DATA_KAELTHAS_EVENT, DONE); 153 else 154 pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); 155 } 156 } 157 158 void KilledUnit(Unit* victim) 159 { 160 if(victim && (victim->GetTypeId() == TYPEID_PLAYER)) 161 { 162 victim->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); 163 victim->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); 164 WorldPacket data(12); 165 data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); 166 data.append(victim->GetPackGUID()); 167 data << uint32(0); 168 victim->SendMessageToSet(&data, true); 169 } 170 } 148 171 void JustDied(Unit *killer) 149 172 { 173 RemoveGravityLapse(); 150 174 DoYell(SAY_DEATH,LANG_UNIVERSAL,NULL); 151 175 DoPlaySoundToSet(m_creature,SOUND_DEATH); 176 if(pInstance) 177 pInstance->SetData(DATA_KAELTHAS_EVENT, DONE); 152 178 } 153 179 … … 162 188 DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL); 163 189 DoPlaySoundToSet(m_creature,SOUND_AGGRO); 190 if(pInstance) 191 pInstance->SetData(DATA_KAELTHAS_EVENT, IN_PROGRESS); 164 192 } 165 193 … … 176 204 { 177 205 float threat = m_creature->getThreatManager().getThreat(pUnit); 178 SummonedUnit->AddThreat(pUnit, threat);206 SummonedUnit->AddThreat(pUnit, 0.1f); 179 207 } 180 208 } 181 209 } 182 210 211 void EnterEvadeMode() 212 { 213 RemoveGravityLapse(); 214 m_creature->InterruptNonMeleeSpells(true); 215 m_creature->RemoveAllAuras(); 216 m_creature->DeleteThreatList(); 217 m_creature->CombatStop(); 218 m_creature->LoadCreaturesAddon(); 219 220 if( m_creature->isAlive() ) 221 m_creature->GetMotionMaster()->MoveTargetedHome(); 222 223 m_creature->SetLootRecipient(NULL); 224 225 InCombat = false; 226 Reset(); 227 } 228 183 229 void TeleportPlayersToSelf() 184 230 { 185 float x = KaelLocations[0][0]; 186 float y = KaelLocations[0][1]; 187 m_creature->Relocate(x, y, LOCATION_Z, 0); 188 //m_creature->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues... 189 std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); 190 for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end();++i) 191 { 192 Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); 193 if(pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) 194 pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true); 231 float x,y,z; 232 m_creature->Relocate(KaelLocations[0][0], KaelLocations[0][1], LOCATION_Z, 0); 233 Map *map = m_creature->GetMap(); 234 InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); 235 InstanceMap::PlayerList::const_iterator i; 236 for (i = PlayerList.begin(); i != PlayerList.end(); ++i) 237 { 238 //if(!(*i)->isGameMaster()) 239 if((*i) && (*i)->isAlive()) 240 { 241 (*i)->CastSpell((*i), SPELL_TELEPORT_CENTER, true); 242 m_creature->GetNearPoint(m_creature,x,y,z,5,5,0); 243 (*i)->TeleportTo(m_creature->GetMapId(),x,y,LOCATION_Z,(*i)->GetOrientation()); 244 } 195 245 } 196 246 DoCast(m_creature, SPELL_TELEPORT_CENTER, true); … … 199 249 void CastGravityLapseKnockUp() 200 250 { 201 std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); 202 for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end();++i) 203 { 204 Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); 205 if(pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) 251 Map *map = m_creature->GetMap(); 252 InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); 253 InstanceMap::PlayerList::const_iterator i; 254 for (i = PlayerList.begin(); i != PlayerList.end(); ++i) 255 { 256 if((*i) && (*i)->isAlive()) 206 257 // Knockback into the air 207 pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, m_creature->GetGUID());258 (*i)->CastSpell((*i), SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, m_creature->GetGUID()); 208 259 } 209 260 } … … 211 262 void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... 212 263 { 213 std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); 214 for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end();++i) 215 { 216 Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); 217 if(pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) 264 Map *map = m_creature->GetMap(); 265 InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); 266 InstanceMap::PlayerList::const_iterator i; 267 for (i = PlayerList.begin(); i != PlayerList.end(); ++i) 268 { 269 if((*i) && (*i)->isAlive()) 218 270 { 219 271 // Also needs an exception in spell system. 220 pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, m_creature->GetGUID());272 (*i)->CastSpell((*i), SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, m_creature->GetGUID()); 221 273 // Use packet hack 222 274 WorldPacket data(12); 223 275 data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); 224 data.append( pUnit->GetPackGUID());276 data.append((*i)->GetPackGUID()); 225 277 data << uint32(0); 226 pUnit->SendMessageToSet(&data, true); 278 (*i)->SendMessageToSet(&data, true); 279 (*i)->SetSpeed(MOVE_FLY, 2.0f); 227 280 } 228 281 } … … 231 284 void RemoveGravityLapse() 232 285 { 233 std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); 234 for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end();++i) 235 { 236 Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); 237 if(pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) 286 Map *map = m_creature->GetMap(); 287 InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); 288 InstanceMap::PlayerList::const_iterator i; 289 for (i = PlayerList.begin(); i != PlayerList.end(); ++i) 290 { 291 if((*i)) 238 292 { 239 pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);240 pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);293 (*i)->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); 294 (*i)->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); 241 295 WorldPacket data(12); 242 296 data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); 243 data.append( pUnit->GetPackGUID());297 data.append((*i)->GetPackGUID()); 244 298 data << uint32(0); 245 pUnit->SendMessageToSet(&data, true);299 (*i)->SendMessageToSet(&data, true); 246 300 } 247 301 } … … 279 333 float x = KaelLocations[random][0]; 280 334 float y = KaelLocations[random][1]; 281 Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_ TIMED_OR_CORPSE_DESPAWN, 60000);335 Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 60000); 282 336 if(Phoenix) 283 337 { 284 338 Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); 285 339 SetThreatList(Phoenix); 340 Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1); 341 if(target) 342 { 343 Phoenix->AddThreat(target,1000); 344 Phoenix->Attack(target,true); 345 Phoenix->GetMotionMaster()->MoveChase(target); 346 } 347 else 348 { 349 Phoenix->AddThreat(m_creature->getVictim(),1000); 350 Phoenix->Attack(m_creature->getVictim(),true); 351 Phoenix->GetMotionMaster()->MoveChase(m_creature->getVictim()); 352 } 286 353 } 287 354 … … 297 364 if(target) 298 365 { 366 m_creature->InterruptNonMeleeSpells(false); 299 367 DoCast(target, SPELL_FLAMESTRIKE3, true); 300 368 FlameStrikeTimer = 20000 + rand()%5000; … … 322 390 case 1: 323 391 { 392 m_creature->StopMoving(); 324 393 if(GravityLapseTimer < diff) 325 394 { … … 344 413 DoPlaySoundToSet(m_creature,SOUND_RECAST_GRAVITY); 345 414 } 415 m_creature->StopMoving(); 346 416 DoCast(m_creature, SPELL_GRAVITY_LAPSE_INITIAL); 347 417 GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell … … 366 436 GravityLapsePhase = 4; 367 437 for(uint8 i = 0; i < 3; ++i) 368 { 369 Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); 370 if(Orb) SetThreatList(Orb); 438 { 439 Creature* Orb = m_creature->SummonCreature(CREATURE_ARCANE_SPHERE,KaelLocations[3+i][0],KaelLocations[3+i][1],LOCATION_Z,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,30000); 440 if(Orb) 441 { 442 SetThreatList(Orb); 443 Unit *target = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,i); 444 if(target) 445 { 446 Orb->AddThreat(target,1000); 447 Orb->Attack(target,true); 448 Orb->GetMotionMaster()->MoveChase(target); 449 } 450 else 451 { 452 Unit *ntarget = SelectUnit(SELECT_TARGET_RANDOM,0); 453 if(ntarget) 454 { 455 Orb->AddThreat(ntarget,1000); 456 Orb->Attack(ntarget,true); 457 Orb->GetMotionMaster()->MoveChase(ntarget); 458 } 459 } 460 } 371 461 } 372 462 DoCast(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL); … … 427 517 struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI 428 518 { 429 mob_felkael_phoenixAI(Creature *c) : ScriptedAI(c) {Reset();} 430 519 mob_felkael_phoenixAI(Creature *c) : ScriptedAI(c) 520 { 521 pInstance = ((ScriptedInstance*)c->GetInstanceData()); 522 Reset(); 523 } 431 524 uint32 BurnTimer; 525 uint32 CheckTimer; 526 uint8 phase; 527 ScriptedInstance* pInstance; 528 bool end; 432 529 433 530 void Reset() 434 531 { 532 m_creature->SetSpeed(MOVE_RUN, 0.5f); 533 m_creature->SetSpeed(MOVE_WALK, 0.5f); 435 534 m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); 436 535 BurnTimer = 2000; 536 CheckTimer = 1000; 537 phase = 0; 538 end = false; 437 539 } 438 540 … … 441 543 void JustDied(Unit* slayer) 442 544 { 443 DoSpawnCreature(CREATURE_PHOENIX_EGG, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); 545 if (end) 546 return; 547 DoSpawnCreature(CREATURE_PHOENIX_EGG, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 45000); 444 548 } 445 549 446 550 void UpdateAI(const uint32 diff) 447 551 { 552 if(CheckTimer < diff) 553 { 554 if (pInstance) 555 { 556 Creature *boss = ((Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL))); 557 if (boss) 558 { 559 phase = ((boss_felblood_kaelthasAI*)boss->AI())->Phase; 560 if(boss->isDead() || !boss->isInCombat()) 561 { 562 end = true; 563 m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, NULL, false);//temphack, hellfire is not damaging self 564 } 565 } 566 } 567 CheckTimer = 1000; 568 }else CheckTimer -= diff; 569 448 570 if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) 449 571 return; 450 572 451 if (BurnTimer < diff) 452 { 453 DoCast(m_creature->getVictim(), SPELL_PHOENIX_BURN); 454 BurnTimer = 2000; 455 }else BurnTimer -= diff; 456 457 DoMeleeAttackIfReady(); 573 if (BurnTimer < diff) 574 { 575 if(!phase) 576 { 577 DoCast(m_creature, SPELL_PHOENIX_BURN); 578 m_creature->DealDamage(m_creature, 1500, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, NULL, false);//temphack, hellfire is not damaging self 579 } 580 else 581 { 582 m_creature->StopMoving(); 583 DoCast(m_creature->getVictim(), SPELL_PHOENIX_FIREBALL); 584 } 585 BurnTimer = 2000; 586 }else BurnTimer -= diff; 587 588 //DoMeleeAttackIfReady(); 458 589 } 459 590 }; 460 591 461 struct TRINITY_DLL_DECL mob_felkael_phoenix_eggAI : public ScriptedAI 462 { 463 mob_felkael_phoenix_eggAI(Creature *c) : ScriptedAI(c) {Reset();} 592 struct TRINITY_DLL_DECL mob_felkael_phoenix_eggAI : public Scripted_NoMovementAI 593 { 594 mob_felkael_phoenix_eggAI(Creature *c) : Scripted_NoMovementAI(c) 595 { 596 pInstance = ((ScriptedInstance*)c->GetInstanceData()); 597 Reset(); 598 } 464 599 465 600 uint32 HatchTimer; 466 601 ScriptedInstance* pInstance; 467 602 void Reset() { HatchTimer = 15000; } 468 603 469 604 void Aggro(Unit* who) {} 470 605 void MoveInLineOfSight(Unit* who) {} 471 472 606 void UpdateAI(const uint32 diff) 473 607 { 608 474 609 if(HatchTimer < diff) 475 610 { 476 DoSpawnCreature(CREATURE_PHOENIX, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); 477 m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 478 }else HatchTimer -= diff; 611 Creature *bird = DoSpawnCreature(CREATURE_PHOENIX, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 60000); 612 if (bird) 613 { 614 Unit *boss = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL)); 615 if (boss && boss->getVictim()) 616 { 617 bird->AddThreat(boss->getVictim(),100); 618 bird->Attack(boss->getVictim(),true); 619 bird->GetMotionMaster()->MoveChase(boss->getVictim()); 620 } 621 } 622 m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 623 }else HatchTimer -= diff; 479 624 } 480 625 }; … … 482 627 struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI 483 628 { 484 mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) {Reset();} 485 629 mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) 630 { 631 pInstance = ((ScriptedInstance*)c->GetInstanceData()); 632 Reset(); 633 } 486 634 uint32 DespawnTimer; 487 635 uint32 ChangeTargetTimer; 488 489 bool TargetLocked; 636 uint32 CheckTimer; 637 638 ScriptedInstance* pInstance; 490 639 491 640 void Reset() 492 641 { 642 m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); 493 643 DespawnTimer = 30000; 494 644 ChangeTargetTimer = 5000; 495 TargetLocked = false; 496 645 CheckTimer = 1000; 646 m_creature->SetSpeed(MOVE_RUN, 0.5f); 647 m_creature->SetSpeed(MOVE_WALK, 0.5f); 497 648 m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 498 649 m_creature->setFaction(14); … … 500 651 } 501 652 502 void MoveInLineOfSight(Unit* who)503 {504 if(TargetLocked)505 return;506 if(who && who->IsHostileTo(m_creature) && (m_creature->IsWithinDistInMap(who, 25)))507 StalkTarget(who);508 }509 510 653 void Aggro(Unit* who) {} 511 654 … … 514 657 if(!target) 515 658 return; 516 517 518 TargetLocked = true;659 m_creature->AddThreat(target,100000); 660 m_creature->GetMotionMaster()->MoveChase(target); 661 m_creature->Attack(target,true); 519 662 } 520 663 … … 526 669 527 670 if(!m_creature->getVictim() || !m_creature->SelectHostilTarget()) 528 return;671 ChangeTargetTimer = 0; 529 672 530 673 if(ChangeTargetTimer < diff) 531 674 { 532 TargetLocked = false; 675 DoResetThreat(); 676 Unit *ntarget = SelectUnit(SELECT_TARGET_RANDOM,0); 677 if (ntarget) 678 StalkTarget(ntarget); 533 679 ChangeTargetTimer = 10000; 534 680 }else ChangeTargetTimer -= diff; 681 682 if(CheckTimer < diff) 683 { 684 if (pInstance) 685 { 686 Creature *boss = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL)); 687 if(boss) 688 { 689 if(!((boss_felblood_kaelthasAI*)boss->AI())->Phase || boss->isDead()) 690 DespawnTimer = 0; 691 }else DespawnTimer = 0; 692 } 693 CheckTimer = 1000; 694 }else CheckTimer -= diff; 535 695 } 536 696 }; 697 698 bool GOHello_go_kael_orb(Player *player, GameObject* _GO) 699 { 700 ScriptedInstance* pInst = (ScriptedInstance*)_GO->GetInstanceData(); 701 if (pInst && player) 702 { 703 Unit *kael = Unit::GetUnit((*_GO),pInst->GetData64(DATA_KAEL)); 704 if (kael && kael->isDead()) 705 player->TeleportTo(530, 12888, -6876, 9, 0.3); 706 } 707 return true; 708 } 709 710 bool GOHello_go_movie_orb(Player *player, GameObject* _GO) 711 { 712 if (player) 713 { 714 WorldPacket data(SMSG_TRIGGER_CINEMATIC, 4); 715 data << (uint32)164; 716 player->GetSession()->SendPacket(&data); 717 718 if (player->GetQuestStatus(11490) == QUEST_STATUS_INCOMPLETE) 719 { 720 Unit *qUnit = player->SummonCreature(25042,player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()-10,0,TEMPSUMMON_CORPSE_DESPAWN,0); 721 if(qUnit) 722 player->DealDamage(qUnit, qUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 723 } 724 } 725 return true; 726 } 537 727 538 728 CreatureAI* GetAI_boss_felblood_kaelthas(Creature* c) … … 589 779 newscript->GetAI = GetAI_mob_felkael_flamestrike; 590 780 m_scripts[nrscripts++] = newscript; 781 782 newscript = new Script; 783 newscript->Name="go_kael_orb"; 784 newscript->pGOHello = &GOHello_go_kael_orb; 785 m_scripts[nrscripts++] = newscript; 786 787 newscript = new Script; 788 newscript->Name="go_movie_orb"; 789 newscript->pGOHello = &GOHello_go_movie_orb; 790 m_scripts[nrscripts++] = newscript; 591 791 } -
trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
r90 r137 7 7 * This program is distributed in the hope that it will be useful, 8 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 10 * GNU General Public License for more details. 11 11 * 12 12 * You should have received a copy of the GNU General Public License 13 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 15 */ 16 16 … … 103 103 pInstance = ((ScriptedInstance*)c->GetInstanceData()); 104 104 Adds.clear(); 105 Reset();106 SummonAdds();105 //SummonAdds(); 106 Reset(); 107 107 Heroic = c->GetMap()->IsHeroic(); 108 108 } … … 127 127 void Reset() 128 128 { 129 m_creature->SetCorpseDelay(60*60*1000); 129 130 LackeysKilled = 0; 130 131 PlayersKilled = 0; … … 140 141 CheckAdds(); 141 142 142 if(pInstance) 143 { 144 pInstance->SetData(DATA_DELRISSA_EVENT, NOT_STARTED); 145 pInstance->SetData(DATA_DELRISSA_DEATH_COUNT, 0); 146 } 143 if(pInstance) 144 { 145 pInstance->SetData(DATA_DELRISSA_DEATH_COUNT, 0); 146 if (m_creature->isDead()) 147 pInstance->SetData(DATA_DELRISSA_EVENT, DONE); 148 else pInstance->SetData(DATA_DELRISSA_EVENT, NOT_STARTED); 149 } 147 150 else error_log(ERROR_INST_DATA); 148 151 } … … 160 163 void SummonAdds() 161 164 { 165 /*if (m_creature->isDead()) 166 return;*/ 162 167 std::vector<uint32> AddList; 163 168 for(uint8 i = 0; i < 8; ++i) … … 180 185 void CheckAdds() 181 186 { 187 //if (m_creature->isDead()) 188 // return; 182 189 if(Adds.empty()) 183 return; 184 190 { 191 SummonAdds(); 192 return; 193 } 185 194 for(uint8 i = 0; i < Adds.size(); ++i) 186 195 { 187 bool resummon = true;188 196 Creature* pAdd = ((Creature*)Unit::GetUnit(*m_creature, Adds[i]->guid)); 189 197 if(pAdd && pAdd->isAlive()) 190 198 { 191 pAdd->AI()->EnterEvadeMode(); // Force them out of combat and reset if they are in combat. 192 resummon = false; 193 } 194 if(resummon) 195 { 196 pAdd = m_creature->SummonCreature(Adds[i]->entry, LackeyLocations[i][0], LackeyLocations[i][1], POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0); 197 Add* nAdd = new Add(Adds[i]->entry, pAdd->GetGUID()); 198 Adds.erase(Adds.begin() + i); 199 Adds.push_back(nAdd); 200 } 199 pAdd->AI()->EnterEvadeMode(); 200 pAdd->GetMotionMaster()->MovePoint(0,LackeyLocations[i][0], LackeyLocations[i][1], POS_Z); 201 } 202 if(!pAdd || (pAdd && pAdd->isDead())) 203 { 204 if(pAdd) 205 pAdd->RemoveCorpse();//looks stupid if mob is alive but has a dead corpse in front of him :) 206 Creature* pAdd = m_creature->SummonCreature(Adds[i]->entry, LackeyLocations[i][0], LackeyLocations[i][1], POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0); 207 if(pAdd) 208 Adds[i]->guid = pAdd->GetGUID(); 209 } 201 210 } 202 211 } … … 204 213 void KilledUnit(Unit* victim) 205 214 { 206 if(victim->GetTypeId() != TYPEID_PLAYER)215 if(victim->GetTypeId() != TYPEID_PLAYER || m_creature->isDead()) 207 216 return; 208 217 … … 215 224 void KilledLackey() 216 225 { 226 if(m_creature->isDead())//no sense to talk if dead.. 227 return; 217 228 DoYell(LackeyDeath[LackeysKilled].text, LANG_UNIVERSAL, NULL); 218 229 DoPlaySoundToSet(m_creature, LackeyDeath[LackeysKilled].sound); 219 230 if( LackeysKilled < 3 ) 220 231 ++LackeysKilled; 232 233 CheckLootable(); 221 234 } 222 235 … … 242 255 void CheckLootable() 243 256 { 244 if( LackeysKilled >4)257 if(pInstance && pInstance->GetData(DATA_DELRISSA_DEATH_COUNT) >= 4) 245 258 m_creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); 246 259 else … … 367 380 { 368 381 UsedPotion = false; 369 382 if(pInstance) 383 { 384 Creature *boss = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA))); 385 if (boss && boss->isDead()) 386 boss->Respawn(); 387 } 370 388 ResetThreatTimer = 5000 + rand()%15000; // These guys like to switch targets often, and are not meant to be tanked. 371 389 } … … 638 656 }else Fear_Timer -= diff; 639 657 640 DoMeleeAttackIfReady(); 658 if (m_creature->GetDistance(m_creature->getVictim()) <= 10) 659 m_creature->StopMoving(); 660 //DoMeleeAttackIfReady();//should not melee, she's a warlock 641 661 } 642 662 }; … … 741 761 return; 742 762 743 boss_priestess_guestAI::UpdateAI(diff); 763 boss_priestess_guestAI::UpdateAI(diff); 744 764 745 765 if(Polymorph_Timer < diff) … … 793 813 //if in melee range 794 814 if (target->IsWithinDistInMap(m_creature, 5)) 795 796 797 798 815 { 816 InMeleeRange = true; 817 break; 818 } 799 819 } 800 820 //if anybody is in melee range than escape by blink 801 821 if(InMeleeRange) 802 DoCast(m_creature, SPELL_BLINK); 803 822 { 823 //DoCast(m_creature, SPELL_BLINK); //blink does not work on npcs 824 float x,y,z; 825 m_creature->GetPosition(x,y,z); 826 x = rand()%2 ? x+10+rand()%10 : x-10-rand()%10; 827 y = rand()%2 ? y+10+rand()%10 : y-10-rand()%10; 828 m_creature->Relocate(x,y,z); 829 m_creature->SendMonsterMove(x, y, m_creature->GetPositionZ(), 0,0,0); 830 } 804 831 Blink_Timer = 8000; 805 832 }else Blink_Timer -= diff; 806 833 807 DoMeleeAttackIfReady(); 834 if (m_creature->GetDistance(m_creature->getVictim()) <= 10) 835 m_creature->StopMoving(); 836 837 //DoMeleeAttackIfReady(); //mage type, no melee needed 808 838 } 809 839 }; … … 949 979 uint32 Wing_Clip_Timer; 950 980 uint32 Freezing_Trap_Timer; 981 uint32 StopMoving; 982 bool Stopped; 951 983 952 984 void Reset() … … 961 993 Wing_Clip_Timer = 4000; 962 994 Freezing_Trap_Timer = 15000; 995 StopMoving = 2000; 996 Stopped = false; 963 997 964 998 boss_priestess_guestAI::Reset(); … … 1031 1065 }else Shoot_Timer -= diff; 1032 1066 } 1067 if(StopMoving < diff) 1068 { 1069 if(Stopped) 1070 Stopped = false; 1071 else 1072 Stopped = true; 1073 StopMoving = 2000+rand()%5000; 1074 }else StopMoving -= diff; 1075 if (Stopped) 1076 m_creature->StopMoving(); 1033 1077 } 1034 1078 }; … … 1179 1223 1180 1224 if(Goblin_Dragon_Gun_Timer < diff) 1181 { 1182 DoCast(m_creature->getVictim(), SPELL_GOBLIN_DRAGON_GUN); 1183 Goblin_Dragon_Gun_Timer = 10000; 1225 { 1226 if (m_creature->GetDistance(m_creature->getVictim()) <= 5) 1227 { 1228 Goblin_Dragon_Gun_Timer = 10000; 1229 DoCast(m_creature->getVictim(), SPELL_GOBLIN_DRAGON_GUN); 1230 }else Goblin_Dragon_Gun_Timer = 2000; 1184 1231 }else Goblin_Dragon_Gun_Timer -= diff; 1185 1232 -
trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp
r105 r137 90 90 uint32 FelExplosionTimer; 91 91 uint32 DrainCrystalTimer; 92 uint32 EmpowerTimer;92 uint32 CheckTimer; 93 93 94 94 bool IsDraining; … … 109 109 { 110 110 if(!pUnit->isAlive()) 111 ((Creature*)pUnit)->Respawn(); // Let TrinItyhandle setting death state, etc.111 ((Creature*)pUnit)->Respawn(); // Let MaNGOS handle setting death state, etc. 112 112 113 113 // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. … … 115 115 } 116 116 } 117 118 117 GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR)); 119 118 if( Door ) … … 121 120 // Small door opened after event are expected to be closed by default 122 121 // Set Inst data for encounter 123 pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); 122 if (m_creature->isDead()) 123 pInstance->SetData(DATA_SELIN_EVENT, DONE); 124 else pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); 124 125 }else error_log(ERROR_INST_DATA); 125 126 126 127 DrainLifeTimer = 3000 + rand()%4000; 127 128 DrainManaTimer = DrainLifeTimer + 5000; … … 129 130 DrainCrystalTimer = 10000 + rand()%5000; 130 131 DrainCrystalTimer = 20000 + rand()%5000; 131 EmpowerTimer = 10000;132 CheckTimer = 1000; 132 133 133 134 IsDraining = false; … … 194 195 void Aggro(Unit* who) 195 196 { 197 m_creature->SetPower(POWER_MANA, 0); 196 198 DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL); 197 199 DoPlaySoundToSet(m_creature, SOUND_AGGRO); … … 263 265 ContinueDoor->SetGoState(0); // Open the door leading further in 264 266 265 ShatterRemainingCrystals();266 267 } 267 268 … … 287 288 if( DrainManaTimer < diff ) 288 289 { 289 Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); 290 if( target->getPowerType() == POWER_MANA) 291 { 292 DoCast(target, SPELL_DRAIN_MANA); 293 DrainManaTimer = 10000; 294 } 290 DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_MANA); 291 DrainManaTimer = 10000; 295 292 }else DrainManaTimer -= diff; 296 293 } … … 322 319 if( IsDraining ) 323 320 { 324 if( EmpowerTimer < diff ) 325 { 326 IsDraining = false; 327 DrainingCrystal = false; 328 329 DoYell(SAY_EMPOWERED, LANG_UNIVERSAL, NULL); 330 DoPlaySoundToSet(m_creature, SOUND_EMPOWERED); 331 332 Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); 333 if( CrystalChosen && CrystalChosen->isAlive() ) 334 // Use Deal Damage to kill it, not setDeathState. 335 CrystalChosen->DealDamage(CrystalChosen, CrystalChosen->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 336 337 CrystalGUID = 0; 338 339 m_creature->GetMotionMaster()->Clear(); 340 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); 341 }else EmpowerTimer -= diff; 342 } 343 } 344 321 if (CheckTimer < diff) 322 { 323 Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); 324 if(CrystalChosen) 325 { 326 if(CrystalChosen->GetUInt32Value(UNIT_CHANNEL_SPELL) == SPELL_MANA_RAGE) 327 { 328 m_creature->StopMoving(); 329 }else{ 330 IsDraining = false; 331 DrainingCrystal = false; 332 333 DoYell(SAY_EMPOWERED, LANG_UNIVERSAL, NULL); 334 DoPlaySoundToSet(m_creature, SOUND_EMPOWERED); 335 336 Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); 337 if( CrystalChosen && CrystalChosen->isAlive() ) 338 // Use Deal Damage to kill it, not setDeathState. 339 CrystalChosen->DealDamage(CrystalChosen, CrystalChosen->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 340 CrystalGUID = 0; 341 342 m_creature->GetMotionMaster()->Clear(); 343 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); 344 } 345 } 346 CheckTimer = 1000; 347 }else CheckTimer -= diff; 348 } 349 } 345 350 DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. 346 351 } … … 364 369 void JustDied(Unit* killer) 365 370 { 371 m_creature->RemoveAurasDueToSpell(SPELL_MANA_RAGE); 366 372 if(ScriptedInstance* pInstance = ((ScriptedInstance*)m_creature->GetInstanceData())) 367 373 { … … 371 377 if(((boss_selin_fireheartAI*)Selin->AI())->CrystalGUID == m_creature->GetGUID()) 372 378 { 373 Selin->RemoveAurasDueToSpell(SPELL_MANA_RAGE);379 // Set this to false if we are the creature that Selin is draining so his AI flows properly 374 380 ((boss_selin_fireheartAI*)Selin->AI())->DrainingCrystal = false; 375 381 ((boss_selin_fireheartAI*)Selin->AI())->IsDraining = false; 376 ((boss_selin_fireheartAI*)Selin->AI())->EmpowerTimer = 10000;382 Selin->RemoveAurasDueToSpell(SPELL_MANA_RAGE); 377 383 if(Selin->getVictim()) 378 384 { -
trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp
r90 r137 48 48 #define SPELL_OVERLOAD 44353 49 49 #define SPELL_ARCANE_SHOCK 44319 50 #define ASTRAL_FLARE_VISUAL 30237 50 51 51 52 //Creatures … … 82 83 83 84 if(pInstance) 84 pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); 85 { 86 if (m_creature->isDead()) 87 pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); 88 else pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); 89 } 85 90 } 86 91 … … 131 136 DoPlaySoundToSet(m_creature, SOUND_ENERGY); 132 137 Creature* PureEnergyCreature = NULL; 133 PureEnergyCreature = DoSpawnCreature(CREATURE_PURE_ENERGY, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);138 PureEnergyCreature = DoSpawnCreature(CREATURE_PURE_ENERGY, 10, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); 134 139 Unit* target = NULL; 135 140 target = SelectUnit(SELECT_TARGET_RANDOM, 0); … … 139 144 if(Heroic) // *Heroic mode only - he summons two instead of one. 140 145 { 141 PureEnergyCreature = DoSpawnCreature(CREATURE_PURE_ENERGY, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);146 PureEnergyCreature = DoSpawnCreature(CREATURE_PURE_ENERGY, -10, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); 142 147 target = SelectUnit(SELECT_TARGET_RANDOM, 0); 143 148 if (PureEnergyCreature && target) … … 187 192 188 193 uint32 EnergyBoltTimer; 194 uint32 VisualTimer; 189 195 190 196 void Reset() 191 197 { 192 198 EnergyBoltTimer = 1700; 199 VisualTimer = 1000; 200 m_creature->SetSpeed(MOVE_RUN, 0.5f); 201 m_creature->SetSpeed(MOVE_WALK, 0.5f); 193 202 } 194 203 … … 210 219 EnergyBoltTimer = 1700; 211 220 }else EnergyBoltTimer -= diff; 221 if(VisualTimer < diff) 222 { 223 DoCast(m_creature->getVictim(), ASTRAL_FLARE_VISUAL, true); 224 VisualTimer = 1000; 225 }else VisualTimer -= diff; 212 226 } 213 227 }; -
trunk/src/bindings/scripts/scripts/zone/magisters_terrace/def_magisters_terrace.h
r90 r137 26 26 #define DATA_DELRISSA_DEATH_COUNT 15 27 27 28 #define DATA_KAEL 16 29 28 30 #define ERROR_INST_DATA "SD2 Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy." 29 31 #endif -
trunk/src/bindings/scripts/scripts/zone/magisters_terrace/instance_magisters_terrace.cpp
r90 r137 41 41 } 42 42 43 uint32 DoorState[3];//0seline, 1vexallus, 2derlissa 43 44 uint32 Encounters[NUMBER_OF_ENCOUNTERS]; 44 45 uint32 DelrissaDeathCount; … … 47 48 std::list<uint64>::iterator CrystalItr; 48 49 50 uint64 KaelGUID; 49 51 uint64 SelinGUID; 50 52 uint64 DelrissaGUID; … … 59 61 void Initialize() 60 62 { 63 for(uint8 i = 0; i < 3; i++) 64 DoorState[i] = 1;//1 closed, 0 opened 65 61 66 for(uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; i++) 62 67 Encounters[i] = NOT_STARTED; … … 66 71 DelrissaDeathCount = 0; 67 72 73 KaelGUID = 0; 68 74 SelinGUID = 0; 69 75 DelrissaGUID = 0; … … 104 110 switch(identifier) 105 111 { 106 case DATA_SELIN_EVENT: Encounters[0] = data; break; 107 case DATA_VEXALLUS_EVENT: Encounters[1] = data; break; 108 case DATA_DELRISSA_EVENT: Encounters[2] = data; break; 112 case DATA_SELIN_EVENT: 113 Encounters[0] = data; 114 if(data==DONE) 115 { 116 DoorState[0] = 0; 117 SaveToDB(); 118 } 119 break; 120 case DATA_VEXALLUS_EVENT: 121 Encounters[1] = data; 122 if(data==DONE) 123 { 124 DoorState[1] = 0; 125 SaveToDB(); 126 } 127 break; 128 case DATA_DELRISSA_EVENT: 129 Encounters[2] = data; 130 if(data==DONE) 131 { 132 DoorState[2] = 0; 133 SaveToDB(); 134 } 135 break; 109 136 case DATA_KAELTHAS_EVENT: Encounters[3] = data; break; 110 137 … … 115 142 } 116 143 144 const char* Save() 145 { 146 std::ostringstream ss; 147 ss << "S " << DoorState[0] << " " << DoorState[1] << " " << DoorState[2]; 148 char* data = new char[ss.str().length()+1]; 149 strcpy(data, ss.str().c_str()); 150 return data; 151 } 152 153 void Load(const char* load) 154 { 155 if(!load) return; 156 std::istringstream ss(load); 157 char dataHead; // S 158 uint32 data1, data2, data3; 159 ss >> dataHead >> data1 >> data2 >> data3; 160 if(dataHead == 'S') 161 { 162 DoorState[0] = data1; 163 DoorState[1] = data2; 164 DoorState[2] = data3; 165 }else error_log("SD2: Magister's Terrace: corrupted save data."); 166 } 167 117 168 void OnCreatureCreate(Creature *creature, uint32 entry) 118 169 { … … 122 173 case 24560: DelrissaGUID = creature->GetGUID(); break; 123 174 case 24722: FelCrystals.push_back(creature->GetGUID()); break; 175 case 24664: KaelGUID = creature->GetGUID(); break; 124 176 } 125 177 } … … 129 181 switch(go->GetEntry()) 130 182 { 131 case 187896: VexallusDoorGUID = go->GetGUID(); break; 183 case 187896: 184 VexallusDoorGUID = go->GetGUID(); 185 go->SetGoState(DoorState[1]); 186 break; 132 187 //SunwellRaid Gate 02 133 case 187979: SelinDoorGUID = go->GetGUID(); break; 188 case 187979: 189 SelinDoorGUID = go->GetGUID(); 190 go->SetGoState(DoorState[0]); 191 break; 134 192 //Assembly Chamber Door 135 193 case 188065: SelinEncounterDoorGUID = go->GetGUID(); break; 136 case 187770: DelrissaDoorGUID = go->GetGUID(); break; 194 case 187770: 195 DelrissaDoorGUID = go->GetGUID(); 196 go->SetGoState(DoorState[2]); 197 break; 137 198 case 188165: KaelStatue[0] = go->GetGUID(); break; 138 199 case 188166: KaelStatue[1] = go->GetGUID(); break; … … 145 206 { 146 207 case DATA_SELIN: return SelinGUID; 208 case DATA_KAEL: return KaelGUID; 147 209 case DATA_DELRISSA: return DelrissaGUID; 148 210 case DATA_VEXALLUS_DOOR: return VexallusDoorGUID;