Exemplo n.º 1
0
        /// <summary>
        /// Tries to learn the given tier for the given skill (if allowed)
        /// </summary>
        /// <returns>Whether it succeeded</returns>
        public bool TryLearn(SkillId id, SkillTierId tier)
        {
            Skill skill;

            if (!m_skills.TryGetValue(id, out skill))
            {
                SkillRaceClassInfo skillRaceClassInfo;
                if (!AvailableSkills.TryGetValue(id, out skillRaceClassInfo) ||
                    m_owner.Level < skillRaceClassInfo.MinimumLevel)
                {
                    return(false);
                }
                skill = Add(skillRaceClassInfo.SkillLine, false);
            }

            if (skill.CanLearnTier(tier))
            {
                skill.MaxValue = (ushort)skill.SkillLine.Tiers.GetMaxValue(tier);
                if (id == SkillId.Riding)
                {
                    skill.CurrentValue = skill.MaxValue;
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 private void Initialize(ObservableSet <IReadOnlyList <Skill> > skills)
 {
     AddSkills(skills);
     SelectedSkill = GetSelectedAndAvailableSkill() ?? AvailableSkills.First();
     _selectedSkillItemSlot.PropertyChanged    += OnSelectedSkillStatChanged;
     _selectedSkillSocketIndex.PropertyChanged += OnSelectedSkillStatChanged;
     skills.CollectionChanged += OnSkillsChanged;
 }
Exemplo n.º 3
0
        public PlayerViewModel(Tournament tournament)
        {
            Tournament      = tournament;
            NewPlayerSkill  = AvailableSkills.FirstOrDefault();
            NewPlayerGender = Gender.Male;

            Players.AllPlayers.CollectionChanged += AllPlayers_CollectionChanged;

            ResetNewPlayerSection();
        }
Exemplo n.º 4
0
        /// <summary>
        /// If this char is allowed to learn this skill (matching Race, Class and Level) on the given tier,
        /// the correspdonding SkillLine will be returned. Returns null if skill cannot be learnt.
        /// </summary>
        public SkillLine GetLineIfLearnable(SkillId id, SkillTierId tier)
        {
            SkillRaceClassInfo skillRaceClassInfo;

            if (!AvailableSkills.TryGetValue(id, out skillRaceClassInfo) ||
                m_owner.Level < skillRaceClassInfo.MinimumLevel)
            {
                return(null);
            }
            Skill skill;

            if ((tier == SkillTierId.Apprentice ||
                 skillRaceClassInfo.SkillLine.Tiers.MaxValues.Length >= (long)tier) &&
                (m_skills.TryGetValue(id, out skill) && skill.CanLearnTier(tier)))
            {
                return(null);
            }
            return(skillRaceClassInfo.SkillLine);
        }
Exemplo n.º 5
0
        /// <summary>
        /// If this char is allowed to learn this skill (matching Race, Class and Level) on the given tier,
        /// the correspdonding SkillLine will be returned. Returns null if skill cannot be learnt.
        /// </summary>
        public SkillLine GetLineIfLearnable(SkillId id, SkillTierId tier)
        {
            SkillRaceClassInfo info;

            if (!AvailableSkills.TryGetValue(id, out info) || m_owner.Level < info.MinimumLevel)
            {
                return(null);
            }

            if (tier == 0 || (info.SkillLine.Tiers.MaxValues.Length >= (uint)tier))
            {
                Skill skill;
                if (m_skills.TryGetValue(id, out skill))
                {
                    if (skill.CanLearnTier(tier))
                    {
                        return(null);
                    }
                }
            }
            return(info.SkillLine);
        }
Exemplo n.º 6
0
        //Implementation that leads to skills using their default statistic
        public Skill createSkill(AvailableSkills _s)
        {
            switch (_s)
            {
            case AvailableSkills.AIM:
                return(createSkill("Aim", AvailableStatistics.DEXTERITY));

            case AvailableSkills.BRAVERY:
                return(createSkill("Bravery", AvailableStatistics.DETERMINATION));

            case AvailableSkills.CREW:
                return(createSkill("Crew", AvailableStatistics.INTELLIGENCE));

            case AvailableSkills.DETECTION:
                return(createSkill("Detection", AvailableStatistics.INTELLIGENCE));

            case AvailableSkills.DODGE:
                return(createSkill("Dodge", AvailableStatistics.DEXTERITY));

            case AvailableSkills.MAGIC:
                return(createSkill("Magic", AvailableStatistics.INTELLIGENCE));

            case AvailableSkills.MAGICRESISTANCE:
                return(createSkill("Magic Resistance", AvailableStatistics.NOSKILL));

            case AvailableSkills.MELEE:
                return(createSkill("Melee", AvailableStatistics.STRENGTH));

            case AvailableSkills.STEALTH:
                return(createSkill("Stealth", AvailableStatistics.DEXTERITY));

            case AvailableSkills.LEADERSHIP:
                return(createSkill("Leadership", AvailableStatistics.DETERMINATION));
            }
            Debug.Log("StatsSystemLibrary: Skill not found");
            return(null);
        }