/// <summary> /// Method to launch a spell /// </summary> /// <param name="spellLevel">The spell level</param> /// <param name="spellLineName">The spell line</param> /// <param name="guard">The guard caster</param> public static void LaunchSpell(int spellLevel, string spellLineName, GameNPC caster) { if (caster.TargetObject == null) return; Spell castSpell = null; SpellLine castLine = null; castLine = SkillBase.GetSpellLine(spellLineName); List<Spell> spells = SkillBase.GetSpellList(castLine.KeyName); foreach (Spell spell in spells) { if (spell.Level == spellLevel) { castSpell = spell; break; } } if (caster.AttackState) caster.StopAttack(); if (caster.IsMoving) caster.StopFollowing(); caster.TurnTo(caster.TargetObject); caster.CastSpell(castSpell, castLine); }
/// <summary> /// Method to cast a heal spell /// </summary> /// <param name="guard">The guard object</param> /// <param name="target">The spell target</param> public static void CastHealSpell(GameNPC guard, GameLiving target) { //decide which healing spell Spell spell = GetGuardHealSmallSpell((eRealm)guard.Realm); //cast the healing spell if (spell != null && !guard.IsStunned && !guard.IsMezzed ) { guard.StopAttack(); guard.TargetObject = target; guard.CastSpell(spell, SpellMgr.GuardSpellLine); } }