Skip to content

Instantly share code, notes, and snippets.

@ReyDonovan
Created December 28, 2018 16:35
Show Gist options
  • Save ReyDonovan/1ff541710a871d2f89398599249d5e3f to your computer and use it in GitHub Desktop.
Save ReyDonovan/1ff541710a871d2f89398599249d5e3f to your computer and use it in GitHub Desktop.
conver
using Framework.Constants;
using Framework.GameMath;
using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using Game.Spells;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Scripts.EasternKingdoms.GrimBatol
{
namespace GeneralUmbiss
{
struct SpellIds
{
// General Umbriss
public const uint SpellBleedingWound = 74846;
public const uint SpellBlitzSummonTrigger = 74668;
public const uint SpellBlitz = 74670;
public const uint SpellGroundSiegeSummonTrigger = 74640;
public const uint SpellGroundSiege = 74634;
public const uint SpellSummonSkardyn = 74859;
public const uint SpellFrenzy = 74853;
// Troggs
public const uint SpellModgudsMalady = 74837;
public const uint SpellModgudsMaliceSpread = 90170;
}
struct TextIds
{
public const uint SayBombardment = 0;
public const uint SayAggro = 1;
public const uint SaySummonSkardyn = 2;
public const uint SaySlay = 3;
public const uint SayAnnounceBlitz = 4;
public const uint SayAnnounceGroundSiege = 5;
public const uint SayAnnounceFrenzy = 6;
}
struct Events
{
// General Husam
public const uint EventBleedingWound = 1;
public const uint EventBlitz = 2;
public const uint EventGroundSiege = 3;
public const uint EventSummonSkardyn = 4;
}
struct MovementPoints
{
public const uint PointSkardynSummon = 1;
};
struct GeneralUmbissMisc
{
public static Position MalignantTroggSummonPosition = new Position(-705.4689f, -485.3758f, 281.0951f, 1.265874f);
public static Position MalignantTroggMovePosition = new Position(-691.993f, -456.1111f, 268.7674f);
public static Position[] TroggDwellerSummonPositions =
{
new Position(-723.0738f, -488.2023f, 292.2519f, 1.432476f),
new Position(-749.5168f, -469.0633f, 309.0818f, 0.5629198f),
new Position(-697.3342f, -486.9066f, 281.0173f, 1.33856f),
};
public static Position[] TroggDwellerMovePositions =
{
new Position(-718.5313f, -443.1129f, 268.7674f),
new Position(-729.0295f, -443.5573f, 268.7674f),
new Position(-693.0521f, -458.2517f, 268.7674f),
};
}
[Script]
class boss_general_umbriss : BossAI
{
public boss_general_umbriss(Creature creature) : base(creature, GBDataTypes.GeneralUmbriss)
{
_frenzyCasted = false;
}
public override void Reset()
{
_Reset();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(TextIds.SayAggro);
instance.SendEncounterUnit(EncounterFrameType.Engage, me);
_events.ScheduleEvent(Events.EventSummonSkardyn, TimeSpan.FromSeconds(6));
_events.ScheduleEvent(Events.EventBleedingWound, TimeSpan.FromSeconds(11));
_events.ScheduleEvent(Events.EventGroundSiege, TimeSpan.FromSeconds(25) + TimeSpan.FromSeconds(0.5));
_events.ScheduleEvent(Events.EventBlitz, TimeSpan.FromSeconds(16));
}
public override void KilledUnit(Unit victim)
{
if (victim.IsTypeId(TypeId.Player))
{
Talk(TextIds.SaySlay);
}
}
public override void JustDied(Unit who)
{
summons.DespawnAll();
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
}
public override void EnterEvadeMode(EvadeReason why)
{
summons.DespawnAll();
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
_DespawnAtEvade();
}
public override void JustSummoned(Creature summon)
{
summons.Summon(summon);
switch (summon.GetEntry())
{
case GBCreatureIds.NpcBlitzStalker:
me.StopMoving();
me.SetFacingToObject(summon);
DoCast(summon, SpellIds.SpellBlitz);
break;
case GBCreatureIds.GroundSiegeStalker:
me.StopMoving();
me.SetFacingToObject(summon);
DoCast(summon, SpellIds.SpellGroundSiege);
Talk(TextIds.SayAnnounceGroundSiege);
break;
default:
break;
}
}
public override void DamageTaken(Unit who, ref uint damage)
{
if (me.HealthBelowPct(30) && !_frenzyCasted && !me.HasAura(SpellIds.SpellFrenzy))
{
_frenzyCasted = true;
DoCastSelf(SpellIds.SpellFrenzy, true);
}
}
public override void SpellHit(Unit caster, SpellInfo spell)
{
if (spell.Id == SpellIds.SpellFrenzy)
Talk(TextIds.SayAnnounceFrenzy);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Events.EventBleedingWound:
DoCastVictim(SpellIds.SpellBleedingWound, true);
_events.Repeat(TimeSpan.FromSeconds(10) + TimeSpan.FromSeconds(0.5));
break;
case Events.EventBlitz:
DoCastAOE(SpellIds.SpellBlitzSummonTrigger, true);
_events.Repeat(TimeSpan.FromSeconds(23));
break;
case Events.EventGroundSiege:
DoCastAOE(SpellIds.SpellGroundSiegeSummonTrigger, true);
break;
case Events.EventSummonSkardyn:
Talk(TextIds.SaySummonSkardyn);
DoCastAOE(SpellIds.SpellSummonSkardyn);
Creature malignantTrogg = DoSummon(GBCreatureIds.MalignantTrogg, GeneralUmbissMisc.MalignantTroggSummonPosition, 5000);
if (malignantTrogg)
malignantTrogg.GetMotionMaster().MovePoint(MovementPoints.PointSkardynSummon, GeneralUmbissMisc.MalignantTroggMovePosition, false);
for (uint i = 0; i < 3; i++)
{
Creature troggDweller = DoSummon(GBCreatureIds.TroggDweller, GeneralUmbissMisc.TroggDwellerSummonPositions[i], 5000);
if (troggDweller)
troggDweller.GetMotionMaster().MovePoint(MovementPoints.PointSkardynSummon, GeneralUmbissMisc.TroggDwellerMovePositions[i], false);
}
break;
default:
break;
}
});
DoMeleeAttackIfReady();
}
bool _frenzyCasted;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment