Ejemplo n.º 1
0
        public static Talent FromTalentData(TalentData data)
        {
            Talent talent = new Talent();

            talent.name = data.Name;

            foreach (string s in data.AllowedClasses)
                talent.allowedClasses.Add(s.ToLower());

            foreach (string s in data.AttributeRequirements.Keys)
                talent.attributeRequirements.Add(
                    s.ToLower(), 
                    data.AttributeRequirements[s]);

            foreach (string s in data.TalentPrerequisites)
                talent.talentPrerequisites.Add(s);

            talent.levelRequirement = data.LevelRequirement;
            talent.talentType = data.TalentType;
            talent.activationCost = data.ActivationCost;

            foreach (string s in data.Effects)
                talent.Effects.Add(s);

            return talent;
        }
Ejemplo n.º 2
0
        public static Talent FromTalentData(TalentData data)
        {
            Talent talent = new Talent
            {
                name             = data.Name,
                levelRequirement = data.LevelRequirement,
                talentType       = data.TalentType,
                activationCost   = data.ActivationCost,
                coolDown         = data.CoolDown,
                Range            = data.Range,
                AreaOfEffect     = data.AreaOfEffect,
                AngleOfEffect    = data.AngleOfEffect,
                CastTime         = data.CastTime
            };

            foreach (string s in data.AllowedClasses)
            {
                talent.allowedClasses.Add(s.ToLower());
            }

            foreach (string s in data.AttributeRequirements.Keys)
            {
                talent.attributeRequirements.Add(
                    s.ToLower(),
                    data.AttributeRequirements[s]);
            }

            foreach (string s in data.TalentPrerequisites)
            {
                talent.talentPrerequisites.Add(s);
            }

            foreach (BaseEffect s in data.Effects)
            {
                talent.Effects.Add(s);
            }
            return(talent);
        }
Ejemplo n.º 3
0
        public static bool CanLearn(Entity entity, Talent talent)
        {
            bool canLearn = true;

            if (entity.Level < talent.LevelRequirement)
            {
                canLearn = false;
            }

            string entityClass = entity.EntityClass.ToLower();

            if (!talent.AllowedClasses.Contains(entityClass))
            {
                canLearn = false;
            }

            foreach (string s in talent.AttributeRequirements.Keys)
            {
                if (Mechanics.GetAttributeByString(entity, s) < talent.AttributeRequirements[s])
                {
                    canLearn = false;
                    break;
                }
            }

            foreach (string s in talent.TalentPrerequisites)
            {
                if (!entity.Talents.ContainsKey(s))
                {
                    canLearn = false;
                    break;
                }
            }

            return(canLearn);
        }
Ejemplo n.º 4
0
        public static bool CanLearn(Entity entity, Talent talent)
        {
            bool canLearn = true;

            if (entity.Level < talent.LevelRequirement)
                canLearn = false;

            string entityClass = entity.EntityClass.ToLower();

            if (!talent.AllowedClasses.Contains(entityClass))
                canLearn = false;

            foreach (string s in talent.AttributeRequirements.Keys)
            {
                if (Mechanics.GetAttributeByString(entity, s) < talent.AttributeRequirements[s])
                {
                    canLearn = false;
                    break;
                }
            }

            foreach (string s in talent.TalentPrerequisites)
            {
                if (!entity.Talents.ContainsKey(s))
                {
                    canLearn = false;
                    break;
                }
            }

            return canLearn;
        }