mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 18:40:28 +00:00
converted all tabs to 4 spaces
This commit is contained in:
@@ -34,8 +34,8 @@ enum DeathKnightSpells
|
||||
SPELL_DK_SUMMON_GARGOYLE_2 = 50514,
|
||||
SPELL_DK_DISMISS_GARGOYLE = 50515,
|
||||
SPELL_DK_SANCTUARY = 54661,
|
||||
SPELL_DK_NIGHT_OF_THE_DEAD = 62137,
|
||||
SPELL_DK_PET_SCALING = 61017
|
||||
SPELL_DK_NIGHT_OF_THE_DEAD = 62137,
|
||||
SPELL_DK_PET_SCALING = 61017
|
||||
};
|
||||
|
||||
class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
@@ -46,172 +46,172 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
struct npc_pet_dk_ebon_gargoyleAI : ScriptedAI
|
||||
{
|
||||
npc_pet_dk_ebon_gargoyleAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
_despawnTimer = 36000; // 30 secs + 4 fly out + 2 initial attack timer
|
||||
_despawning = false;
|
||||
_initialSelection = true;
|
||||
_targetGUID = 0;
|
||||
}
|
||||
{
|
||||
_despawnTimer = 36000; // 30 secs + 4 fly out + 2 initial attack timer
|
||||
_despawning = false;
|
||||
_initialSelection = true;
|
||||
_targetGUID = 0;
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 point)
|
||||
{
|
||||
if (type == POINT_MOTION_TYPE && point == 1)
|
||||
{
|
||||
me->SetCanFly(false);
|
||||
me->SetDisableGravity(false);
|
||||
}
|
||||
}
|
||||
void MovementInform(uint32 type, uint32 point)
|
||||
{
|
||||
if (type == POINT_MOTION_TYPE && point == 1)
|
||||
{
|
||||
me->SetCanFly(false);
|
||||
me->SetDisableGravity(false);
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
ScriptedAI::InitializeAI();
|
||||
Unit* owner = me->GetOwner();
|
||||
if (!owner)
|
||||
return;
|
||||
void InitializeAI()
|
||||
{
|
||||
ScriptedAI::InitializeAI();
|
||||
Unit* owner = me->GetOwner();
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
// Xinef: Night of the Dead avoidance
|
||||
if (Aura *aur = me->GetAura(SPELL_DK_NIGHT_OF_THE_DEAD))
|
||||
if (Unit* owner = me->GetOwner())
|
||||
if (AuraEffect *aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0))
|
||||
if (aur->GetEffect(0))
|
||||
aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
|
||||
|
||||
float tz = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, MAX_FALL_DISTANCE);
|
||||
me->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), tz, 7.0f, 1);
|
||||
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
|
||||
me->SetCanFly(true);
|
||||
me->SetDisableGravity(true);
|
||||
_selectionTimer = 2000;
|
||||
_initialCastTimer = 0;
|
||||
}
|
||||
// Xinef: Night of the Dead avoidance
|
||||
if (Aura *aur = me->GetAura(SPELL_DK_NIGHT_OF_THE_DEAD))
|
||||
if (Unit* owner = me->GetOwner())
|
||||
if (AuraEffect *aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0))
|
||||
if (aur->GetEffect(0))
|
||||
aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
|
||||
|
||||
float tz = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, MAX_FALL_DISTANCE);
|
||||
me->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), tz, 7.0f, 1);
|
||||
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
|
||||
me->SetCanFly(true);
|
||||
me->SetDisableGravity(true);
|
||||
_selectionTimer = 2000;
|
||||
_initialCastTimer = 0;
|
||||
}
|
||||
|
||||
void MySelectNextTarget()
|
||||
{
|
||||
Unit* owner = me->GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim())))
|
||||
{
|
||||
Unit* selection = owner->ToPlayer()->GetSelectedUnit();
|
||||
if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection))
|
||||
{
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
SetGazeOn(selection);
|
||||
}
|
||||
else if (!me->GetVictim() || !owner->CanSeeOrDetect(me->GetVictim()))
|
||||
{
|
||||
me->CombatStop(true);
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, 0.0f);
|
||||
RemoveTargetAura();
|
||||
}
|
||||
}
|
||||
}
|
||||
void MySelectNextTarget()
|
||||
{
|
||||
Unit* owner = me->GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim())))
|
||||
{
|
||||
Unit* selection = owner->ToPlayer()->GetSelectedUnit();
|
||||
if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection))
|
||||
{
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
SetGazeOn(selection);
|
||||
}
|
||||
else if (!me->GetVictim() || !owner->CanSeeOrDetect(me->GetVictim()))
|
||||
{
|
||||
me->CombatStop(true);
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, 0.0f);
|
||||
RemoveTargetAura();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AttackStart(Unit* who)
|
||||
{
|
||||
RemoveTargetAura();
|
||||
_targetGUID = who->GetGUID();
|
||||
me->AddAura(SPELL_DK_SUMMON_GARGOYLE_1, who);
|
||||
ScriptedAI::AttackStart(who);
|
||||
}
|
||||
void AttackStart(Unit* who)
|
||||
{
|
||||
RemoveTargetAura();
|
||||
_targetGUID = who->GetGUID();
|
||||
me->AddAura(SPELL_DK_SUMMON_GARGOYLE_1, who);
|
||||
ScriptedAI::AttackStart(who);
|
||||
}
|
||||
|
||||
void RemoveTargetAura()
|
||||
{
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*me, _targetGUID))
|
||||
target->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetGUID());
|
||||
}
|
||||
void RemoveTargetAura()
|
||||
{
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*me, _targetGUID))
|
||||
target->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetGUID());
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
_selectionTimer = 0;
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
MySelectNextTarget();
|
||||
}
|
||||
void Reset()
|
||||
{
|
||||
_selectionTimer = 0;
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
MySelectNextTarget();
|
||||
}
|
||||
|
||||
// Fly away when dismissed
|
||||
void FlyAway()
|
||||
{
|
||||
RemoveTargetAura();
|
||||
// Fly away when dismissed
|
||||
void FlyAway()
|
||||
{
|
||||
RemoveTargetAura();
|
||||
|
||||
// Stop Fighting
|
||||
me->CombatStop(true);
|
||||
me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true);
|
||||
// Stop Fighting
|
||||
me->CombatStop(true);
|
||||
me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true);
|
||||
|
||||
// Sanctuary
|
||||
me->CastSpell(me, SPELL_DK_SANCTUARY, true);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
// Sanctuary
|
||||
me->CastSpell(me, SPELL_DK_SANCTUARY, true);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
|
||||
me->SetSpeed(MOVE_FLIGHT, 1.0f, true);
|
||||
me->SetSpeed(MOVE_RUN, 1.0f, true);
|
||||
float x = me->GetPositionX() + 20 * cos(me->GetOrientation());
|
||||
float y = me->GetPositionY() + 20 * sin(me->GetOrientation());
|
||||
float z = me->GetPositionZ() + 40;
|
||||
me->DisableSpline();
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
me->SetSpeed(MOVE_FLIGHT, 1.0f, true);
|
||||
me->SetSpeed(MOVE_RUN, 1.0f, true);
|
||||
float x = me->GetPositionX() + 20 * cos(me->GetOrientation());
|
||||
float y = me->GetPositionY() + 20 * sin(me->GetOrientation());
|
||||
float z = me->GetPositionZ() + 40;
|
||||
me->DisableSpline();
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
|
||||
me->GetMotionMaster()->MoveCharge(x, y, z, 7.0f, 1);
|
||||
me->SetCanFly(true);
|
||||
me->SetDisableGravity(true);
|
||||
me->GetMotionMaster()->MoveCharge(x, y, z, 7.0f, 1);
|
||||
me->SetCanFly(true);
|
||||
me->SetDisableGravity(true);
|
||||
|
||||
_despawning = true;
|
||||
}
|
||||
_despawning = true;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (_initialSelection)
|
||||
{
|
||||
_initialSelection = false;
|
||||
// Find victim of Summon Gargoyle spell
|
||||
std::list<Unit*> targets;
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50);
|
||||
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check);
|
||||
me->VisitNearbyObject(50, searcher);
|
||||
for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
|
||||
if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID()))
|
||||
{
|
||||
(*iter)->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID());
|
||||
SetGazeOn(*iter);
|
||||
_targetGUID = (*iter)->GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_despawnTimer > 4000)
|
||||
{
|
||||
_despawnTimer -= diff;
|
||||
if (!UpdateVictimWithGaze())
|
||||
{
|
||||
MySelectNextTarget();
|
||||
return;
|
||||
}
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (_initialSelection)
|
||||
{
|
||||
_initialSelection = false;
|
||||
// Find victim of Summon Gargoyle spell
|
||||
std::list<Unit*> targets;
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50);
|
||||
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check);
|
||||
me->VisitNearbyObject(50, searcher);
|
||||
for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
|
||||
if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID()))
|
||||
{
|
||||
(*iter)->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID());
|
||||
SetGazeOn(*iter);
|
||||
_targetGUID = (*iter)->GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_despawnTimer > 4000)
|
||||
{
|
||||
_despawnTimer -= diff;
|
||||
if (!UpdateVictimWithGaze())
|
||||
{
|
||||
MySelectNextTarget();
|
||||
return;
|
||||
}
|
||||
|
||||
_initialCastTimer += diff;
|
||||
_selectionTimer += diff;
|
||||
if (_selectionTimer >= 1000)
|
||||
{
|
||||
MySelectNextTarget();
|
||||
_selectionTimer = 0;
|
||||
}
|
||||
if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
|
||||
me->CastSpell(me->GetVictim(), 51963, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_despawning)
|
||||
FlyAway();
|
||||
_initialCastTimer += diff;
|
||||
_selectionTimer += diff;
|
||||
if (_selectionTimer >= 1000)
|
||||
{
|
||||
MySelectNextTarget();
|
||||
_selectionTimer = 0;
|
||||
}
|
||||
if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
|
||||
me->CastSpell(me->GetVictim(), 51963, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_despawning)
|
||||
FlyAway();
|
||||
|
||||
if (_despawnTimer > diff)
|
||||
_despawnTimer -= diff;
|
||||
else
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
if (_despawnTimer > diff)
|
||||
_despawnTimer -= diff;
|
||||
else
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _targetGUID;
|
||||
uint64 _targetGUID;
|
||||
uint32 _despawnTimer;
|
||||
uint32 _selectionTimer;
|
||||
uint32 _initialCastTimer;
|
||||
bool _despawning;
|
||||
bool _initialSelection;
|
||||
uint32 _selectionTimer;
|
||||
uint32 _initialCastTimer;
|
||||
bool _despawning;
|
||||
bool _initialSelection;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
@@ -222,81 +222,81 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
|
||||
class npc_pet_dk_ghoul : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pet_dk_ghoul() : CreatureScript("npc_pet_dk_ghoul") { }
|
||||
public:
|
||||
npc_pet_dk_ghoul() : CreatureScript("npc_pet_dk_ghoul") { }
|
||||
|
||||
struct npc_pet_dk_ghoulAI : public CombatAI
|
||||
{
|
||||
npc_pet_dk_ghoulAI(Creature *c) : CombatAI(c) { }
|
||||
struct npc_pet_dk_ghoulAI : public CombatAI
|
||||
{
|
||||
npc_pet_dk_ghoulAI(Creature *c) : CombatAI(c) { }
|
||||
|
||||
void JustDied(Unit *who)
|
||||
{
|
||||
if (me->IsGuardian() || me->IsSummon())
|
||||
me->ToTempSummon()->UnSummon();
|
||||
}
|
||||
};
|
||||
void JustDied(Unit *who)
|
||||
{
|
||||
if (me->IsGuardian() || me->IsSummon())
|
||||
me->ToTempSummon()->UnSummon();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
return new npc_pet_dk_ghoulAI (pCreature);
|
||||
}
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
return new npc_pet_dk_ghoulAI (pCreature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_pet_dk_army_of_the_dead : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pet_dk_army_of_the_dead() : CreatureScript("npc_pet_dk_army_of_the_dead") { }
|
||||
public:
|
||||
npc_pet_dk_army_of_the_dead() : CreatureScript("npc_pet_dk_army_of_the_dead") { }
|
||||
|
||||
struct npc_pet_dk_army_of_the_deadAI : public CombatAI
|
||||
{
|
||||
npc_pet_dk_army_of_the_deadAI(Creature* creature) : CombatAI(creature) { }
|
||||
struct npc_pet_dk_army_of_the_deadAI : public CombatAI
|
||||
{
|
||||
npc_pet_dk_army_of_the_deadAI(Creature* creature) : CombatAI(creature) { }
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
CombatAI::InitializeAI();
|
||||
((Minion*)me)->SetFollowAngle(rand_norm()*2*M_PI);
|
||||
void InitializeAI()
|
||||
{
|
||||
CombatAI::InitializeAI();
|
||||
((Minion*)me)->SetFollowAngle(rand_norm()*2*M_PI);
|
||||
|
||||
// Heroism / Bloodlust immunity
|
||||
me->ApplySpellImmune(0, IMMUNITY_ID, 32182, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_ID, 2825, true);
|
||||
}
|
||||
};
|
||||
// Heroism / Bloodlust immunity
|
||||
me->ApplySpellImmune(0, IMMUNITY_ID, 32182, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_ID, 2825, true);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_dk_army_of_the_deadAI (creature);
|
||||
}
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_dk_army_of_the_deadAI (creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_pet_dk_dancing_rune_weapon : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pet_dk_dancing_rune_weapon() : CreatureScript("npc_pet_dk_dancing_rune_weapon") { }
|
||||
public:
|
||||
npc_pet_dk_dancing_rune_weapon() : CreatureScript("npc_pet_dk_dancing_rune_weapon") { }
|
||||
|
||||
struct npc_pet_dk_dancing_rune_weaponAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_dk_dancing_rune_weaponAI(Creature* creature) : NullCreatureAI(creature) { }
|
||||
struct npc_pet_dk_dancing_rune_weaponAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_dk_dancing_rune_weaponAI(Creature* creature) : NullCreatureAI(creature) { }
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
// Xinef: Hit / Expertise scaling
|
||||
me->AddAura(61017, me);
|
||||
if (Unit* owner = me->GetOwner())
|
||||
me->GetMotionMaster()->MoveFollow(owner, 0.01f, me->GetFollowAngle(), MOTION_SLOT_CONTROLLED);
|
||||
NullCreatureAI::InitializeAI();
|
||||
}
|
||||
};
|
||||
void InitializeAI()
|
||||
{
|
||||
// Xinef: Hit / Expertise scaling
|
||||
me->AddAura(61017, me);
|
||||
if (Unit* owner = me->GetOwner())
|
||||
me->GetMotionMaster()->MoveFollow(owner, 0.01f, me->GetFollowAngle(), MOTION_SLOT_CONTROLLED);
|
||||
NullCreatureAI::InitializeAI();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_dk_dancing_rune_weaponAI (creature);
|
||||
}
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_dk_dancing_rune_weaponAI (creature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_deathknight_pet_scripts()
|
||||
{
|
||||
new npc_pet_dk_ebon_gargoyle();
|
||||
new npc_pet_dk_ghoul();
|
||||
new npc_pet_dk_army_of_the_dead();
|
||||
new npc_pet_dk_dancing_rune_weapon();
|
||||
new npc_pet_dk_ghoul();
|
||||
new npc_pet_dk_army_of_the_dead();
|
||||
new npc_pet_dk_dancing_rune_weapon();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,8 @@ enum HunterSpells
|
||||
SPELL_HUNTER_CRIPPLING_POISON = 30981, // Viper
|
||||
SPELL_HUNTER_DEADLY_POISON_PASSIVE = 34657, // Venomous Snake
|
||||
SPELL_HUNTER_MIND_NUMBING_POISON = 25810, // Viper
|
||||
SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP = 56849,
|
||||
SPELL_HUNTER_PET_SCALING = 62915
|
||||
SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP = 56849,
|
||||
SPELL_HUNTER_PET_SCALING = 62915
|
||||
};
|
||||
|
||||
enum HunterCreatures
|
||||
@@ -46,50 +46,50 @@ class npc_pet_hunter_snake_trap : public CreatureScript
|
||||
{
|
||||
npc_pet_hunter_snake_trapAI(Creature* creature) : ScriptedAI(creature) { _init = false; }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
_spellTimer = urand(1500, 3000);
|
||||
void Reset()
|
||||
{
|
||||
_spellTimer = urand(1500, 3000);
|
||||
|
||||
// Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target
|
||||
if (!me->GetVictim())
|
||||
if (Unit *tgt = me->SelectNearestTarget(10.0f))
|
||||
{
|
||||
me->AddThreat(tgt, 100000.0f);
|
||||
AttackStart(tgt);
|
||||
}
|
||||
// Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target
|
||||
if (!me->GetVictim())
|
||||
if (Unit *tgt = me->SelectNearestTarget(10.0f))
|
||||
{
|
||||
me->AddThreat(tgt, 100000.0f);
|
||||
AttackStart(tgt);
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode()
|
||||
{
|
||||
// _EnterEvadeMode();
|
||||
me->DeleteThreatList();
|
||||
me->CombatStop(true);
|
||||
me->LoadCreaturesAddon(true);
|
||||
me->SetLootRecipient(NULL);
|
||||
me->ResetPlayerDamageReq();
|
||||
me->SetLastDamagedTime(0);
|
||||
|
||||
me->AddUnitState(UNIT_STATE_EVADE);
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
void EnterEvadeMode()
|
||||
{
|
||||
// _EnterEvadeMode();
|
||||
me->DeleteThreatList();
|
||||
me->CombatStop(true);
|
||||
me->LoadCreaturesAddon(true);
|
||||
me->SetLootRecipient(NULL);
|
||||
me->ResetPlayerDamageReq();
|
||||
me->SetLastDamagedTime(0);
|
||||
|
||||
me->AddUnitState(UNIT_STATE_EVADE);
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
Reset();
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
//Redefined for random target selection:
|
||||
void MoveInLineOfSight(Unit* who)
|
||||
{
|
||||
if (!me->GetVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me))
|
||||
{
|
||||
if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
//Redefined for random target selection:
|
||||
void MoveInLineOfSight(Unit* who)
|
||||
{
|
||||
if (!me->GetVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me))
|
||||
{
|
||||
if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
|
||||
if (me->IsWithinDistInMap(who, 10.0f))
|
||||
{
|
||||
me->AddThreat(who, 100000.0f);
|
||||
AttackStart(who);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (me->IsWithinDistInMap(who, 10.0f))
|
||||
{
|
||||
me->AddThreat(who, 100000.0f);
|
||||
AttackStart(who);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
@@ -102,35 +102,35 @@ class npc_pet_hunter_snake_trap : public CreatureScript
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_init)
|
||||
{
|
||||
_init = true;
|
||||
if (!_init)
|
||||
{
|
||||
_init = true;
|
||||
|
||||
CreatureTemplate const* Info = me->GetCreatureTemplate();
|
||||
uint32 health = uint32(107 * (me->getLevel() - 40) * 0.025f);
|
||||
me->SetCreateHealth(health);
|
||||
CreatureTemplate const* Info = me->GetCreatureTemplate();
|
||||
uint32 health = uint32(107 * (me->getLevel() - 40) * 0.025f);
|
||||
me->SetCreateHealth(health);
|
||||
|
||||
for (uint8 stat = 0; stat < MAX_STATS; ++stat)
|
||||
{
|
||||
me->SetStat(Stats(stat), 0);
|
||||
me->SetCreateStat(Stats(stat), 0);
|
||||
}
|
||||
for (uint8 stat = 0; stat < MAX_STATS; ++stat)
|
||||
{
|
||||
me->SetStat(Stats(stat), 0);
|
||||
me->SetCreateStat(Stats(stat), 0);
|
||||
}
|
||||
|
||||
me->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health);
|
||||
me->SetMaxHealth(health);
|
||||
//Add delta to make them not all hit the same time
|
||||
uint32 delta = urand(0, 700);
|
||||
me->SetAttackTime(BASE_ATTACK, Info->baseattacktime + delta);
|
||||
me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , float(Info->attackpower));
|
||||
me->CastSpell(me, SPELL_HUNTER_DEADLY_POISON_PASSIVE, true);
|
||||
me->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health);
|
||||
me->SetMaxHealth(health);
|
||||
//Add delta to make them not all hit the same time
|
||||
uint32 delta = urand(0, 700);
|
||||
me->SetAttackTime(BASE_ATTACK, Info->baseattacktime + delta);
|
||||
me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , float(Info->attackpower));
|
||||
me->CastSpell(me, SPELL_HUNTER_DEADLY_POISON_PASSIVE, true);
|
||||
|
||||
// Glyph of Snake Trap
|
||||
if (Unit* owner = me->GetOwner())
|
||||
if (owner->GetAuraEffectDummy(SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP))
|
||||
me->CastSpell(me, SPELL_HUNTER_PET_SCALING, true);
|
||||
}
|
||||
// Glyph of Snake Trap
|
||||
if (Unit* owner = me->GetOwner())
|
||||
if (owner->GetAuraEffectDummy(SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP))
|
||||
me->CastSpell(me, SPELL_HUNTER_PET_SCALING, true);
|
||||
}
|
||||
|
||||
_spellTimer += diff;
|
||||
_spellTimer += diff;
|
||||
if (_spellTimer >= 3000)
|
||||
{
|
||||
if (urand(0, 2) == 0) // 33% chance to cast
|
||||
|
||||
@@ -29,26 +29,26 @@ enum MageSpells
|
||||
{
|
||||
SPELL_MAGE_CLONE_ME = 45204,
|
||||
SPELL_MAGE_MASTERS_THREAT_LIST = 58838,
|
||||
SPELL_PET_HIT_SCALING = 61013,
|
||||
SPELL_SUMMON_MIRROR_IMAGE1 = 58831,
|
||||
SPELL_SUMMON_MIRROR_IMAGE2 = 58833,
|
||||
SPELL_SUMMON_MIRROR_IMAGE3 = 58834,
|
||||
SPELL_SUMMON_MIRROR_IMAGE_GLYPH = 65047
|
||||
SPELL_PET_HIT_SCALING = 61013,
|
||||
SPELL_SUMMON_MIRROR_IMAGE1 = 58831,
|
||||
SPELL_SUMMON_MIRROR_IMAGE2 = 58833,
|
||||
SPELL_SUMMON_MIRROR_IMAGE3 = 58834,
|
||||
SPELL_SUMMON_MIRROR_IMAGE_GLYPH = 65047
|
||||
};
|
||||
|
||||
class DeathEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
DeathEvent(Creature& owner) : BasicEvent(), _owner(owner) { }
|
||||
public:
|
||||
DeathEvent(Creature& owner) : BasicEvent(), _owner(owner) { }
|
||||
|
||||
bool Execute(uint64 /*eventTime*/, uint32 /*diff*/)
|
||||
{
|
||||
Unit::Kill(&_owner, &_owner);
|
||||
return true;
|
||||
}
|
||||
bool Execute(uint64 /*eventTime*/, uint32 /*diff*/)
|
||||
{
|
||||
Unit::Kill(&_owner, &_owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Creature& _owner;
|
||||
private:
|
||||
Creature& _owner;
|
||||
};
|
||||
|
||||
class npc_pet_mage_mirror_image : public CreatureScript
|
||||
@@ -60,8 +60,8 @@ class npc_pet_mage_mirror_image : public CreatureScript
|
||||
{
|
||||
npc_pet_mage_mirror_imageAI(Creature* creature) : CasterAI(creature) { }
|
||||
|
||||
uint32 selectionTimer;
|
||||
uint64 _ebonGarogyleGUID;
|
||||
uint32 selectionTimer;
|
||||
uint64 _ebonGarogyleGUID;
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
@@ -73,60 +73,60 @@ class npc_pet_mage_mirror_image : public CreatureScript
|
||||
// Clone Me!
|
||||
owner->CastSpell(me, SPELL_MAGE_CLONE_ME, true);
|
||||
|
||||
// xinef: Glyph of Mirror Image (4th copy)
|
||||
float angle = 0.0f;
|
||||
switch (me->GetUInt32Value(UNIT_CREATED_BY_SPELL))
|
||||
{
|
||||
case SPELL_SUMMON_MIRROR_IMAGE1:
|
||||
angle = 0.5f * M_PI;
|
||||
break;
|
||||
case SPELL_SUMMON_MIRROR_IMAGE2:
|
||||
angle = M_PI;
|
||||
break;
|
||||
case SPELL_SUMMON_MIRROR_IMAGE3:
|
||||
angle = 1.5f * M_PI;
|
||||
break;
|
||||
}
|
||||
// xinef: Glyph of Mirror Image (4th copy)
|
||||
float angle = 0.0f;
|
||||
switch (me->GetUInt32Value(UNIT_CREATED_BY_SPELL))
|
||||
{
|
||||
case SPELL_SUMMON_MIRROR_IMAGE1:
|
||||
angle = 0.5f * M_PI;
|
||||
break;
|
||||
case SPELL_SUMMON_MIRROR_IMAGE2:
|
||||
angle = M_PI;
|
||||
break;
|
||||
case SPELL_SUMMON_MIRROR_IMAGE3:
|
||||
angle = 1.5f * M_PI;
|
||||
break;
|
||||
}
|
||||
|
||||
((Minion*)me)->SetFollowAngle(angle);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
((Minion*)me)->SetFollowAngle(angle);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
|
||||
// Xinef: Inherit Master's Threat List (not yet implemented)
|
||||
//owner->CastSpell((Unit*)NULL, SPELL_MAGE_MASTERS_THREAT_LIST, true);
|
||||
HostileReference* ref = owner->getHostileRefManager().getFirst();
|
||||
while (ref)
|
||||
{
|
||||
if (Unit* unit = ref->GetSource()->GetOwner())
|
||||
unit->AddThreat(me, ref->getThreat() - ref->getTempThreatModifier());
|
||||
ref = ref->next();
|
||||
}
|
||||
HostileReference* ref = owner->getHostileRefManager().getFirst();
|
||||
while (ref)
|
||||
{
|
||||
if (Unit* unit = ref->GetSource()->GetOwner())
|
||||
unit->AddThreat(me, ref->getThreat() - ref->getTempThreatModifier());
|
||||
ref = ref->next();
|
||||
}
|
||||
|
||||
_ebonGarogyleGUID = 0;
|
||||
_ebonGarogyleGUID = 0;
|
||||
|
||||
// Xinef: copy caster auras
|
||||
Unit::VisibleAuraMap const* visibleAuraMap = owner->GetVisibleAuras();
|
||||
for (Unit::VisibleAuraMap::const_iterator itr = visibleAuraMap->begin(); itr != visibleAuraMap->end(); ++itr)
|
||||
if (Aura* visAura = itr->second->GetBase())
|
||||
{
|
||||
// Ebon Gargoyle
|
||||
if (visAura->GetId() == 49206 && me->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_SUMMON_MIRROR_IMAGE1)
|
||||
{
|
||||
if (Unit* garogyle = visAura->GetCaster())
|
||||
_ebonGarogyleGUID = garogyle->GetGUID();
|
||||
continue;
|
||||
}
|
||||
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(visAura->GetId());
|
||||
if (bounds.first != bounds.second)
|
||||
continue;
|
||||
std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(visAura->GetId() + SPELL_LINK_AURA);
|
||||
if (!spellTriggered || !spellTriggered->empty())
|
||||
continue;
|
||||
if (Aura* newAura = me->AddAura(visAura->GetId(), me))
|
||||
newAura->SetDuration(visAura->GetDuration());
|
||||
}
|
||||
// Xinef: copy caster auras
|
||||
Unit::VisibleAuraMap const* visibleAuraMap = owner->GetVisibleAuras();
|
||||
for (Unit::VisibleAuraMap::const_iterator itr = visibleAuraMap->begin(); itr != visibleAuraMap->end(); ++itr)
|
||||
if (Aura* visAura = itr->second->GetBase())
|
||||
{
|
||||
// Ebon Gargoyle
|
||||
if (visAura->GetId() == 49206 && me->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_SUMMON_MIRROR_IMAGE1)
|
||||
{
|
||||
if (Unit* garogyle = visAura->GetCaster())
|
||||
_ebonGarogyleGUID = garogyle->GetGUID();
|
||||
continue;
|
||||
}
|
||||
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(visAura->GetId());
|
||||
if (bounds.first != bounds.second)
|
||||
continue;
|
||||
std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(visAura->GetId() + SPELL_LINK_AURA);
|
||||
if (!spellTriggered || !spellTriggered->empty())
|
||||
continue;
|
||||
if (Aura* newAura = me->AddAura(visAura->GetId(), me))
|
||||
newAura->SetDuration(visAura->GetDuration());
|
||||
}
|
||||
|
||||
me->m_Events.AddEvent(new DeathEvent(*me), me->m_Events.CalculateTime(29500));
|
||||
me->m_Events.AddEvent(new DeathEvent(*me), me->m_Events.CalculateTime(29500));
|
||||
}
|
||||
|
||||
// Do not reload Creature templates on evade mode enter - prevent visual lost
|
||||
@@ -141,80 +141,80 @@ class npc_pet_mage_mirror_image : public CreatureScript
|
||||
if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW))
|
||||
{
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
bool MySelectNextTarget()
|
||||
{
|
||||
if (_ebonGarogyleGUID)
|
||||
{
|
||||
if (Unit* garogyle = ObjectAccessor::GetUnit(*me, _ebonGarogyleGUID))
|
||||
garogyle->GetAI()->AttackStart(me);
|
||||
_ebonGarogyleGUID = 0;
|
||||
}
|
||||
Unit* owner = me->GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Unit* selection = owner->ToPlayer()->GetSelectedUnit();
|
||||
if (selection && selection != me->GetVictim())
|
||||
{
|
||||
// target has cc, search target without cc!
|
||||
if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool MySelectNextTarget()
|
||||
{
|
||||
if (_ebonGarogyleGUID)
|
||||
{
|
||||
if (Unit* garogyle = ObjectAccessor::GetUnit(*me, _ebonGarogyleGUID))
|
||||
garogyle->GetAI()->AttackStart(me);
|
||||
_ebonGarogyleGUID = 0;
|
||||
}
|
||||
Unit* owner = me->GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Unit* selection = owner->ToPlayer()->GetSelectedUnit();
|
||||
if (selection && selection != me->GetVictim())
|
||||
{
|
||||
// target has cc, search target without cc!
|
||||
if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
me->getThreatManager().resetAllAggro();
|
||||
me->AddThreat(selection, 1000000.0f);
|
||||
AttackStart(selection);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
me->getThreatManager().resetAllAggro();
|
||||
me->AddThreat(selection, 1000000.0f);
|
||||
AttackStart(selection);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
selectionTimer = 0;
|
||||
}
|
||||
void Reset()
|
||||
{
|
||||
selectionTimer = 0;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
events.Update(diff);
|
||||
if (events.GetTimer() < 1200)
|
||||
return;
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
events.Update(diff);
|
||||
if (events.GetTimer() < 1200)
|
||||
return;
|
||||
|
||||
if (!me->IsInCombat() || !me->GetVictim())
|
||||
{
|
||||
MySelectNextTarget();
|
||||
return;
|
||||
}
|
||||
if (!me->IsInCombat() || !me->GetVictim())
|
||||
{
|
||||
MySelectNextTarget();
|
||||
return;
|
||||
}
|
||||
|
||||
if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive())
|
||||
{
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
if (!MySelectNextTarget())
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive())
|
||||
{
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
if (!MySelectNextTarget())
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
|
||||
selectionTimer += diff;
|
||||
if (selectionTimer >= 1000)
|
||||
{
|
||||
MySelectNextTarget();
|
||||
selectionTimer = 0;
|
||||
}
|
||||
selectionTimer += diff;
|
||||
if (selectionTimer >= 1000)
|
||||
{
|
||||
MySelectNextTarget();
|
||||
selectionTimer = 0;
|
||||
}
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
if (uint32 spellId = events.GetEvent())
|
||||
{
|
||||
events.RescheduleEvent(spellId, spellId == 59637 ? 6500 : 2500);
|
||||
me->CastSpell(me->GetVictim(), spellId, false);
|
||||
}
|
||||
}
|
||||
if (uint32 spellId = events.GetEvent())
|
||||
{
|
||||
events.RescheduleEvent(spellId, spellId == 59637 ? 6500 : 2500);
|
||||
me->CastSpell(me->GetVictim(), spellId, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
|
||||
@@ -30,7 +30,7 @@ enum PriestSpells
|
||||
{
|
||||
SPELL_PRIEST_GLYPH_OF_SHADOWFIEND = 58228,
|
||||
SPELL_PRIEST_GLYPH_OF_SHADOWFIEND_MANA = 58227,
|
||||
SPELL_PRIEST_SHADOWFIEND_DODGE = 8273,
|
||||
SPELL_PRIEST_SHADOWFIEND_DODGE = 8273,
|
||||
SPELL_PRIEST_LIGHTWELL_CHARGES = 59907
|
||||
};
|
||||
|
||||
@@ -43,19 +43,19 @@ class npc_pet_pri_lightwell : public CreatureScript
|
||||
{
|
||||
npc_pet_pri_lightwellAI(Creature* creature) : TotemAI(creature) { }
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
uint32 hp = uint32(owner->GetMaxHealth()*0.3f);
|
||||
me->SetMaxHealth(hp);
|
||||
me->SetHealth(hp);
|
||||
me->SetLevel(owner->getLevel());
|
||||
}
|
||||
void InitializeAI()
|
||||
{
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
uint32 hp = uint32(owner->GetMaxHealth()*0.3f);
|
||||
me->SetMaxHealth(hp);
|
||||
me->SetHealth(hp);
|
||||
me->SetLevel(owner->getLevel());
|
||||
}
|
||||
|
||||
me->CastSpell(me, SPELL_PRIEST_LIGHTWELL_CHARGES, false); // Spell for Lightwell Charges
|
||||
TotemAI::InitializeAI();
|
||||
}
|
||||
me->CastSpell(me, SPELL_PRIEST_LIGHTWELL_CHARGES, false); // Spell for Lightwell Charges
|
||||
TotemAI::InitializeAI();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
@@ -73,15 +73,15 @@ class npc_pet_pri_shadowfiend : public CreatureScript
|
||||
{
|
||||
npc_pet_pri_shadowfiendAI(Creature* creature) : PetAI(creature) { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
PetAI::Reset();
|
||||
if (!me->HasAura(SPELL_PRIEST_SHADOWFIEND_DODGE))
|
||||
me->AddAura(SPELL_PRIEST_SHADOWFIEND_DODGE, me);
|
||||
void Reset()
|
||||
{
|
||||
PetAI::Reset();
|
||||
if (!me->HasAura(SPELL_PRIEST_SHADOWFIEND_DODGE))
|
||||
me->AddAura(SPELL_PRIEST_SHADOWFIEND_DODGE, me);
|
||||
|
||||
if (Unit* target = me->SelectNearestTarget(15.0f))
|
||||
AttackStart(target);
|
||||
}
|
||||
if (Unit* target = me->SelectNearestTarget(15.0f))
|
||||
AttackStart(target);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
|
||||
@@ -57,22 +57,22 @@ class npc_pet_shaman_earth_elemental : public CreatureScript
|
||||
_events.ScheduleEvent(EVENT_SHAMAN_ANGEREDEARTH, 0);
|
||||
}
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
void InitializeAI()
|
||||
{
|
||||
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (_initAttack)
|
||||
{
|
||||
if (!me->IsInCombat())
|
||||
if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
if (Unit* target = owner->GetSelectedUnit())
|
||||
if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target))
|
||||
AttackStart(target);
|
||||
_initAttack = false;
|
||||
}
|
||||
if (_initAttack)
|
||||
{
|
||||
if (!me->IsInCombat())
|
||||
if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
if (Unit* target = owner->GetSelectedUnit())
|
||||
if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target))
|
||||
AttackStart(target);
|
||||
_initAttack = false;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
@@ -90,7 +90,7 @@ class npc_pet_shaman_earth_elemental : public CreatureScript
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
bool _initAttack;
|
||||
bool _initAttack;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
@@ -108,33 +108,33 @@ class npc_pet_shaman_fire_elemental : public CreatureScript
|
||||
{
|
||||
npc_pet_shaman_fire_elementalAI(Creature* creature) : ScriptedAI(creature), _initAttack(true) { }
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
void InitializeAI()
|
||||
{
|
||||
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit*)
|
||||
{
|
||||
void EnterCombat(Unit*)
|
||||
{
|
||||
_events.Reset();
|
||||
_events.ScheduleEvent(EVENT_SHAMAN_FIRENOVA, urand(5000, 20000));
|
||||
_events.ScheduleEvent(EVENT_SHAMAN_FIREBLAST, urand(5000, 20000));
|
||||
//_events.ScheduleEvent(EVENT_SHAMAN_FIRESHIELD, 0);
|
||||
|
||||
me->RemoveAurasDueToSpell(SPELL_SHAMAN_FIRESHIELD);
|
||||
me->CastSpell(me, SPELL_SHAMAN_FIRESHIELD, true);
|
||||
}
|
||||
me->RemoveAurasDueToSpell(SPELL_SHAMAN_FIRESHIELD);
|
||||
me->CastSpell(me, SPELL_SHAMAN_FIRESHIELD, true);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (_initAttack)
|
||||
{
|
||||
if (!me->IsInCombat())
|
||||
if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
if (Unit* target = owner->GetSelectedUnit())
|
||||
if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target))
|
||||
AttackStart(target);
|
||||
_initAttack = false;
|
||||
}
|
||||
if (_initAttack)
|
||||
{
|
||||
if (!me->IsInCombat())
|
||||
if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
if (Unit* target = owner->GetSelectedUnit())
|
||||
if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target))
|
||||
AttackStart(target);
|
||||
_initAttack = false;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
@@ -145,11 +145,11 @@ class npc_pet_shaman_fire_elemental : public CreatureScript
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SHAMAN_FIRENOVA:
|
||||
me->CastSpell(me, SPELL_SHAMAN_FIRENOVA, false);
|
||||
me->CastSpell(me, SPELL_SHAMAN_FIRENOVA, false);
|
||||
_events.ScheduleEvent(EVENT_SHAMAN_FIRENOVA, urand(8000, 15000));
|
||||
break;
|
||||
case EVENT_SHAMAN_FIREBLAST:
|
||||
me->CastSpell(me->GetVictim(), SPELL_SHAMAN_FIREBLAST, false);
|
||||
me->CastSpell(me->GetVictim(), SPELL_SHAMAN_FIREBLAST, false);
|
||||
_events.ScheduleEvent(EVENT_SHAMAN_FIREBLAST, urand(4000, 8000));
|
||||
break;
|
||||
default:
|
||||
@@ -162,7 +162,7 @@ class npc_pet_shaman_fire_elemental : public CreatureScript
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
bool _initAttack;
|
||||
bool _initAttack;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
|
||||
Reference in New Issue
Block a user