Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*######
- # npc_shadowfiend
- ######*/
- enum Shadowfiend
- {
- MANA_LEECH = 28305,
- GLYPH_OF_SHADOWFIEND_MANA = 58227,
- GLYPH_OF_SHADOWFIEND = 58228
- };
- class npc_shadowfiend : public CreatureScript
- {
- public:
- npc_shadowfiend() : CreatureScript("npc_shadowfiend") { }
- struct npc_shadowfiendAI : public ScriptedAI
- {
- npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {}
- void Reset()
- {
- if (me->IsSummon())
- if (Unit* owner = me->ToTempSummon()->GetSummoner())
- if (Unit* pet = owner->GetGuardianPet())
- pet->CastSpell(pet, MANA_LEECH, true);
- }
- void DamageTaken(Unit* /*killer*/, uint32& damage)
- {
- if (me->IsSummon())
- if (Unit* owner = me->ToTempSummon()->GetSummoner())
- if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth())
- owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
- }
- void UpdateAI(uint32 const /*diff*/)
- {
- if (!UpdateVictim())
- return;
- DoMeleeAttackIfReady();
- }
- };
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_shadowfiendAI(creature);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement