mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 20:13:48 +00:00
refactor(Core/Scripts): restyle scripts lib with astyle (#3467)
This commit is contained in:
@@ -68,76 +68,76 @@ SpellPair const _auraPairs[MAX_SPELL_PAIRS] =
|
||||
|
||||
class npc_av_marshal_or_warmaster : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_av_marshal_or_warmaster() : CreatureScript("npc_av_marshal_or_warmaster") { }
|
||||
public:
|
||||
npc_av_marshal_or_warmaster() : CreatureScript("npc_av_marshal_or_warmaster") { }
|
||||
|
||||
struct npc_av_marshal_or_warmasterAI : public ScriptedAI
|
||||
struct npc_av_marshal_or_warmasterAI : public ScriptedAI
|
||||
{
|
||||
npc_av_marshal_or_warmasterAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
npc_av_marshal_or_warmasterAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_CHARGE_TARGET, urand(2 * IN_MILLISECONDS, 12 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_CLEAVE, urand(1 * IN_MILLISECONDS, 11 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, 2000);
|
||||
events.ScheduleEvent(EVENT_WHIRLWIND, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_ENRAGE, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
|
||||
|
||||
void Reset()
|
||||
_hasAura = false;
|
||||
}
|
||||
|
||||
void JustRespawned()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
// I have a feeling this isn't blizzlike, but owell, I'm only passing by and cleaning up.
|
||||
if (!_hasAura)
|
||||
{
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_CHARGE_TARGET, urand(2 * IN_MILLISECONDS, 12 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_CLEAVE, urand(1 * IN_MILLISECONDS, 11 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, 2000);
|
||||
events.ScheduleEvent(EVENT_WHIRLWIND, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_ENRAGE, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS));
|
||||
events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
|
||||
for (uint8 i = 0; i < MAX_SPELL_PAIRS; ++i)
|
||||
if (_auraPairs[i].npcEntry == me->GetEntry())
|
||||
DoCast(me, _auraPairs[i].spellId);
|
||||
|
||||
_hasAura = false;
|
||||
_hasAura = true;
|
||||
}
|
||||
|
||||
void JustRespawned()
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
// I have a feeling this isn't blizzlike, but owell, I'm only passing by and cleaning up.
|
||||
if (!_hasAura)
|
||||
switch (eventId)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_SPELL_PAIRS; ++i)
|
||||
if (_auraPairs[i].npcEntry == me->GetEntry())
|
||||
DoCast(me, _auraPairs[i].spellId);
|
||||
|
||||
_hasAura = true;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_CHARGE_TARGET:
|
||||
DoCastVictim(SPELL_CHARGE);
|
||||
events.ScheduleEvent(EVENT_CHARGE, urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_CLEAVE:
|
||||
DoCastVictim(SPELL_CLEAVE);
|
||||
events.ScheduleEvent(EVENT_CLEAVE, urand(10 * IN_MILLISECONDS, 16 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_DEMORALIZING_SHOUT:
|
||||
DoCast(me, SPELL_DEMORALIZING_SHOUT);
|
||||
events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_WHIRLWIND:
|
||||
DoCast(me, SPELL_WHIRLWIND);
|
||||
events.ScheduleEvent(EVENT_WHIRLWIND, urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_ENRAGE:
|
||||
DoCast(me, SPELL_ENRAGE);
|
||||
events.ScheduleEvent(EVENT_ENRAGE, urand(10 * IN_MILLISECONDS, 30 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_CHECK_RESET:
|
||||
case EVENT_CHARGE_TARGET:
|
||||
DoCastVictim(SPELL_CHARGE);
|
||||
events.ScheduleEvent(EVENT_CHARGE, urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_CLEAVE:
|
||||
DoCastVictim(SPELL_CLEAVE);
|
||||
events.ScheduleEvent(EVENT_CLEAVE, urand(10 * IN_MILLISECONDS, 16 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_DEMORALIZING_SHOUT:
|
||||
DoCast(me, SPELL_DEMORALIZING_SHOUT);
|
||||
events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_WHIRLWIND:
|
||||
DoCast(me, SPELL_WHIRLWIND);
|
||||
events.ScheduleEvent(EVENT_WHIRLWIND, urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_ENRAGE:
|
||||
DoCast(me, SPELL_ENRAGE);
|
||||
events.ScheduleEvent(EVENT_ENRAGE, urand(10 * IN_MILLISECONDS, 30 * IN_MILLISECONDS));
|
||||
break;
|
||||
case EVENT_CHECK_RESET:
|
||||
{
|
||||
Position const& _homePosition = me->GetHomePosition();
|
||||
if (me->GetDistance2d(_homePosition.GetPositionX(), _homePosition.GetPositionY()) > 50.0f)
|
||||
@@ -148,21 +148,21 @@ class npc_av_marshal_or_warmaster : public CreatureScript
|
||||
events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap events;
|
||||
bool _hasAura;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_av_marshal_or_warmasterAI(creature);
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap events;
|
||||
bool _hasAura;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_av_marshal_or_warmasterAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_alterac_valley()
|
||||
|
||||
@@ -61,7 +61,8 @@ public:
|
||||
{
|
||||
DoCastVictim(SPELL_WATERBOLT);
|
||||
waterBoltTimer = 5 * IN_MILLISECONDS;
|
||||
} else waterBoltTimer -= diff;
|
||||
}
|
||||
else waterBoltTimer -= diff;
|
||||
|
||||
// check if creature is not outside of building
|
||||
if (resetTimer < diff)
|
||||
@@ -70,7 +71,8 @@ public:
|
||||
if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
|
||||
EnterEvadeMode();
|
||||
resetTimer = 5 * IN_MILLISECONDS;
|
||||
} else resetTimer -= diff;
|
||||
}
|
||||
else resetTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
@@ -145,31 +147,36 @@ public:
|
||||
if (summons.empty())
|
||||
me->SummonCreature(NPC_WATER_ELEMENTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45 * IN_MILLISECONDS);
|
||||
waterElementalTimer = 50 * IN_MILLISECONDS;
|
||||
} else waterElementalTimer -= diff;
|
||||
}
|
||||
else waterElementalTimer -= diff;
|
||||
|
||||
if (arcaneExplosionTimer < diff)
|
||||
{
|
||||
DoCastVictim(SPELL_ARCANE_EXPLOSION);
|
||||
arcaneExplosionTimer = urand(5 * IN_MILLISECONDS, 15 * IN_MILLISECONDS);
|
||||
} else arcaneExplosionTimer -= diff;
|
||||
}
|
||||
else arcaneExplosionTimer -= diff;
|
||||
|
||||
if (coneOfColdTimer < diff)
|
||||
{
|
||||
DoCastVictim(SPELL_CONE_OF_COLD);
|
||||
coneOfColdTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
|
||||
} else coneOfColdTimer -= diff;
|
||||
}
|
||||
else coneOfColdTimer -= diff;
|
||||
|
||||
if (fireBoltTimer < diff)
|
||||
{
|
||||
DoCastVictim(SPELL_FIREBALL);
|
||||
fireBoltTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS);
|
||||
} else fireBoltTimer -= diff;
|
||||
}
|
||||
else fireBoltTimer -= diff;
|
||||
|
||||
if (frostboltTimer < diff)
|
||||
{
|
||||
DoCastVictim(SPELL_FROSTBOLT);
|
||||
frostboltTimer = urand(4 * IN_MILLISECONDS, 12 * IN_MILLISECONDS);
|
||||
} else frostboltTimer -= diff;
|
||||
}
|
||||
else frostboltTimer -= diff;
|
||||
|
||||
// check if creature is not outside of building
|
||||
if (resetTimer < diff)
|
||||
@@ -180,7 +187,8 @@ public:
|
||||
Talk(YELL_EVADE);
|
||||
}
|
||||
resetTimer = 5 * IN_MILLISECONDS;
|
||||
} else resetTimer -= diff;
|
||||
}
|
||||
else resetTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
@@ -73,31 +73,36 @@ public:
|
||||
{
|
||||
DoCastVictim(SPELL_WHIRLWIND);
|
||||
WhirlwindTimer = urand(8 * IN_MILLISECONDS, 18 * IN_MILLISECONDS);
|
||||
} else WhirlwindTimer -= diff;
|
||||
}
|
||||
else WhirlwindTimer -= diff;
|
||||
|
||||
if (Whirlwind2Timer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_WHIRLWIND2);
|
||||
Whirlwind2Timer = urand(7 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
|
||||
} else Whirlwind2Timer -= diff;
|
||||
}
|
||||
else Whirlwind2Timer -= diff;
|
||||
|
||||
if (KnockdownTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_KNOCKDOWN);
|
||||
KnockdownTimer = urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS);
|
||||
} else KnockdownTimer -= diff;
|
||||
}
|
||||
else KnockdownTimer -= diff;
|
||||
|
||||
if (FrenzyTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_FRENZY);
|
||||
FrenzyTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS);
|
||||
} else FrenzyTimer -= diff;
|
||||
}
|
||||
else FrenzyTimer -= diff;
|
||||
|
||||
if (YellTimer <= diff)
|
||||
{
|
||||
Talk(YELL_RANDOM);
|
||||
YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); //20 to 30 seconds
|
||||
} else YellTimer -= diff;
|
||||
}
|
||||
else YellTimer -= diff;
|
||||
|
||||
// check if creature is not outside of building
|
||||
if (ResetTimer <= diff)
|
||||
@@ -108,7 +113,8 @@ public:
|
||||
Talk(YELL_EVADE);
|
||||
}
|
||||
ResetTimer = 5 * IN_MILLISECONDS;
|
||||
} else ResetTimer -= diff;
|
||||
}
|
||||
else ResetTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
@@ -67,31 +67,36 @@ public:
|
||||
{
|
||||
DoCastVictim(SPELL_CLEAVE);
|
||||
CleaveTimer = urand(10 * IN_MILLISECONDS, 16 * IN_MILLISECONDS);
|
||||
} else CleaveTimer -= diff;
|
||||
}
|
||||
else CleaveTimer -= diff;
|
||||
|
||||
if (FrighteningShoutTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_FRIGHTENING_SHOUT);
|
||||
FrighteningShoutTimer = urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS);
|
||||
} else FrighteningShoutTimer -= diff;
|
||||
}
|
||||
else FrighteningShoutTimer -= diff;
|
||||
|
||||
if (Whirlwind1Timer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_WHIRLWIND1);
|
||||
Whirlwind1Timer = urand(6 * IN_MILLISECONDS, 10 * IN_MILLISECONDS);
|
||||
} else Whirlwind1Timer -= diff;
|
||||
}
|
||||
else Whirlwind1Timer -= diff;
|
||||
|
||||
if (Whirlwind2Timer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_WHIRLWIND2);
|
||||
Whirlwind2Timer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
|
||||
} else Whirlwind2Timer -= diff;
|
||||
}
|
||||
else Whirlwind2Timer -= diff;
|
||||
|
||||
if (MortalStrikeTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_MORTAL_STRIKE);
|
||||
MortalStrikeTimer = urand(10 * IN_MILLISECONDS, 30 * IN_MILLISECONDS);
|
||||
} else MortalStrikeTimer -= diff;
|
||||
}
|
||||
else MortalStrikeTimer -= diff;
|
||||
|
||||
// check if creature is not outside of building
|
||||
if (ResetTimer <= diff)
|
||||
@@ -102,7 +107,8 @@ public:
|
||||
Talk(YELL_EVADE);
|
||||
}
|
||||
ResetTimer = 5 * IN_MILLISECONDS;
|
||||
} else ResetTimer -= diff;
|
||||
}
|
||||
else ResetTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ enum Yells
|
||||
{
|
||||
YELL_AGGRO = 0,
|
||||
YELL_EVADE = 1,
|
||||
//YELL_RESPAWN1 = -1810010, // Missing in database
|
||||
//YELL_RESPAWN2 = -1810011, // Missing in database
|
||||
//YELL_RESPAWN1 = -1810010, // Missing in database
|
||||
//YELL_RESPAWN2 = -1810011, // Missing in database
|
||||
YELL_RANDOM = 2,
|
||||
YELL_SPELL = 3,
|
||||
};
|
||||
@@ -62,25 +62,29 @@ public:
|
||||
{
|
||||
DoCastVictim(SPELL_AVATAR);
|
||||
AvatarTimer = urand(15 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
|
||||
} else AvatarTimer -= diff;
|
||||
}
|
||||
else AvatarTimer -= diff;
|
||||
|
||||
if (ThunderclapTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_THUNDERCLAP);
|
||||
ThunderclapTimer = urand(5 * IN_MILLISECONDS, 15 * IN_MILLISECONDS);
|
||||
} else ThunderclapTimer -= diff;
|
||||
}
|
||||
else ThunderclapTimer -= diff;
|
||||
|
||||
if (StormboltTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_STORMBOLT);
|
||||
StormboltTimer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
|
||||
} else StormboltTimer -= diff;
|
||||
}
|
||||
else StormboltTimer -= diff;
|
||||
|
||||
if (YellTimer <= diff)
|
||||
{
|
||||
Talk(YELL_RANDOM);
|
||||
YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); //20 to 30 seconds
|
||||
} else YellTimer -= diff;
|
||||
}
|
||||
else YellTimer -= diff;
|
||||
|
||||
// check if creature is not outside of building
|
||||
if (ResetTimer <= diff)
|
||||
@@ -91,7 +95,8 @@ public:
|
||||
Talk(YELL_EVADE);
|
||||
}
|
||||
ResetTimer = 5 * IN_MILLISECONDS;
|
||||
} else ResetTimer -= diff;
|
||||
}
|
||||
else ResetTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user