Scripted/Pets: Move some player pets in pet_xxx.cpp

This commit is contained in:
Vincent-Michael
2013-08-09 19:22:16 +02:00
parent b7d88a3c46
commit dbb40dd4fe
11 changed files with 646 additions and 444 deletions

View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Ordered alphabetically using scriptname.
* Scriptnames of files in this file should be prefixed with "npc_pet_mag_".
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
enum MageSpells
{
SPELL_MAGE_CLONE_ME = 45204,
SPELL_MAGE_MASTERS_THREAT_LIST = 58838
};
class npc_pet_mage_mirror_image : public CreatureScript
{
public:
npc_pet_mage_mirror_image() : CreatureScript("npc_pet_mage_mirror_image") { }
struct npc_pet_mage_mirror_imageAI : CasterAI
{
npc_pet_mage_mirror_imageAI(Creature* creature) : CasterAI(creature) { }
void InitializeAI() OVERRIDE
{
CasterAI::InitializeAI();
Unit* owner = me->GetOwner();
if (!owner)
return;
// Inherit Master's Threat List (not yet implemented)
owner->CastSpell((Unit*)NULL, SPELL_MAGE_MASTERS_THREAT_LIST, true);
// here mirror image casts on summoner spell (not present in client dbc) 49866
// here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?)
// Clone Me!
owner->CastSpell(me, SPELL_MAGE_CLONE_ME, false);
}
// Do not reload Creature templates on evade mode enter - prevent visual lost
void EnterEvadeMode() OVERRIDE
{
if (me->IsInEvadeMode() || !me->IsAlive())
return;
Unit* owner = me->GetCharmerOrOwner();
me->CombatStop(true);
if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW))
{
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
}
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_pet_mage_mirror_imageAI(creature);
}
};
void AddSC_mage_pet_scripts()
{
new npc_pet_mage_mirror_image();
}