Example #1
0
    public Spell.Spells GetCastSpell()
    {
        Spell.Spells       splId = Spell.Spells.NoneSpell;
        Templates.TplSpell spl   = null;
        Spell itemSp             = GetOneTimeCast();

        if (itemSp != null)
        {
            splId = itemSp.SpellID;
            spl   = itemSp.Template;
        }
        else if (SpellbookVisible && Spellbook.Unit == SelectedObject && Spellbook.ActiveSpell != Spell.Spells.NoneSpell)
        {
            splId = Spellbook.ActiveSpell;
            spl   = TemplateLoader.GetSpellById((int)splId - 1);
        }

        if (spl != null &&
            (spl.IsAreaSpell ||
             (!spl.IsAreaSpell && HoveredObject != null && (HoveredObject.GetObjectType() == MapObjectType.Human || HoveredObject.GetObjectType() == MapObjectType.Monster))))
        {
            return(splId);
        }

        return(Spell.Spells.NoneSpell);
    }
Example #2
0
 public Spell(int id, MapUnit unit = null)
 {
     SpellID  = (Spells)id;
     Template = TemplateLoader.GetSpellById(id - 1);
     if (Template == null)
     {
         Debug.LogFormat("Invalid spell created (id={0})", id);
     }
     User = unit;
 }
Example #3
0
    Spell.Spells GetCastSpell()
    {
        if (SpellbookVisible && Spellbook.Unit == SelectedObject && Spellbook.ActiveSpell != Spell.Spells.NoneSpell)
        {
            Spell.Spells       sp  = Spellbook.ActiveSpell;
            Templates.TplSpell spl = TemplateLoader.GetSpellById((int)sp - 1);

            if (spl.SpellTarget == 2 ||
                (spl.SpellTarget == 1 && HoveredObject != null && (HoveredObject.GetObjectType() == MapObjectType.Human || HoveredObject.GetObjectType() == MapObjectType.Monster)))
            {
                return(Spellbook.ActiveSpell);
            }
        }
        return(Spell.Spells.NoneSpell);
    }