Esempio n. 1
0
        public void AddToPlan(object tp, int value, int cost)
        {
            PlanningEntry entry = Entries.FirstOrDefault(e => e.TrainPoint == tp);

            if (entry != null)
            {
                Entries.Remove(entry);
            }

            Entries.Add(new PlanningEntry(tp, value, cost));

            if (tp is MagicalAbility ability && ability <= MagicalAbility.WrestlingMastery)
            {
                TrainingPoint trainingPoint = PetTrainingHelper.GetTrainingPoint(ability);

                foreach (PlanningEntry en in Entries)
                {
                    if (trainingPoint.Requirements != null && trainingPoint.Requirements.Length > 0)
                    {
                        foreach (TrainingPointRequirement req in trainingPoint.Requirements)
                        {
                            if (req != null)
                            {
                                if (req.Requirement is WeaponAbility && en.TrainPoint is WeaponAbility || req.Requirement is SpecialAbility && en.TrainPoint is SpecialAbility || req.Requirement is AreaEffect && en.TrainPoint is AreaEffect)
                                {
                                    en.Value = 0;
                                    en.Cost  = 0;
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public void OnAddAbility(object newAbility, bool advancement)
        {
            if (advancement)
            {
                AddPetAdvancement(newAbility);
            }

            if (newAbility is MagicalAbility)
            {
                AddMagicalAbility((MagicalAbility)newAbility);
            }

            var trainPoint = PetTrainingHelper.GetTrainingPoint(newAbility);

            if (trainPoint != null && trainPoint.Requirements != null)
            {
                foreach (var req in trainPoint.Requirements.Where(r => r != null))
                {
                    if (req.Requirement is SkillName)
                    {
                        double skill = Creature.Skills[(SkillName)req.Requirement].Base;
                        double toAdd = req.Cost == 100 ? 20 : 40;

                        if (skill < toAdd)
                        {
                            Creature.Skills[(SkillName)req.Requirement].Base = toAdd;
                        }
                    }
                    else if (req.Requirement is WeaponAbility)
                    {
                        AddAbility((WeaponAbility)req.Requirement);
                    }
                }
            }
        }
Esempio n. 3
0
        public void AddToPlan(object tp, int value, int cost)
        {
            PlanningEntry entry = null;

            for (var index = 0; index < Entries.Count; index++)
            {
                var e = Entries[index];

                if (e.TrainPoint == tp)
                {
                    entry = e;
                    break;
                }
            }

            if (entry != null)
            {
                Entries.Remove(entry);
            }

            Entries.Add(new PlanningEntry(tp, value, cost));

            if (tp is MagicalAbility ability && ability <= MagicalAbility.WrestlingMastery)
            {
                TrainingPoint trainingPoint = PetTrainingHelper.GetTrainingPoint(ability);

                for (var index = 0; index < Entries.Count; index++)
                {
                    PlanningEntry en = Entries[index];

                    if (trainingPoint.Requirements != null && trainingPoint.Requirements.Length > 0)
                    {
                        for (var i = 0; i < trainingPoint.Requirements.Length; i++)
                        {
                            TrainingPointRequirement req = trainingPoint.Requirements[i];

                            if (req != null && (req.Requirement is WeaponAbility && en.TrainPoint is WeaponAbility ||
                                                req.Requirement is SpecialAbility && en.TrainPoint is SpecialAbility ||
                                                req.Requirement is AreaEffect && en.TrainPoint is AreaEffect))
                            {
                                en.Value = 0;
                                en.Cost  = 0;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        public void OnAddAbility(object newAbility, bool advancement)
        {
            if (advancement)
            {
                AddPetAdvancement(newAbility);
            }

            if (newAbility is MagicalAbility ability)
            {
                AddMagicalAbility(ability);
            }

            TrainingPoint trainPoint = PetTrainingHelper.GetTrainingPoint(newAbility);

            if (trainPoint != null && trainPoint.Requirements != null)
            {
                for (var index = 0; index < trainPoint.Requirements.Length; index++)
                {
                    TrainingPointRequirement req = trainPoint.Requirements[index];

                    if (req != null)
                    {
                        if (req.Requirement is SkillName name)
                        {
                            double skill = Creature.Skills[name].Base;
                            double toAdd = req.Cost == 100 ? 20 : 40;

                            if (name == SkillName.Hiding)
                            {
                                toAdd = 100;
                            }

                            if (skill < toAdd)
                            {
                                Creature.Skills[name].Base = toAdd;
                            }
                        }
                        else if (req.Requirement is WeaponAbility requirement)
                        {
                            AddAbility(requirement);
                        }
                    }
                }
            }
        }