public bool IsLastUsedSkillPoint(SkillPoint skillPoint)
        {
            if (skillPoint == null)
            {
                return(false);
            }
            SkillPoint lastUsedSkillPoint = GetSkillPointBySkillSimulator(skillPoint.Skill).GetLastUsedSkillPointBySkill();

            return(skillPoint.Equals(lastUsedSkillPoint));
        }
Esempio n. 2
0
        internal SkillPoint GetFirstUnsedSkillPoint()
        {
            SkillPoint lastUsedSkillPoint     = GetLastUsedSkillPointBySkill();
            IOrderedEnumerable <SkillPoint> q = from SkillPoint sp in AvaliableSkillPoints
                                                where
                                                ((lastUsedSkillPoint == null) ||
                                                 (sp.Point > lastUsedSkillPoint.Point)) &&
                                                Skill.Name == sp.Skill.Name
                                                orderby sp.Point
                                                select sp;

            return(q.FirstOrDefault());
        }
Esempio n. 3
0
        public void AddSkillPoint(Skill skill, short point, string benefits, bool isDefault, int?requerimentLV)
        {
            var skillPoint = GetSkillPoint(skill, point);

            if (skillPoint == null)
            {
                skillPoint = new SkillPoint(this, skill, point, benefits, isDefault, requerimentLV);
                skillPoints.Add(skillPoint);
            }
            skillPoint.Benefits = benefits;
            if (!skill.ContainedInCareer(this))
            {
                skill.AddToCareer(this);
            }
        }
        public bool DecrementSkillPoint(Skill skill)
        {
            bool retorno = false;

            if (career.ContainsSkill(skill))
            {
                //throw new ArgumentException("The informed skill must exist in selected career", "skill");
                SkillPoint lastUsedSkillPoint = GetSkillPointBySkillSimulator(skill).GetLastUsedSkillPointBySkill();
                if (lastUsedSkillPoint != null)
                {
                    if (!lastUsedSkillPoint.IsDefault)
                    {
                        //throw new InvalidOperationException("There is no used skill point to the skill informed");
                        GetSkillPointBySkillSimulator(skill).UncheckSkillPoint(lastUsedSkillPoint);
                        retorno = true;
                    }
                }
            }
            UsedSkillPointsPropertyChangedNotify();
            return(retorno);
        }
        public bool IncrementSkillPoint(Skill skill, byte rank)
        {
            bool retorno = false;

            if (NumberOfUsedSkillPoints < CurrentRank.TotalPoints)
            {
                //throw new InvalidOperationException("There is mores skill points used that total point of the career");
                if (career.ContainsSkill(skill))
                {
                    //throw new ArgumentException("The informed skill must exist in selected career", "skill");
                    SkillPoint firstUnusedSkillPoint = GetSkillPointBySkillSimulator(skill).GetFirstUnsedSkillPoint();
                    if (firstUnusedSkillPoint != null && (firstUnusedSkillPoint.RequerimentLV <= rank || firstUnusedSkillPoint.RequerimentLV == null))
                    {
                        //throw new InvalidOperationException("There is no new unsed skill point in the selected skill");
                        GetSkillPointBySkillSimulator(skill).CheckSkillPoint(firstUnusedSkillPoint);
                        retorno = true;
                    }
                }
            }
            UsedSkillPointsPropertyChangedNotify();
            return(retorno);
        }
        public bool SetSkillPoint(SkillPoint skillPoint, byte rank)
        {
            Skill      skill = skillPoint.Skill;
            short      point = skillPoint.Point;
            SkillPoint lastUsedSkillPoint       = GetSkillPointBySkillSimulator(skill).GetLastUsedSkillPointBySkill();
            short      actualUsedPoint          = (lastUsedSkillPoint == null) ? (short)0 : lastUsedSkillPoint.Point;
            int        diferenceOfPoints        = point - actualUsedPoint;
            bool       doIncrementOfSkillPoints = diferenceOfPoints > 0;
            bool       sucess = false;

            //Get Abs value to control in a uniform way the increment or decrement of skill points
            diferenceOfPoints = Math.Abs(diferenceOfPoints);
            while ((diferenceOfPoints--) != 0)
            {
                sucess = doIncrementOfSkillPoints ? IncrementSkillPoint(skill, rank) : DecrementSkillPoint(skill);
                if (!sucess)
                {
                    break;
                }
            }
            return(sucess);
        }
Esempio n. 7
0
 internal void UncheckSkillPoint(SkillPoint skillPoint)
 {
     usedSkillPoints.Remove(skillPoint);
 }
Esempio n. 8
0
 internal void CheckSkillPoint(SkillPoint skillPoint)
 {
     usedSkillPoints.Add(skillPoint);
 }
Esempio n. 9
0
 internal void CheckDefaultSkillPoint(SkillPoint skillPoint)
 {
     defaultSkillPoints.Add(skillPoint);
 }