/// <summary> /// See if there are any spells queued up and if so, get the first one /// and cast it. /// </summary> private void CheckSpellQueue() { SpellQueueEntry entry = GetSpellFromQueue(); if (entry != null) { if (!CastSpell(entry.Spell, entry.SpellLine, entry.Target)) { // If the spell can't be cast, remove it from the queue RemoveSpellFromQueue(); } } }
/// <summary> /// See if there are any spells queued up and if so, get the first one /// and cast it. /// </summary> private void CheckSpellQueue() { SpellQueueEntry spellQueueEntry = GetSpellFromQueue(); if (spellQueueEntry != null) { GameObject previousTarget = Body.TargetObject; GameLiving spellTarget = spellQueueEntry.Target; Spell spell = spellQueueEntry.Spell; // Cast spell on the target, but don't automatically // make it our new target. // Target must be alive, or this is a self spell, or this is a pbaoe spell if ((spellTarget != null && spellTarget.IsAlive) || spell.Target.ToLower() == "self" || spell.Range == 0) { Body.TargetObject = spellTarget; if (spellTarget != Body) { Body.TurnTo(spellTarget); } Body.CastSpell(spell, spellQueueEntry.SpellLine); if (previousTarget != null) { Body.TargetObject = previousTarget; } } else { DebugMessageToOwner(String.Format("Invalid target for spell '{0}', removing it...", m_spellQueue.Peek().Spell.Name)); RemoveSpellFromQueue(); } } }
public SpellQueueEntry(SpellQueueEntry entry) : this(entry.Spell, entry.SpellLine, entry.Target) { }
public SpellQueueEntry(SpellQueueEntry entry) : this(entry.Spell, entry.SpellLine, entry.Target) { }