mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 04:32:35 -04:00
Scripted/Pets: Move some player pets in pet_xxx.cpp
This commit is contained in:
81
src/server/scripts/Pet/pet_mage.cpp
Normal file
81
src/server/scripts/Pet/pet_mage.cpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user