Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Casts the spell.
- /// </summary>
- /// <param name="spell">The spell.</param>
- public void CastSpell(Spell spell)
- {
- if (!spell.CanUse())
- {
- spell.InUse = false;
- return;
- }
- if (spell.InUse)
- return;
- var info = Client.Aisling.ActiveSpellInfo;
- if (info != null)
- {
- if (!string.IsNullOrEmpty(info.Data))
- spell.Script.Arguments = info.Data;
- var target = GetObject(Map, i => i.Serial == info.Target, Get.Monsters | Get.Aislings | Get.Mundanes);
- spell.InUse = true;
- if (spell.Script != null)
- {
- if (target != null)
- {
- if (target is Aisling tobj)
- {
- spell.Script.OnUse(this, target as Aisling);
- }
- if (target is Monster aobj)
- {
- spell.Script.OnUse(this, aobj);
- }
- if (target is Mundane)
- spell.Script.OnUse(this, target as Mundane);
- }
- else
- {
- spell.Script.OnUse(this, this);
- }
- }
- }
- spell.NextAvailableUse = DateTime.UtcNow.AddSeconds(info.SpellLines > 0 ? 1 : 0.2);
- spell.InUse = false;
- if (spell.Template.Cooldown > 0)
- {
- Client.Send(new ServerFormat3F((byte)0,
- spell.Slot,
- spell.Template.Cooldown));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement