Пример #1
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            List <Ability> visSearchAbilities = new List <Ability>();

            visSearchAbilities.Add(Abilities.MagicLore);
            visSearchAbilities.Add(MagicArts.Intellego);
            visSearchAbilities.Add(MagicArts.Vim);
            // we're not getting vis fast enough, so we need to find a new source
            // consider the value of searching for new vis sites in current auras
            // determine average vis source found
            _magicLoreTotal  = Mage.GetAbility(Abilities.MagicLore).Value;
            _magicLoreTotal += Mage.GetAttribute(AttributeType.Perception).Value;
            _magicLoreTotal += Mage.GetCastingTotal(MagicArtPairs.InVi) / 5;
            if (Mage.KnownAuras.Any())
            {
                Aura   aura        = Mage.KnownAuras.OrderByDescending(a => a.GetAverageVisSourceSize(_magicLoreTotal)).First();
                double averageFind = aura.GetAverageVisSourceSize(_magicLoreTotal);
                if (averageFind > 0)
                {
                    // originally, we modified by chance vis will be of the proper type
                    // this feels wrong; what's probably more sensible is to scale
                    // according to the relative value of vis
                    // so 5 * 4 + 9 * 2 + 1 = 39/15
                    // that represents the relative value of a random vis source compared to vim vis
                    double gain   = (averageFind * 39 / 15);
                    double desire = _desireFunc(gain, ConditionDepth);

                    // TODO: modify by lifelong value of source?
                    log.Add("Looking for vis source worth " + (desire).ToString("0.000"));
                    alreadyConsidered.Add(new FindVisSource(aura, Abilities.MagicLore, desire));
                }

                // consider the value of increasing the casting total first
                CastingTotalIncreaseHelper castingHelper =
                    new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVis, CalculateScoreGainDesire);
                castingHelper.AddActionPreferencesToList(alreadyConsidered, log);
                // consider the value of increasing Magic Lore
                PracticeHelper practiceHelper = new PracticeHelper(Abilities.MagicLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);
                practiceHelper.AddActionPreferencesToList(alreadyConsidered, log);
                ReadingHelper readingHelper = new ReadingHelper(Abilities.MagicLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);
                readingHelper.AddActionPreferencesToList(alreadyConsidered, log);
                // TODO: consider increasing Perception
            }

            // consider finding a whole new aura
            FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), !_visTypes.Contains(MagicArts.Vim), CalculateAuraGainDesire);

            auraHelper.AddActionPreferencesToList(alreadyConsidered, log);
        }
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
 {
     base.AddActionPreferencesToList(alreadyConsidered, log);
     // increase Magic Theory via practice
     PracticeHelper practiceHelper = new PracticeHelper(Abilities.MagicTheory, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), _desireFunc);
     practiceHelper.AddActionPreferencesToList(alreadyConsidered, log);
     // increase Magic Theory via reading
     ReadingHelper readingHelper = new ReadingHelper(Abilities.MagicTheory, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), _desireFunc);
     readingHelper.AddActionPreferencesToList(alreadyConsidered, log);
     // increase Int
     // improve lab
     // find better aura
     if (AgeToCompleteBy - Mage.SeasonalAge > 2)
     {
         // a season to find the aura, and a season to build a lab in it. Doesn't take into account lab specialization
         FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 2), AllowVimVisUse, _desireFunc);
     }
 }
Пример #3
0
        private void AddVisUseToActionList(Ability art, ConsideredActions alreadyConsidered, IList <string> log)
        {
            CharacterAbilityBase magicArt = Mage.GetAbility(art);
            double stockpile = Mage.GetVisCount(art);
            double visNeed   = 0.5 + (magicArt.Value / 10.0);

            // if so, assume vis will return an average of 6XP + aura
            if (stockpile > visNeed)
            {
                double      gain            = magicArt.GetValueGain(Mage.VisStudyRate);
                double      effectiveDesire = _desireFunc(gain, ConditionDepth);
                VisStudying visStudy        = new VisStudying(magicArt.Ability, effectiveDesire);
                alreadyConsidered.Add(visStudy);
                // consider the value of finding a better aura to study vis in
                FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), AllowVimVisUse, _desireFunc);

                // TODO: how do we decrement the cost of the vis?
            }
        }
Пример #4
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
        {
            List<Ability> visSearchAbilities = new List<Ability>();
            visSearchAbilities.Add(Abilities.MagicLore);
            visSearchAbilities.Add(MagicArts.Intellego);
            visSearchAbilities.Add(MagicArts.Vim);
            // we're not getting vis fast enough, so we need to find a new source
            // consider the value of searching for new vis sites in current auras
            // determine average vis source found
            _magicLoreTotal = Mage.GetAbility(Abilities.MagicLore).Value;
            _magicLoreTotal += Mage.GetAttribute(AttributeType.Perception).Value;
            _magicLoreTotal += Mage.GetCastingTotal(MagicArtPairs.InVi) / 5;
            if (_magicLoreTotal > 0 && Mage.KnownAuras.Any())
            {
                Aura aura = Mage.KnownAuras.OrderByDescending(a => a.GetAverageVisSourceSize(_magicLoreTotal)).First();
                double averageFind = aura.GetAverageVisSourceSize(_magicLoreTotal);
                if (averageFind > 0)
                {
                    // modify by chance vis will be of the proper type
                    double gain = (averageFind * _visTypes.Count() / 15);
                    double desire = _desireFunc(gain, ConditionDepth);

                    // TODO: modify by lifelong value of source?
                    log.Add("Looking for vis source worth " + (desire).ToString("0.00"));
                    alreadyConsidered.Add(new FindVisSource(aura, Abilities.MagicLore, desire));
                }

                // consider the value of increasing the casting total first
                CastingTotalIncreaseHelper castingHelper =
                    new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVis, CalculateScoreGainDesire);
                castingHelper.AddActionPreferencesToList(alreadyConsidered, log);
                // consider the value of increasing Magic Lore
                PracticeHelper practiceHelper = new PracticeHelper(Abilities.MagicLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);
                practiceHelper.AddActionPreferencesToList(alreadyConsidered, log);
                ReadingHelper readingHelper = new ReadingHelper(Abilities.MagicLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);
                readingHelper.AddActionPreferencesToList(alreadyConsidered, log);
                // TODO: consider increasing Perception
            }

            // consider finding a whole new aura
            FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), !_visTypes.Contains(MagicArts.Vim), CalculateAuraGainDesire);
        }
Пример #5
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            base.AddActionPreferencesToList(alreadyConsidered, log);
            // increase Magic Theory via practice
            PracticeHelper practiceHelper = new PracticeHelper(Abilities.MagicTheory, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), _desireFunc);

            practiceHelper.AddActionPreferencesToList(alreadyConsidered, log);
            // increase Magic Theory via reading
            ReadingHelper readingHelper = new ReadingHelper(Abilities.MagicTheory, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), _desireFunc);

            readingHelper.AddActionPreferencesToList(alreadyConsidered, log);
            // increase Int
            // improve lab
            // find better aura
            if (AgeToCompleteBy - Mage.SeasonalAge > 2)
            {
                // a season to find the aura, and a season to build a lab in it. Doesn't take into account lab specialization
                FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy - 2, Desire, (ushort)(ConditionDepth + 2), AllowVimVisUse, _desireFunc);
            }
        }