Files
TCPlayerbotCore/src/server/scripts/EasternKingdoms/duskwood.cpp
T

136 lines
4.1 KiB
C++
Raw Normal View History

/*
2011-01-01 15:01:13 +01:00
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2009-09-19 15:14:05 -07:00
*
* 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.
2009-09-19 15:14:05 -07:00
*
* 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, see <http://www.gnu.org/licenses/>.
2009-09-19 15:14:05 -07:00
*/
2009-10-17 15:51:44 -07:00
2009-09-19 15:14:05 -07:00
/* ScriptData
SDName: Duskwood
SD%Complete: 100
SDComment: Quest Support:8735
SDCategory: Duskwood
EndScriptData */
2009-10-17 15:51:44 -07:00
#include "ScriptPCH.h"
2009-10-17 15:51:44 -07:00
2009-09-19 15:14:05 -07:00
/*######
# at_twilight_grove
######*/
class at_twilight_grove : public AreaTriggerScript
2009-09-19 15:14:05 -07:00
{
2010-08-08 22:54:58 +06:00
public:
at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
2009-09-19 15:14:05 -07:00
{
if (player->HasQuestForItem(21149))
{
if (Unit* TCorrupter = player->SummonCreature(15625, -10328.16f, -489.57f, 49.95f, 0, TEMPSUMMON_MANUAL_DESPAWN, 60000))
2010-08-08 22:54:58 +06:00
{
TCorrupter->setFaction(14);
TCorrupter->SetMaxHealth(832750);
}
if (Unit* CorrupterSpeaker = player->SummonCreature(1, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()-1, 0, TEMPSUMMON_TIMED_DESPAWN, 15000))
2010-08-08 22:54:58 +06:00
{
CorrupterSpeaker->SetName("Twilight Corrupter");
CorrupterSpeaker->SetVisible(true);
CorrupterSpeaker->MonsterYell("Come, $N. See what the Nightmare brings...", 0, player->GetGUID());
2010-08-08 22:54:58 +06:00
}
}
2010-08-08 22:54:58 +06:00
return false;
};
2009-09-19 15:14:05 -07:00
};
2009-10-17 15:51:44 -07:00
2009-09-19 15:14:05 -07:00
/*######
# boss_twilight_corrupter
######*/
2009-10-17 15:51:44 -07:00
2009-09-19 15:14:05 -07:00
#define SPELL_SOUL_CORRUPTION 25805
#define SPELL_CREATURE_OF_NIGHTMARE 25806
#define SPELL_LEVEL_UP 24312
class boss_twilight_corrupter : public CreatureScript
2009-09-19 15:14:05 -07:00
{
2010-08-08 22:54:58 +06:00
public:
boss_twilight_corrupter() : CreatureScript("boss_twilight_corrupter") { }
2009-10-17 15:51:44 -07:00
CreatureAI* GetAI(Creature* creature) const
2009-09-19 15:14:05 -07:00
{
return new boss_twilight_corrupterAI (creature);
2009-09-19 15:14:05 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
struct boss_twilight_corrupterAI : public ScriptedAI
2009-09-19 15:14:05 -07:00
{
boss_twilight_corrupterAI(Creature* c) : ScriptedAI(c) {}
2010-08-08 22:54:58 +06:00
uint32 SoulCorruption_Timer;
uint32 CreatureOfNightmare_Timer;
uint8 KillCount;
void Reset()
{
SoulCorruption_Timer = 15000;
CreatureOfNightmare_Timer = 30000;
KillCount = 0;
}
void EnterCombat(Unit* /*who*/)
2009-09-19 15:14:05 -07:00
{
2011-04-29 20:47:02 +02:00
me->MonsterYell("The Nightmare cannot be stopped!", 0, me->GetGUID());
2010-08-08 22:54:58 +06:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
2009-09-19 15:14:05 -07:00
{
2010-08-08 22:54:58 +06:00
++KillCount;
2011-04-29 20:47:02 +02:00
me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(), true);
2010-08-08 22:54:58 +06:00
if (KillCount == 3)
{
DoCast(me, SPELL_LEVEL_UP, true);
KillCount = 0;
}
2009-09-19 15:14:05 -07:00
}
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void UpdateAI(const uint32 diff)
2009-09-19 15:14:05 -07:00
{
2010-08-08 22:54:58 +06:00
if (!UpdateVictim())
return;
if (SoulCorruption_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION);
SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers
} else SoulCorruption_Timer-=diff;
2010-08-08 22:54:58 +06:00
if (CreatureOfNightmare_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE);
CreatureOfNightmare_Timer = 45000; //gotta confirm Timers
} else CreatureOfNightmare_Timer-=diff;
DoMeleeAttackIfReady();
};
2009-09-19 15:14:05 -07:00
};
2010-08-08 22:54:58 +06:00
2009-09-19 15:14:05 -07:00
};
2009-10-17 15:51:44 -07:00
2009-09-19 15:14:05 -07:00
void AddSC_duskwood()
{
2010-08-08 22:54:58 +06:00
new boss_twilight_corrupter();
new at_twilight_grove();
2009-09-19 15:14:05 -07:00
}