예제 #1
0
파일: Skills.cs 프로젝트: nydehi/divinity
        public static bool UseSkill(IMobile from, int skillID)
        {
            if (!from.CheckAlive())
            {
                return(false);
            }
            else if (!from.Region.OnSkillUse(from, skillID))
            {
                return(false);
            }
            else if (!from.AllowSkillUse((SkillName)skillID))
            {
                return(false);
            }

            if (skillID >= 0 && skillID < SkillInfo.Table.Length)
            {
                SkillInfo info = SkillInfo.Table[skillID];

                if (info.Callback != null)
                {
                    if (from.NextSkillTime <= DateTime.Now && from.Spell == null)
                    {
                        from.DisruptiveAction();

                        from.NextSkillTime = DateTime.Now + info.Callback(from);

                        return(true);
                    }
                    else
                    {
                        from.SendSkillMessage();
                    }
                }
                else
                {
                    from.SendLocalizedMessage((int)InGameMessages.ThatskillCannotBeUsedDirectly);
                }
            }

            return(false);
        }