/// <summary> /// Fired when the game updates. /// </summary> /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param> private static void Game_OnGameUpdate(EventArgs args) { // Remove heros that have finished casting their interruptable spell HeroManager.AllHeroes.ForEach( hero => { if (CastingInterruptableSpell.ContainsKey(hero.NetworkId) && !hero.Spellbook.IsCastingSpell && !hero.Spellbook.IsChanneling && !hero.Spellbook.IsCharging) { CastingInterruptableSpell.Remove(hero.NetworkId); } }); // Trigger OnInterruptableTarget event if needed if (OnInterruptableTarget != null) { HeroManager.Enemies.ForEach( enemy => { var newArgs = GetInterruptableTargetData(enemy); if (newArgs != null) { OnInterruptableTarget(enemy, newArgs); } }); } }
/// <summary> /// Fired when the spellbook stops a cast. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="SpellbookStopCastEventArgs" /> instance containing the event data.</param> private static void Spellbook_OnStopCast(Spellbook sender, SpellbookStopCastEventArgs args) { var target = sender.Owner as Obj_AI_Hero; if (target != null) { // Check if the spell itself stopped casting (interrupted) if (!target.Spellbook.IsCastingSpell && !target.Spellbook.IsChanneling && !target.Spellbook.IsCharging) { CastingInterruptableSpell.Remove(target.NetworkId); } } }