mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 08:00:48 +01:00
Core/Script: Fix some codestyle and warnings
This commit is contained in:
@@ -31,7 +31,7 @@ enum Spells
|
||||
SPELL_REJOIN_VISCIDUS = 25896,
|
||||
SPELL_VISCIDUS_EXPLODE = 25938,
|
||||
SPELL_VISCIDUS_SUICIDE = 26003,
|
||||
|
||||
|
||||
SPELL_MEMBRANE_VISCIDUS = 25994, // damage reduction spell - removed from DBC
|
||||
SPELL_VISCIDUS_WEAKNESS = 25926, // aura which procs at damage - should trigger the slow spells - removed from DBC
|
||||
SPELL_VISCIDUS_SHRINKS = 25893, // (6) Apply Aura #61: Mod Scale Value: -4 - removed from DBC
|
||||
@@ -41,7 +41,7 @@ enum Spells
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
{
|
||||
EVENT_POISONBOLT_VOLLEY = 1,
|
||||
EVENT_POISON_SHOCK = 2,
|
||||
EVENT_RESET_PHASE = 3
|
||||
@@ -56,14 +56,14 @@ enum Phases
|
||||
|
||||
enum HitCounter
|
||||
{
|
||||
HITCOUNTER_SLOW = 100, // "Viscidus begins to slow."
|
||||
HITCOUNTER_SLOW_MORE = 150, // "Viscidus begins to freeze."
|
||||
HITCOUNTER_FREEZE = 200, // "Viscidus is frozen solid."
|
||||
HITCOUNTER_SLOW = 100, // "Viscidus begins to slow."
|
||||
HITCOUNTER_SLOW_MORE = 150, // "Viscidus begins to freeze."
|
||||
HITCOUNTER_FREEZE = 200, // "Viscidus is frozen solid."
|
||||
|
||||
// 4.3.4 data
|
||||
HITCOUNTER_CRACK = 50, // "Viscidus begins to crack."
|
||||
HITCOUNTER_SHATTER = 100, // "Viscidus looks ready to shatter."
|
||||
HITCOUNTER_EXPLODE = 150, // "Viscidus explodes."
|
||||
HITCOUNTER_CRACK = 50, // "Viscidus begins to crack."
|
||||
HITCOUNTER_SHATTER = 100, // "Viscidus looks ready to shatter."
|
||||
HITCOUNTER_EXPLODE = 150, // "Viscidus explodes."
|
||||
|
||||
// 1.12 data
|
||||
// HITCOUNTER_EXPLODE = 75
|
||||
@@ -84,72 +84,68 @@ class boss_viscidus : public CreatureScript
|
||||
|
||||
struct boss_viscidusAI : public BossAI
|
||||
{
|
||||
boss_viscidusAI(Creature* creature) : BossAI(creature, DATA_VISCIDUS)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
uint8 Hitcounter;
|
||||
uint8 Phase;
|
||||
boss_viscidusAI(Creature* creature) : BossAI(creature, DATA_VISCIDUS) { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
_Reset();
|
||||
Hitcounter = 0;
|
||||
Phase = PHASE_FROST;
|
||||
_hitcounter = 0;
|
||||
_phase = PHASE_FROST;
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* attacker, uint32& damage)
|
||||
{
|
||||
if (Phase != PHASE_MELEE)
|
||||
void DamageTaken(Unit* attacker, uint32& /*damage*/)
|
||||
{
|
||||
if (_phase != PHASE_MELEE)
|
||||
return;
|
||||
|
||||
++Hitcounter;
|
||||
|
||||
if (attacker->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && Hitcounter >= HITCOUNTER_EXPLODE)
|
||||
|
||||
++_hitcounter;
|
||||
|
||||
if (attacker->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && _hitcounter >= HITCOUNTER_EXPLODE)
|
||||
{
|
||||
events.Reset();
|
||||
Phase = PHASE_GLOB;
|
||||
_phase = PHASE_GLOB;
|
||||
DoCast(me, SPELL_VISCIDUS_EXPLODE);
|
||||
me->SetVisible(false);
|
||||
me->RemoveAura(SPELL_TOXIN);
|
||||
me->RemoveAura(SPELL_VISCIDUS_FREEZE);
|
||||
|
||||
uint8 NumGlobes = me->GetHealthPct() / 5;
|
||||
uint8 NumGlobes = me->GetHealthPct() / 5.0f;
|
||||
for (uint8 i = 0; i < NumGlobes; ++i)
|
||||
{
|
||||
float Angle = i * 2 * PI / NumGlobes;
|
||||
float Angle = i * 2 * M_PI / NumGlobes;
|
||||
float X = ViscidusCoord.GetPositionX() + std::cos(Angle) * RoomRadius;
|
||||
float Y = ViscidusCoord.GetPositionY() + std::sin(Angle) * RoomRadius;
|
||||
float Z = -35;
|
||||
float Z = -35.0f;
|
||||
|
||||
TempSummon* Glob = me->SummonCreature(NPC_GLOB_OF_VISCIDUS, X, Y, Z);
|
||||
Glob->UpdateAllowedPositionZ(X, Y, Z);
|
||||
Glob->NearTeleportTo(X, Y, Z, 0);
|
||||
Glob->GetMotionMaster()->MovePoint(ROOM_CENTER, ViscidusCoord);
|
||||
if (TempSummon* Glob = me->SummonCreature(NPC_GLOB_OF_VISCIDUS, X, Y, Z))
|
||||
{
|
||||
Glob->UpdateAllowedPositionZ(X, Y, Z);
|
||||
Glob->NearTeleportTo(X, Y, Z, 0.0f);
|
||||
Glob->GetMotionMaster()->MovePoint(ROOM_CENTER, ViscidusCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
|
||||
{
|
||||
if ((spell->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && Phase == PHASE_FROST && me->GetHealthPct() > 5)
|
||||
if ((spell->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && _phase == PHASE_FROST && me->GetHealthPct() > 5.0f)
|
||||
{
|
||||
++Hitcounter;
|
||||
++_hitcounter;
|
||||
|
||||
if (Hitcounter >= HITCOUNTER_FREEZE)
|
||||
if (_hitcounter >= HITCOUNTER_FREEZE)
|
||||
{
|
||||
Phase = PHASE_MELEE;
|
||||
_phase = PHASE_MELEE;
|
||||
DoCast(me, SPELL_VISCIDUS_FREEZE);
|
||||
me->RemoveAura(SPELL_VISCIDUS_SLOWED_MORE);
|
||||
events.ScheduleEvent(EVENT_RESET_PHASE, 15000);
|
||||
}
|
||||
else if (Hitcounter >= HITCOUNTER_SLOW_MORE)
|
||||
else if (_hitcounter >= HITCOUNTER_SLOW_MORE)
|
||||
{
|
||||
me->RemoveAura(SPELL_VISCIDUS_SLOWED);
|
||||
DoCast(me, SPELL_VISCIDUS_SLOWED_MORE);
|
||||
}
|
||||
else if (Hitcounter >= HITCOUNTER_SLOW)
|
||||
else if (_hitcounter >= HITCOUNTER_SLOW)
|
||||
DoCast(me, SPELL_VISCIDUS_SLOWED);
|
||||
}
|
||||
}
|
||||
@@ -160,7 +156,7 @@ class boss_viscidus : public CreatureScript
|
||||
events.Reset();
|
||||
InitSpells();
|
||||
}
|
||||
|
||||
|
||||
void InitSpells()
|
||||
{
|
||||
DoCast(me, SPELL_TOXIN);
|
||||
@@ -173,61 +169,66 @@ class boss_viscidus : public CreatureScript
|
||||
summons.DespawnAll();
|
||||
ScriptedAI::EnterEvadeMode();
|
||||
}
|
||||
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
DoCast(me, SPELL_VISCIDUS_SUICIDE);
|
||||
summons.DespawnAll();
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (Phase == PHASE_GLOB && summons.empty())
|
||||
|
||||
if (_phase == PHASE_GLOB && summons.empty())
|
||||
{
|
||||
me->NearTeleportTo(ViscidusCoord.GetPositionX(),
|
||||
ViscidusCoord.GetPositionY(),
|
||||
ViscidusCoord.GetPositionZ(),
|
||||
ViscidusCoord.GetOrientation());
|
||||
Hitcounter = 0;
|
||||
Phase = PHASE_FROST;
|
||||
ViscidusCoord.GetPositionY(),
|
||||
ViscidusCoord.GetPositionZ(),
|
||||
ViscidusCoord.GetOrientation());
|
||||
|
||||
_hitcounter = 0;
|
||||
_phase = PHASE_FROST;
|
||||
InitSpells();
|
||||
me->SetVisible(true);
|
||||
}
|
||||
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_POISONBOLT_VOLLEY:
|
||||
DoCast(me, SPELL_POISONBOLT_VOLLEY);
|
||||
events.ScheduleEvent(EVENT_POISONBOLT_VOLLEY, urand(10000, 15000));
|
||||
break;
|
||||
case EVENT_POISON_SHOCK:
|
||||
DoCast(me, SPELL_POISON_SHOCK);
|
||||
events.ScheduleEvent(EVENT_POISON_SHOCK, urand(7000, 12000));
|
||||
break;
|
||||
case EVENT_RESET_PHASE:
|
||||
Hitcounter = 0;
|
||||
Phase = PHASE_FROST;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case EVENT_POISONBOLT_VOLLEY:
|
||||
DoCast(me, SPELL_POISONBOLT_VOLLEY);
|
||||
events.ScheduleEvent(EVENT_POISONBOLT_VOLLEY, urand(10000, 15000));
|
||||
break;
|
||||
case EVENT_POISON_SHOCK:
|
||||
DoCast(me, SPELL_POISON_SHOCK);
|
||||
events.ScheduleEvent(EVENT_POISON_SHOCK, urand(7000, 12000));
|
||||
break;
|
||||
case EVENT_RESET_PHASE:
|
||||
_hitcounter = 0;
|
||||
_phase = PHASE_FROST;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Phase != PHASE_GLOB)
|
||||
if (_phase != PHASE_GLOB)
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
uint8 _hitcounter;
|
||||
Phases _phase;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new boss_viscidusAI (creature);
|
||||
return new boss_viscidusAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -238,23 +239,20 @@ class npc_glob_of_viscidus : public CreatureScript
|
||||
|
||||
struct npc_glob_of_viscidusAI : public ScriptedAI
|
||||
{
|
||||
npc_glob_of_viscidusAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
}
|
||||
npc_glob_of_viscidusAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
InstanceScript* Instance = me->GetInstanceScript();
|
||||
|
||||
if (!Instance)
|
||||
return;
|
||||
|
||||
|
||||
if (Creature* Viscidus = me->GetMap()->GetCreature(Instance->GetData64(DATA_VISCIDUS)))
|
||||
{
|
||||
if (BossAI* ViscidusAI = dynamic_cast<BossAI*>(Viscidus->GetAI()))
|
||||
ViscidusAI->SummonedCreatureDespawn(me);
|
||||
|
||||
if (Viscidus->isAlive() && Viscidus->GetHealthPct() < 5)
|
||||
|
||||
if (Viscidus->isAlive() && Viscidus->GetHealthPct() < 5.0f)
|
||||
{
|
||||
Viscidus->SetVisible(true);
|
||||
Viscidus->getVictim()->Kill(Viscidus);
|
||||
@@ -279,7 +277,7 @@ class npc_glob_of_viscidus : public CreatureScript
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_glob_of_viscidusAI (creature);
|
||||
return new npc_glob_of_viscidusAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -49,18 +49,15 @@ enum Creatures
|
||||
MOB_GIANT_EYE_TENTACLE = 15334,
|
||||
MOB_FLESH_TENTACLE = 15802,
|
||||
MOB_GIANT_PORTAL = 15910,
|
||||
|
||||
|
||||
NPC_VISCIDUS = 15299,
|
||||
NPC_GLOB_OF_VISCIDUS = 15667,
|
||||
|
||||
|
||||
NPC_SKERAM = 15263,
|
||||
NPC_VEM = 15544,
|
||||
NPC_KRI = 15511,
|
||||
NPC_VEKLOR = 15276,
|
||||
NPC_VEKNILASH = 15275
|
||||
};
|
||||
|
||||
#define PI 3.14
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user