diff options
author | Anubisss <none@none> | 2009-08-28 20:45:28 +0200 |
---|---|---|
committer | Anubisss <none@none> | 2009-08-28 20:45:28 +0200 |
commit | 6a988ad6f0750dc35290d132f8a9ff8d88170bf2 (patch) | |
tree | 0c4674203bc99634836af0a23b87af08ad91de82 /src | |
parent | 4d8808879df730669a050bafe3ad9890131b35a9 (diff) |
*Implement achievement The Hundred Club.
*Thanks to megamage for the timer idea.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp index 1b2857f7706..635d064ce65 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp @@ -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()) |