Start adding missing scripts Part 7
This commit is contained in:
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* 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 3 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/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
|
||||
namespace Scripts.EasternKingdoms.MagistersTerrace.Vexallus
|
||||
{
|
||||
struct TextIds
|
||||
{
|
||||
public const uint SayAggro = 0;
|
||||
public const uint SayEnergy = 1;
|
||||
public const uint SayOverload = 2;
|
||||
public const uint SayKill = 3;
|
||||
public const uint EmoteDischargeEnergy = 4;
|
||||
}
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint ChainLightning = 44318;
|
||||
public const uint Overload = 44353;
|
||||
public const uint ArcaneShock = 44319;
|
||||
|
||||
public const uint SummonPureEnergy = 44322; // mod scale -10
|
||||
public const uint HSummonPureEnergy1 = 46154; // mod scale -5
|
||||
public const uint HSummonPureEnergy2 = 46159; // mod scale -5
|
||||
|
||||
// NpcPureEnergy
|
||||
public const uint EnergyBolt = 46156;
|
||||
public const uint EnergyFeedback = 44335;
|
||||
public const uint PureEnergyPassive = 44326;
|
||||
}
|
||||
|
||||
struct MiscConst
|
||||
{
|
||||
public const uint IntervalModifier = 15;
|
||||
public const uint IntervalSwitch = 6;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_vexallus : BossAI
|
||||
{
|
||||
uint _intervalHealthAmount;
|
||||
bool _enraged;
|
||||
|
||||
public boss_vexallus(Creature creature) : base(creature, DataTypes.Vexallus)
|
||||
{
|
||||
_intervalHealthAmount = 1;
|
||||
_enraged = false;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
_intervalHealthAmount = 1;
|
||||
_enraged = false;
|
||||
}
|
||||
|
||||
public override void KilledUnit(Unit victim)
|
||||
{
|
||||
Talk(TextIds.SayKill);
|
||||
}
|
||||
|
||||
public override void JustEngagedWith(Unit who)
|
||||
{
|
||||
Talk(TextIds.SayAggro);
|
||||
base.JustEngagedWith(who);
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
DoCast(target, SpellIds.ChainLightning);
|
||||
task.Repeat();
|
||||
});
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 20.0f, true);
|
||||
if (target)
|
||||
DoCast(target, SpellIds.ArcaneShock);
|
||||
task.Repeat(TimeSpan.FromSeconds(8));
|
||||
});
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summoned)
|
||||
{
|
||||
Unit temp = SelectTarget(SelectTargetMethod.Random, 0);
|
||||
if (temp)
|
||||
summoned.GetMotionMaster().MoveFollow(temp, 0, 0);
|
||||
|
||||
summons.Summon(summoned);
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit who, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
|
||||
{
|
||||
if (_enraged)
|
||||
return;
|
||||
|
||||
// 85%, 70%, 55%, 40%, 25%
|
||||
if (!HealthAbovePct((int)(100 - MiscConst.IntervalModifier * _intervalHealthAmount)))
|
||||
{
|
||||
// increase amount, unless we're at 10%, then we switch and return
|
||||
if (_intervalHealthAmount == MiscConst.IntervalSwitch)
|
||||
{
|
||||
_enraged = true;
|
||||
_scheduler.CancelAll();
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(1.2), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.Overload);
|
||||
task.Repeat(TimeSpan.FromSeconds(2));
|
||||
});
|
||||
return;
|
||||
}
|
||||
else
|
||||
++_intervalHealthAmount;
|
||||
|
||||
Talk(TextIds.SayEnergy);
|
||||
Talk(TextIds.EmoteDischargeEnergy);
|
||||
|
||||
if (IsHeroic())
|
||||
{
|
||||
DoCast(me, SpellIds.HSummonPureEnergy1);
|
||||
DoCast(me, SpellIds.HSummonPureEnergy2);
|
||||
}
|
||||
else
|
||||
DoCast(me, SpellIds.SummonPureEnergy);
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_pure_energy : ScriptedAI
|
||||
{
|
||||
public npc_pure_energy(Creature creature) : base(creature)
|
||||
{
|
||||
me.SetDisplayFromModel(1);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
if (killer)
|
||||
killer.CastSpell(killer, SpellIds.EnergyFeedback, true);
|
||||
me.RemoveAurasDueToSpell(SpellIds.PureEnergyPassive);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user