All pastes #916416 Raw Edit

Stuff

public text v1 · immutable
#916416 ·published 2008-02-24 16:50 UTC
rendered paste body
Index: boss_leotheras_the_blind.cpp
===================================================================
--- boss_leotheras_the_blind.cpp	(revision 252)
+++ boss_leotheras_the_blind.cpp	(working copy)
@@ -1,27 +1,11 @@
-/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+/**
+*Copyright by BloodWorld DevTeam ® 2008
+made by: aNakin, Bucu, Pandora
+**/
 
-/* ScriptData
-SDName: Boss_Leotheras_The_Blind
-SD%Complete: 50
-SDComment: Missing Inner Demons
-EndScriptData */
-
 #include "../../../sc_defines.h"
-
+#define SPELL_EN				33653
+#define SPELL_BOLT				39025
 #define SPELL_WHIRLWIND         40653
 #define SPELL_CHAOS_BLAST       37675
 // #define SPELL_INSIDIOUS_WHISPER 37676 // useless - dummy effect that can't be implemented
@@ -72,10 +56,17 @@
     uint32 Whirlwind_Timer;
     uint32 ChaosBlast_Timer;
     uint32 Switch_Timer;
+	uint32 Inner_Timer;
+	uint32 Die_Timer;
 
     bool DemonForm;
     bool IsFinalForm;
     bool InCombat;
+	bool demons;
+	int Rand;
+    int RandX;
+    int RandY;
+    Creature* Summoned;
 
     uint64 Demon;
 
@@ -84,7 +75,10 @@
         Whirlwind_Timer = 20000;
         ChaosBlast_Timer = 1000;
         Switch_Timer = 45000;
+		Inner_Timer = 15000;
+		Die_Timer = 600000;
 
+		demons=false;
         DemonForm = false;
         IsFinalForm = false;
         InCombat = false;
@@ -174,7 +168,56 @@
         if(pInstance)
             pInstance->SetData("LeotherasTheBlindEvent", 0);
     }
+	
+	    void SummonInner(Unit* victim)
+    {
 
+        Rand = rand()%10;
+        switch (rand()%2)
+        {
+        case 0: RandX = 0 - Rand; break;
+        case 1: RandX = 0 + Rand; break;
+        }
+        Rand = 0;
+        Rand = rand()%10;
+        switch (rand()%2)
+        {
+        case 0: RandY = 0 - Rand; break;
+        case 1: RandY = 0 + Rand; break;
+        }
+        Rand = 0;
+        Summoned = DoSpawnCreature(21857, RandX+15, RandY+15, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
+		 if(Summoned)
+			 Summoned->CastSpell(Summoned,37713,false);//rzuca na inner demona buffe (niby powinien juz ja miec z bazy ale niema)
+		Summoned = DoSpawnCreature(21857, RandX-15, RandY+15, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
+		if(Summoned)
+			 Summoned->CastSpell(Summoned,37713,false);
+		Summoned = DoSpawnCreature(21857, RandX-15, RandY-15, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
+		if(Summoned)
+			 Summoned->CastSpell(Summoned,37713,false);
+		Summoned = DoSpawnCreature(21857, RandX+10, RandY-10, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
+		if(Summoned)
+			 Summoned->CastSpell(Summoned,37713,false);
+		Summoned = DoSpawnCreature(21857, RandX-20, RandY+20, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
+		if(Summoned)
+			 Summoned->CastSpell(Summoned,37713,false);
+		Summoned = DoSpawnCreature(21857, RandX-20, RandY-20, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
+		if(Summoned)
+			 Summoned->CastSpell(Summoned,37713,false);
+       
+    }
+void wipe_aggro()
+{
+			Unit *target;
+            std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
+            std::vector<Unit *> target_list;
+            for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+            {
+                target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
+				 m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-100);
+                target = NULL;
+            }
+}
     void AttackStart(Unit *who)
     {
         if(!who && who != m_creature)
@@ -216,10 +259,17 @@
         //Return since we have no target
         if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
             return;
-
-        if(!DemonForm)
+	if(Die_Timer < diff)
         {
-            //Whirlwind_Timer
+	        const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
+			DoCast(m_creature, SPELL_EN);
+			m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 10000)));
+            m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 10000)));
+            Die_Timer = 90000;
+        }else Die_Timer -= diff;
+   if(!DemonForm)
+        {      
+		//Whirlwind_Timer
             if(Whirlwind_Timer < diff)
             {
                 DoCast(m_creature, SPELL_WHIRLWIND);
@@ -230,12 +280,16 @@
             if(!IsFinalForm)
                 if(Switch_Timer < diff)
                 {
+					demons=false; 
                     //switch to demon form
                     m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_DEMON);
                     DoYell(SAY_SWITCH_TO_DEMON, LANG_UNIVERSAL, NULL);
                     DoPlaySoundToSet(m_creature, SOUND_SWITCH_TO_DEMON);
                     DemonForm = true;
-
+					//wipe aggro
+						 if(pInstance)
+            pInstance->SetData("LeotherasTheBlindEvent_model", 1);
+					wipe_aggro();
                     Switch_Timer = 60000;
                 }else Switch_Timer -= diff;
 
@@ -243,6 +297,17 @@
         }
         else
         {
+			if (!demons){//tylko raz na demon forme
+				if(!IsFinalForm){ //i nie w ostatniej fazie
+			if (Inner_Timer < diff) //summon tylko w demonie!
+        {
+            //Cast
+            demons=true; //reset jest w zmianie formy elf->demon
+			SummonInner(m_creature->getVictim());
+            Inner_Timer = 15000; //15 sec od zaczecia fazy demona
+        }else Inner_Timer -= diff;
+				}
+			}
             //ChaosBlast_Timer
             if(ChaosBlast_Timer < diff)
             {
@@ -256,6 +321,10 @@
                 //switch to nightelf form
                 m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF);
                 DemonForm = false;
+				//wipe aggro
+				wipe_aggro();
+				 if(pInstance)
+            pInstance->SetData("LeotherasTheBlindEvent_model", 0);
 
                 Switch_Timer = 45000;
             }else Switch_Timer -= diff;
@@ -282,10 +351,13 @@
 
             m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF);
         }
+
     }
 };
 
 //Leotheras the Blind Demon Form AI
+//uzyte tylko w 3 fazie
+//wiec nie summonuje
 struct MANGOS_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI
 {
     boss_leotheras_the_blind_demonformAI(Creature *c) : ScriptedAI(c)
@@ -295,13 +367,11 @@
     }
 
     uint32 ChaosBlast_Timer;
-
     bool InCombat;
 
     void EnterEvadeMode()
     {
         ChaosBlast_Timer = 1000;
-
         InCombat = false;
 
         m_creature->RemoveAllAuras();
@@ -317,7 +387,7 @@
 
         InCombat = true;
     }
-
+	
     void KilledUnit(Unit *victim)
     {
         if(victim->GetTypeId() != TYPEID_PLAYER)
@@ -391,7 +461,7 @@
             return;
 
         //ChaosBlast_Timer
-        if(ChaosBlast_Timer < diff)
+	    if(ChaosBlast_Timer < diff)
         {
             DoCast(m_creature->getVictim(), SPELL_CHAOS_BLAST);
             ChaosBlast_Timer = 1500;
@@ -400,7 +470,117 @@
         //Do NOT deal any melee damage to the target.
     }
 };
+struct MANGOS_DLL_DECL mob_inner_demonAI : public ScriptedAI
+{
+    mob_inner_demonAI(Creature *c) : ScriptedAI(c)
+    {
+        pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;
+        EnterEvadeMode();
+    }
 
+    ScriptedInstance *pInstance;
+     
+    uint32 Bolt_Timer;
+    
+ 
+    void EnterEvadeMode()
+    {      
+		if (m_creature){
+        Bolt_Timer = 5000;
+        m_creature->RemoveAllAuras();
+        m_creature->DeleteThreatList();
+       m_creature->CombatStop();
+        DoGoHome();
+
+		m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISARM, true);
+		}
+    }
+
+    void AttackStart(Unit *who)
+	{
+        if(!who && who != m_creature)
+           return;
+
+        if (who->isTargetableForAttack() && who!= m_creature)
+        {
+            DoStartMeleeAttack(who);
+			m_creature->getThreatManager().addThreat(who,100000);//zeby demon niezmianial celu
+        }
+    }
+
+	void DamageTaken(Unit *killer, uint32 &damage)
+{
+	if (!m_creature)
+		return;
+	if (!killer)
+		return;
+	if (!m_creature->getVictim())
+		return;
+	if ((killer->GetGUID()!=m_creature->getVictim()->GetGUID())&&(killer->GetGUID()!=m_creature->GetGUID()))
+damage=0;
+	}
+
+   void MoveInLineOfSight(Unit *who)
+    {
+       if (!who || m_creature->getVictim())
+            return;
+
+        if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
+        {
+            float attackRadius = m_creature->GetAttackDistance(who);
+            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who))
+            {
+                if(who->HasStealthAura())
+                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
+				m_creature->getThreatManager().addThreat(who,100000);//zeby demon niezmianial celu
+                DoStartMeleeAttack(who);
+            }
+        }
+    }
+ 
+    void KilledUnit(Unit *victim)
+   {
+  m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);
+   }
+
+    void UpdateAI (const uint32 diff)
+    {
+
+        if (!m_creature)
+			return;
+		//tu spr czy slepy jest w demonie, jezeli nie to mind control (albo stun bo mc niedziała)
+		bool model=false;
+		if(pInstance)
+            model=pInstance->GetData("LeotherasTheBlindEvent_model");
+		if (!model)
+		{
+			//jezeli nie jest demonem...
+			if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
+			{
+				m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);
+			}
+			else
+			{
+			m_creature->getVictim()->CastSpell(m_creature->getVictim(),3618,false);//stun na 5 min bo niema mc
+			m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);
+			}
+		}
+        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
+			return;
+		if(Bolt_Timer < diff)
+        {
+            Unit *target = NULL;
+            target = SelectUnit(SELECT_TARGET_RANDOM, 0);
+            if(target)
+                DoCast(target, SPELL_BOLT);
+
+            Bolt_Timer = 5000;
+        }else Bolt_Timer -= diff;
+
+        DoMeleeAttackIfReady();
+    }
+};
+
 CreatureAI* GetAI_boss_leotheras_the_blind(Creature *_Creature)
 {
     return new boss_leotheras_the_blindAI (_Creature);
@@ -409,7 +589,10 @@
 {
     return new boss_leotheras_the_blind_demonformAI (_Creature);
 }
-
+CreatureAI* GetAI_mob_inner_demonAI(Creature *_Creature)
+{
+    return new mob_inner_demonAI (_Creature);
+}
 void AddSC_boss_leotheras_the_blind()
 {
     Script *newscript;
@@ -422,4 +605,10 @@
     newscript->Name="boss_leotheras_the_blind_demonform";
     newscript->GetAI = GetAI_boss_leotheras_the_blind_demonform;
     m_scripts[nrscripts++] = newscript;
+	newscript = new Script;
+    newscript->Name="mob_inner_demon";
+    newscript->GetAI = GetAI_mob_inner_demonAI;
+    m_scripts[nrscripts++] = newscript;
+	
+
 }
Index: instance_serpent_shrine.cpp
===================================================================
--- instance_serpent_shrine.cpp	(revision 252)
+++ instance_serpent_shrine.cpp	(working copy)
@@ -43,7 +43,7 @@
     uint64 LadyVashj;
     uint64 Karathress;
     uint64 KarathressEvent_Starter;
-
+bool model;
     bool ShieldGeneratorDeactivated[4];
 
     bool Encounters[ENCOUNTERS];
@@ -56,7 +56,7 @@
         LadyVashj = 0;
         Karathress = 0;
         KarathressEvent_Starter = 0;
-
+model=0;
         ShieldGeneratorDeactivated[0] = false;
         ShieldGeneratorDeactivated[1] = false;
         ShieldGeneratorDeactivated[2] = false;
@@ -130,6 +130,8 @@
             Encounters[0] = (data) ? true : false;
         else if(type == "LeotherasTheBlindEvent")
             Encounters[1] = (data) ? true : false;
+		else if(type == "LeotherasTheBlindEvent_model")
+            model = (data) ? true : false;
         else if(type == "TheLurkerBelowEvent")
             Encounters[2] = (data) ? true : false;
         else if(type == "KarathressEvent")
@@ -165,6 +167,8 @@
             return Encounters[0];
         else if (type == "LeotherasTheBlindEvent")
             return Encounters[1];
+		else if(type == "LeotherasTheBlindEvent_model")
+           return model;
         else if(type == "TheLurkerBelowEvent")
             return Encounters[2];
         else if(type == "KarathressEvent")