All pastes #899988 Raw Edit

leo4

public diff v1 · immutable
·published 2008-02-11 16:11 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)@@ -217,9 +260,9 @@         if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )             return; -        if(!DemonForm)-        {-            //Whirlwind_Timer+   if(!DemonForm)+        {      +		//Whirlwind_Timer             if(Whirlwind_Timer < diff)             {                 DoCast(m_creature, SPELL_WHIRLWIND);@@ -230,19 +273,41 @@             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+					wipe_aggro();                     Switch_Timer = 60000;                 }else Switch_Timer -= diff; +			if(Die_Timer < diff)+        {+	        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;+             DoMeleeAttackIfReady();         }         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,8 @@                 //switch to nightelf form                 m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF);                 DemonForm = false;+				//wipe aggro+				wipe_aggro();                  Switch_Timer = 45000;             }else Switch_Timer -= diff;@@ -282,10 +349,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 +365,11 @@     }      uint32 ChaosBlast_Timer;-     bool InCombat;      void EnterEvadeMode()     {         ChaosBlast_Timer = 1000;-         InCombat = false;          m_creature->RemoveAllAuras();@@ -317,7 +385,7 @@          InCombat = true;     }-+	     void KilledUnit(Unit *victim)     {         if(victim->GetTypeId() != TYPEID_PLAYER)@@ -391,7 +459,7 @@             return;          //ChaosBlast_Timer-        if(ChaosBlast_Timer < diff)+	    if(ChaosBlast_Timer < diff)         {             DoCast(m_creature->getVictim(), SPELL_CHAOS_BLAST);             ChaosBlast_Timer = 1500;@@ -400,7 +468,79 @@         //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()+    {       +        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);+        }+    }++   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);++                DoStartMeleeAttack(who);+            }+        }+    }+ +    void UpdateAI (const uint32 diff)+    {+        +        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 +549,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 +565,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;+	+ }