Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Diff by Hundekuchen ( 16 years ago )
/* Copyright © 2006 - 2010 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
*/
/* ScriptData
SDName: Boss_Nightbane
SD%Complete: 0
SDComment: TODO: Fliegender Angriff
SDCategory: Karazhan
EndScriptData
http://www.youtube.com/watch?v=IyZ_dmyYCsY
http://www.youtube.com/watch?v=5aTM1ZnqWoU
http://www.youtube.com/watch?v=QT0kXTGFLpg&feature=player_embedded
http://www.youtube.com/watch?v=eDnUdHXMWNU&feature=player_embedded
*/
#include "precompiled.h"
#include "karazhan.h"
#include "spell.h"
struct Location
{
int32 id;
double x, y, z;
};
Location IntroWay[17] =
{
{ 0, -11014.2, -1777.98, 176.81}, //<--- warten 1
{ 1, -11033.9, -1801.93, 155.40},
{ 2, -11056.3, -1826.55, 136.50},
{ 3, -11084.4, -1850.25, 120.17},
{ 4, -11106.5, -1863.70, 114.11},
{ 5, -11135.6, -1871.81, 110.13},
{ 6, -11163.3, -1870.07, 105.99},
{ 7, -11189.8, -1858.39, 102.20},
{ 8, -11265.5, -1790.11, 94.74},
{ 9, -11273.1, -1765.94, 90.95},
{10, -11264.3, -1753.19, 88.20},
{11, -11246.4, -1751.34, 85.09},
{12, -11228.1, -1769.85, 83.61},
{13, -11206.2, -1792.22, 88.35},
{14, -11154.6, -1848.36, 116.03}, // <--- warten 2
{15, -11139.6, -1891.09, 113.13}, // <--- oben
{16, -11139.6, -1891.09, 91.47}
};
// Flyingphase (3times at 75%, 50%, 25%)
Location FlightTo[6] =
{
{0, -11112.2, -1882.95, 100.281},
{1, -11087.1, -1882.63, 101.171},
{2, -11075.2, -1871.92, 100.935},
{3, -11083.3, -1849.86, 105.001},
{4, -11107.7, -1842.45, 106.301},
{5, -11152.2, -1855.35, 112.107}
};
Location FlightBack[7] =
{
{0, -11128.2, -1838.53, 109.041},
{1, -11094.2, -1837.04, 112.1},
{2, -11062.1, -1848.84, 110.887},
{3, -11062.3, -1874.98, 109.181},
{4, -11096.5, -1882.84, 106.048},
{5, -11079. -1878, 106.604},
{6, -11140.3, -1890.89, 91.4732} //wieder gelandet
};
enum SpecialFlightPoints
{
FLYPOINT_INTRO_WAIT1 = 0,
FLYPOINT_INTRO_WAIT2 = 14,
FLYPOINT_INTRO_LAND = 16,
FLYPOINT_FLYING_START = 0,
FLYPOINT_FLYING_ATTACKPOINT = 5
// FLYPOINT_FLYING_LAND = 6
};
enum NightbanePhase
{
PHASE_INTRO = 0, //Ganz am Anfang wenn Nightbane herbeigerufen wird
PHASE_FIGHT = 1, //Wenn Fulgpunkt 16 des Intros abgeflogen wurde bzw Nightbane landet und wenn Nightbane aus seinem Fligendem kampf Zurückgekehrt ist
PHASE_FLYING_TO = 2, //Wenn die Leben unter 30% sind und nicht schon 3x die Phase Flying Fight aufgetreten ist in die Fliegender Kampf Phase wechseln
PHASE_FLYING_BACK = 4, //Fliegt zurück zur Kampfposition
PHASE_FLYING_FIGHT = 5, //Wenn Nightbane auf seiner kampfposition ist bzw Wegpunkt 6 aus FlightPhase erreicht wurde
};
enum
{
// CREATURE_RESTLESS_SKELETON = 17261,
//spells of phase 1
SPELL_CLEAVE = 30131, // Spalten
SPELL_CHARRED_EARTH = 30129, // verbrannte Erde
SPELL_SMOLDERING_BREATH = 30210, // Schwelender Odem
SPELL_DISTRACTING_ASH = 30130, // Ablenkende Asche
SPELL_TAIL_SWEEP = 25653, // Schwanzfeger
SPELL_BELLOWING_ROAR = 39427, // Dröhnendes Gebrüll
//phase 2
SPELL_RAIN_OF_BONES = 37098,
SPELL_SMOKING_BLAST = 37057,
SPELL_FIREBALL_BARRAGE = 30282,
//SPELL_SEARING_CINDERS = 30127, triggered by Smoking blast
SPELL_SUMMON_SKELETONS = 30170,
EMOTE_SUMMON = -1532120, //An ancient being awakes in the distance...
EMOTE_BREATH = -1532121, //Nightbane takes a deep breath.
YELL_AGGRO = -1532122, //What Fools i shall bring a quick end to your suffering!
YELL_FLY_PHASE = -1532123, //Miserable vermin. I shall exterminate you from the air!
YELL_LAND_PHASE_1 = -1532124, //Let me show you my strength up close!
YELL_LAND_PHASE_2 = -1532125 //I shall land and crush you myself!
};
struct MANGOS_DLL_DECL boss_nightbaneAI : public ScriptedAI
{
boss_nightbaneAI (Creature* pCreature) : ScriptedAI(pCreature)
{
Reset();
ChangePhase(PHASE_INTRO);
}
ScriptedInstance* m_pInstance;
NightbanePhase m_Phase;
bool m_bMoving;
bool m_bIsFlying;
Location m_lNextWaypoint;
uint32 m_uiFlyingFightCount;
uint32 m_uiFlyIntroWaitTimer;
uint32 m_uiBellowingRoarTimer;
uint32 m_uiCharredEarthTimer;
uint32 m_uiSmolderingBreathTimer;
uint32 m_uiTailSweepTimer;
uint32 m_uiCleaveTimer;
uint32 m_uiDistractintAshTimer;
//Ground Phase
void ResetLandPhaseTimers()
{
m_uiCleaveTimer = 10000;
m_uiTailSweepTimer = 15000;
m_uiCharredEarthTimer = urand(5000, 27000);
m_uiSmolderingBreathTimer = urand(10000, 25000);
m_uiBellowingRoarTimer = 30000;
}
void Reset()
{
m_pInstance = (ScriptedInstance*)m_creature->GetInstanceData();
if (m_pInstance)
m_pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED);
m_bIsFlying = false;
m_uiFlyIntroWaitTimer = 0;
m_uiFlyingFightCount = 0;
m_uiDistractintAshTimer = urand(10000, 25000);
}
void DoFlyToLocation(Location pLocation)
{
if (m_bIsFlying == false)
SetNightBaneFlying();
m_bMoving = true;
m_creature->GetMotionMaster()->MovePoint(pLocation.id, pLocation.x, pLocation.y, pLocation.z);
}
void SetNightBaneFlying()
{
if (m_bIsFlying == false)
{
m_creature->HandleEmote(EMOTE_ONESHOT_LIFTOFF);
m_creature->AddSplineFlag(SPLINEFLAG_FLYING);
if(m_Phase == PHASE_INTRO)
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
m_bIsFlying = true;
}
}
void SetNightBaneWalking()
{
if (m_bIsFlying == true)
{
m_creature->HandleEmote(EMOTE_ONESHOT_LAND);
m_creature->RemoveSplineFlag(SPLINEFLAG_FLYING);
m_bIsFlying = false;
}
}
void ChangePhase(NightbanePhase pNightBanePhase)
{
m_creature->GetMotionMaster()->Clear();
switch (pNightBanePhase)
{
// Anflugphase
case PHASE_INTRO:
if (m_pInstance)
m_pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS);
DoScriptText(EMOTE_SUMMON, m_creature);
m_creature->SetSpeedRate(MOVE_FLIGHT, 3.5); //<- Flattert Schneller
m_lNextWaypoint = IntroWay[FLYPOINT_INTRO_WAIT1];
DoFlyToLocation(m_lNextWaypoint);
m_Phase = PHASE_INTRO;
break;
//Wenn Fulgpunkt 16 des Intros abgeflogen wurde bzw Nightbane landet und wenn Nightbane aus seinem Fligendem kampf Zurückgekehrt ist
case PHASE_FIGHT:
if (m_Phase == PHASE_INTRO)
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
DoScriptText(urand(0, 1) ? YELL_LAND_PHASE_1 : YELL_LAND_PHASE_2, m_creature);
SetNightBaneWalking();
ResetLandPhaseTimers();
m_Phase = PHASE_FIGHT;
break;
//bei 75% 50% und 25% leben von Nightbane
case PHASE_FLYING_TO:
m_uiFlyingFightCount++;
DoScriptText(YELL_FLY_PHASE, m_creature);
SetNightBaneFlying();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_lNextWaypoint = FlightTo[FLYPOINT_FLYING_START];
DoFlyToLocation(m_lNextWaypoint);
m_Phase = PHASE_FLYING_TO;
break;
//Fliegt zurück zur Kampfposition
case PHASE_FLYING_BACK:
//m_lNextWaypoint = FlightBack[FLYPOINT_FLYING_LAND];
DoFlyToLocation(m_lNextWaypoint);
m_Phase = PHASE_FLYING_BACK;
break;
//Wenn Nightbane auf seiner kampfposition ist bzw Wegpunkt 5 aus FlightPhase erreicht wurde
case PHASE_FLYING_FIGHT:
// DoResetThreat();
// m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
DoStartNoMovement(m_creature->getVictim());
m_creature->GetMotionMaster()->MoveIdle();
//m_creature->HandleEmote(EMOTE_ONESHOT_LIFTOFF);
//m_creature->RemoveSplineFlag(SPLINEFLAG_FLYING);
m_Phase = PHASE_FLYING_FIGHT;
break;
default:
error_log("boss_nightbane: unknown creature phase!");
break;
}
error_log("------------");
error_log("PHASE: = %i",m_Phase);
error_log("------------");
}
void MovementInform(uint32 type, uint32 id)
{
m_bMoving = false;
if (type == POINT_MOTION_TYPE)
{
switch (m_Phase)
{
case PHASE_INTRO:
switch (id)
{
// TODO: waiting and posing
case FLYPOINT_INTRO_WAIT1:
case FLYPOINT_INTRO_WAIT2:
// m_uiFlyIntroWaitTimer = 10000;
break;
case FLYPOINT_INTRO_LAND:
ChangePhase(PHASE_FIGHT); return;
break;
}
m_lNextWaypoint = IntroWay[m_lNextWaypoint.id+1];
break;
case PHASE_FLYING_TO:
switch (id)
{
case FLYPOINT_FLYING_ATTACKPOINT:
ChangePhase(PHASE_FLYING_FIGHT); return;
break;
}
m_lNextWaypoint = FlightTo[m_lNextWaypoint.id+1];
break;
/*case PHASE_FLYING_BACK:
switch (id)
{
case FLYPOINT_FLYING_LAND:
ChangePhase(PHASE_FIGHT);
break;
default:
DoFlyToLocation(m_lNextWaypoint);
m_lNextWaypoint = FlightTo[m_lNextWaypoint.id+1];
break;
}
break;*/
}
}
}
void UpdateAI(const uint32 uiDiff)
{
switch (m_Phase)
{
//----------------------------------//
// ---------- Flugphasen ---------- //
//----------------------------------//
//TODO: in der luft stehen
case PHASE_INTRO:
case PHASE_FLYING_TO:
if (!m_bMoving)
DoFlyToLocation(m_lNextWaypoint);
break;
case PHASE_FLYING_FIGHT:
m_creature->GetMotionMaster()->MovePoint(FlightTo[5].id, FlightTo[5].x, FlightTo[5].y, FlightTo[5].z);
break;
//----------------------------------//
// ----- Nightbane aufm Boden ----- //
//----------------------------------//
case PHASE_FIGHT:
//return if we have no target
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (m_creature->GetHealthPercent() <= 75 && m_uiFlyingFightCount == 0 ||
m_creature->GetHealthPercent() <= 50 && m_uiFlyingFightCount == 1 ||
m_creature->GetHealthPercent() <= 25 && m_uiFlyingFightCount == 2)
{
ChangePhase(PHASE_FLYING_TO);
return;
}
//Normal cleave
if (m_uiCleaveTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(),SPELL_CLEAVE) == CAST_OK)
m_uiCleaveTimer = 10000;
}
else
m_uiCleaveTimer -= uiDiff;
//TailSweep
if (m_uiTailSweepTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature,SPELL_TAIL_SWEEP) == CAST_OK)
m_uiTailSweepTimer = 15000;
}
else
m_uiTailSweepTimer -= uiDiff;
//BELLOWING_ROAR
if (m_uiBellowingRoarTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature,SPELL_BELLOWING_ROAR,CAST_INTERRUPT_PREVIOUS) == CAST_OK)
{
m_uiBellowingRoarTimer = 30000;
}
}
else
m_uiBellowingRoarTimer -= uiDiff;
//Smoldering Breath
if (m_uiSmolderingBreathTimer < uiDiff)
{
if(DoCastSpellIfCan(m_creature->getVictim(),SPELL_SMOLDERING_BREATH,false,m_creature->GetGUID()) == CAST_OK)
{
m_uiSmolderingBreathTimer = urand(10000, 25000);
//Spawn burning earth on ground
//gleichzeitig verbrannte Erde auf jmd zufälliges außer der Tank
Unit* pUnit = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1);
if (pUnit)
DoCast(pUnit,SPELL_CHARRED_EARTH,true);
}
}
else
m_uiSmolderingBreathTimer -= uiDiff;
DoMeleeAttackIfReady();
break;
//----------------------------------//
// Nightbane greift aus der Luft an //
//----------------------------------//
//case PHASE_FLYING_FIGHT:
// m_creature->GetMap()->CreatureRelocation(m_creature, FlightTo[5].x, FlightTo[5].y, FlightTo[5].z, 0.0f);
//break;
/*// DoScriptText(EMOTE_BREATH, m_creature); // holt tief Luft
//Cast Distracting Ash on the Ground
if (m_uiDistractintAshTimer < uiDiff)
{
Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (pUnit)
DoCastSpellIfCan(pUnit,SPELL_DISTRACTING_ASH,true);
m_uiDistractintAshTimer = urand(10000, 25000);
}
else
m_uiDistractintAshTimer -= uiDiff;
Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (pUnit)
{
DoCast(pUnit, SPELL_RAIN_OF_BONES, false);
pUnit = NULL;
if (m_creature->getVictim() && !m_creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
DoCast(m_creature->getVictim(), SPELL_SMOKING_BLAST, false);
if (!m_creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
ChangePhase(PHASE_FLYING_BACK);
}
}
m_creature->CastSpell(m_creature, SPELL_FIREBALL_BARRAGE, false);
break;*/
}
}
void MoveInLineOfSight(Unit *who)
{
if ((m_Phase == PHASE_FIGHT || m_Phase == PHASE_FLYING_FIGHT) && who->GetTypeId() == TYPEID_PLAYER)
AttackStart(who);
}
void EnterEvadeMode()
{
if (m_pInstance)
m_pInstance->SetData(TYPE_NIGHTBANE, FAIL);
m_creature->ForcedDespawn();
}
void JustDied(Unit* pVictim)
{
if (m_pInstance)
m_pInstance->SetData(TYPE_NIGHTBANE, DONE);
m_creature->Relocate(pVictim->GetPositionX(),pVictim->GetPositionY(),pVictim->GetPositionZ());
}
};
CreatureAI* GetAI_boss_nightbane(Creature *_Creature)
{
return new boss_nightbaneAI (_Creature);
}
enum
{
SPELL_SUMMON_NIGHTBANE = 31116
};
bool ItemUse_blackened_urn(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets;)
{
ScriptedInstance* m_pInstance;
m_pInstance = (ScriptedInstance*)pPlayer->GetInstanceData();
const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_SUMMON_NIGHTBANE);
if (!m_pInstance)
return true;
if (m_pInstance->GetData(TYPE_NIGHTBANE) == NOT_STARTED || m_pInstance->GetData(TYPE_NIGHTBANE) == FAIL)
{
if (m_pInstance->GetData(TYPE_MALCHEZZAR) != DONE)
{
Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_ERROR);
return false;
}
return false;
}
else
{
Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_ERROR);
return false;
}
}
void AddSC_boss_nightbane()
{
Script* newscript;
newscript = new Script;
newscript->Name = "boss_nightbane";
newscript->GetAI = &GetAI;_boss_nightbane;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "blackened_urn";
newscript->pItemUse = &ItemUse;_blackened_urn;
newscript->RegisterSelf();
}
Revise this Paste