Merge pull request #3889 from Souler/master

Core/Achievements: Implement "Snakes. Why'd It Have To Be Snakes?"
This commit is contained in:
Shocker
2011-11-26 11:15:23 -08:00

View File

@@ -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,7 @@ public:
uint8 uiPhase;
std::set<uint64> lWrappedPlayers;
SummonList lSummons;
InstanceScript* instance;
@@ -100,6 +104,7 @@ public:
uiVenomBoltTimer = 15*IN_MILLISECONDS;
uiSpawnTimer = 5*IN_MILLISECONDS;
uiPhase = 0;
lWrappedPlayers.clear();
lSummons.DespawnAll();
@@ -171,6 +176,7 @@ public:
void JustDied(Unit* /*killer*/)
{
DoScriptText(SAY_DEATH, me);
lSummons.DespawnAll();
if (instance)
instance->SetData(DATA_SLAD_RAN_EVENT, DONE);
@@ -186,6 +192,17 @@ public:
summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
lSummons.Summon(summoned);
}
void SetGUID(uint64 guid, int32 type)
{
if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES)
lWrappedPlayers.insert(guid);
}
bool WasWrapped(uint64 guid)
{
return lWrappedPlayers.count(guid);
}
};
};
@@ -215,10 +232,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()->SetGUID(target->GetGUID() ,DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES);
me->DespawnOrUnsummon();
}
} else uiGripOfSladRanTimer -= diff;
}
@@ -265,9 +298,28 @@ 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 (boss_slad_ran::boss_slad_ranAI* sladRanAI = CAST_AI(boss_slad_ran::boss_slad_ranAI, target->GetAI()))
return !sladRanAI->WasWrapped(player->GetGUID());
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();
}