diff options
author | Souler <soulerhyd@gmail.com> | 2011-11-09 16:47:51 +0100 |
---|---|---|
committer | Souler <soulerhyd@gmail.com> | 2011-11-09 16:47:51 +0100 |
commit | 8fd083c073ab52655a56e8ccc09da8c9e783b138 (patch) | |
tree | ddabe0d97706006e41b9a2f6ca5f164a9f6dea78 /src | |
parent | c2a2a4f7134c82c562abf115c4e38bdde5162267 (diff) |
Scripts/Gundrak: Add support for achievement "Snakes. Why'd It Have To Be Snakes?"
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 7e417a840f2..b3801c5cfa9 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -52,6 +52,7 @@ enum Creatures enum ConstrictorSpells { SPELL_GRIP_OF_SLAD_RAN = 55093, + SPELL_SNAKE_WRAP = 55126, SPELL_VENOMOUS_BITE = 54987, H_SPELL_VENOMOUS_BITE = 58996 }; @@ -65,6 +66,8 @@ static Position SpawnLoc[]= {1716.76f, 635.159f, 129.282f, 0.191986f} }; +#define DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES 1 + class boss_slad_ran : public CreatureScript { public: @@ -89,6 +92,8 @@ public: uint8 uiPhase; + bool snakesAchievement; + SummonList lSummons; InstanceScript* instance; @@ -100,6 +105,7 @@ public: uiVenomBoltTimer = 15*IN_MILLISECONDS; uiSpawnTimer = 5*IN_MILLISECONDS; uiPhase = 0; + snakesAchievement = true; lSummons.DespawnAll(); @@ -171,6 +177,7 @@ public: void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); + lSummons.DespawnAll(); if (instance) instance->SetData(DATA_SLAD_RAN_EVENT, DONE); @@ -186,6 +193,20 @@ public: summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); lSummons.Summon(summoned); } + + void SetData(uint32 type, uint32 /*data*/) + { + if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) + snakesAchievement = false; + } + + uint32 GetData(uint32 type) + { + if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) + return snakesAchievement ? 1 : 0; + + return 0; + } }; }; @@ -215,10 +236,26 @@ public: { if (!UpdateVictim()) return; + if (uiGripOfSladRanTimer <= diff) { - DoCast(me->getVictim(), SPELL_GRIP_OF_SLAD_RAN); - uiGripOfSladRanTimer = 5*IN_MILLISECONDS; + Unit* target = me->getVictim(); + + DoCast(target, SPELL_GRIP_OF_SLAD_RAN); + uiGripOfSladRanTimer = urand(3, 6)*IN_MILLISECONDS; + + Aura* grip = target->GetAura(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID()); + if (grip && grip->GetStackAmount() == 5) + { + target->RemoveAurasDueToSpell(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID()); + target->CastSpell(target, SPELL_SNAKE_WRAP, true); + + if (TempSummon* _me = me->ToTempSummon()) + if (Creature* sladran = _me->GetSummoner()->ToCreature()) + sladran->AI()->SetData(DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES, 0); + + me->DespawnOrUnsummon(); + } } else uiGripOfSladRanTimer -= diff; } @@ -265,9 +302,30 @@ public: }; +class achievement_snakes_whyd_it_have_to_be_snakes : public AchievementCriteriaScript +{ + public: + achievement_snakes_whyd_it_have_to_be_snakes() : AchievementCriteriaScript("achievement_snakes_whyd_it_have_to_be_snakes") + { + } + + bool OnCheck(Player* /*player*/, Unit* target) + { + if (!target) + return false; + + if (Creature* sladran = target->ToCreature()) + if (sladran->AI()->GetData(DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES)) + return true; + + return false; + } +}; + void AddSC_boss_slad_ran() { new boss_slad_ran(); new mob_slad_ran_constrictor(); new mob_slad_ran_viper(); -} + new achievement_snakes_whyd_it_have_to_be_snakes(); +}
\ No newline at end of file |