mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-06 00:48:39 +01:00
*Implement achievement The Hundred Club.
*Thanks to megamage for the timer idea. --HG-- branch : trunk
This commit is contained in:
@@ -39,6 +39,9 @@
|
||||
#define MOB_BLIZZARD 16474
|
||||
#define GO_ICEBLOCK 181247
|
||||
|
||||
#define ACHIEVEMENT_THE_HUNDRED_CLUB HEROIC(2146, 2147)
|
||||
#define MAX_FROST_RESISTANCE 100
|
||||
|
||||
enum Phases
|
||||
{
|
||||
PHASE_NULL = 0,
|
||||
@@ -70,12 +73,18 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
|
||||
{
|
||||
boss_sapphironAI(Creature* c) : BossAI(c, BOSS_SAPPHIRON)
|
||||
, phase(PHASE_NULL)
|
||||
{}
|
||||
{
|
||||
pMap = m_creature->GetMap();
|
||||
}
|
||||
|
||||
Phases phase;
|
||||
uint32 iceboltCount;
|
||||
IceBlockMap iceblocks;
|
||||
|
||||
bool CanTheHundredClub; // needed for achievement: The Hundred Club(2146, 2147)
|
||||
uint32 CheckFrostResistTimer;
|
||||
Map* pMap;
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
float x, y, z;
|
||||
@@ -96,6 +105,9 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
|
||||
ClearIceBlock();
|
||||
|
||||
phase = PHASE_NULL;
|
||||
|
||||
CanTheHundredClub = true;
|
||||
CheckFrostResistTimer = 5000;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit *who)
|
||||
@@ -106,6 +118,8 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
|
||||
|
||||
events.ScheduleEvent(EVENT_BERSERK, 15*60000);
|
||||
EnterPhaseGround();
|
||||
|
||||
CheckPlayersFrostResist();
|
||||
}
|
||||
|
||||
void SpellHitTarget(Unit *target, const SpellEntry *spell)
|
||||
@@ -125,6 +139,21 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
|
||||
{
|
||||
_JustDied();
|
||||
me->CastSpell(me, SPELL_DIES, true);
|
||||
|
||||
CheckPlayersFrostResist();
|
||||
if(CanTheHundredClub)
|
||||
{
|
||||
AchievementEntry const *AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB);
|
||||
if(AchievTheHundredClub)
|
||||
{
|
||||
if(pMap && pMap->IsDungeon())
|
||||
{
|
||||
Map::PlayerList const &players = pMap->GetPlayers();
|
||||
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
itr->getSource()->CompletedAchievement(AchievTheHundredClub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MovementInform(uint32, uint32 id)
|
||||
@@ -142,6 +171,22 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
|
||||
}
|
||||
}
|
||||
|
||||
void CheckPlayersFrostResist()
|
||||
{
|
||||
if(CanTheHundredClub && pMap && pMap->IsDungeon())
|
||||
{
|
||||
Map::PlayerList const &players = pMap->GetPlayers();
|
||||
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
{
|
||||
if(itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
|
||||
{
|
||||
CanTheHundredClub = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnterPhaseGround()
|
||||
{
|
||||
phase = PHASE_GROUND;
|
||||
@@ -176,6 +221,15 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
|
||||
if (phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom())
|
||||
return;
|
||||
|
||||
if(CanTheHundredClub)
|
||||
{
|
||||
if(CheckFrostResistTimer < diff)
|
||||
{
|
||||
CheckPlayersFrostResist();
|
||||
CheckFrostResistTimer = (rand() % 5 + 5) * 1000;
|
||||
}else CheckFrostResistTimer -= diff;
|
||||
}
|
||||
|
||||
if (phase == PHASE_GROUND)
|
||||
{
|
||||
while(uint32 eventId = events.ExecuteEvent())
|
||||
|
||||
Reference in New Issue
Block a user