Example #1
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
        {
            if(!ConditionFulfilled)
            {

            }
        }
Example #2
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            _currentTotal = GetTotal();
            if (!ConditionFulfilled)
            {
                // the basic structure is (portion of necessary gain action provides) * (desire / time left until needed)
                foreach (Ability ability in Abilities)
                {
                    if (!MagicArts.IsArt(ability))
                    {
                        AddPracticeToActionList(ability, alreadyConsidered, log);
                    }
                    else if (Character.GetType() == typeof(Magus))
                    {
                        AddVisUseToActionList(ability, alreadyConsidered, log);
                    }

                    var topicalBooks = Character.ReadableBooks.Where(b => b.Topic == ability);
                    if (topicalBooks.Any())
                    {
                        AddReadingToActionList(topicalBooks, ability, alreadyConsidered, log);
                    }
                }
            }
        }
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            _currentAura = Mage.Covenant == null ? 0 : Mage.Covenant.Aura.Strength;
            _auraCount   = Mage.KnownAuras.Count;

            // for now
            _currentScore = CalculateFindAuraScore();
            double probOfBetter = 1 - (_currentAura * _currentAura * (_auraCount + 1) / (5 * _currentScore));
            double maxAura      = Math.Sqrt(5.0 * _currentScore / (_auraCount + 1));
            double averageGain  = maxAura * probOfBetter / 2.0;
            double desire       = _desireFunc(averageGain, ConditionDepth);

            if (desire > 0.00001)
            {
                log.Add("Finding a better aura to build a lab in worth " + desire.ToString("0.000"));
                alreadyConsidered.Add(new FindAura(Abilities.AreaLore, desire));

                // consider the value of increasing find aura related scores
                //practice area lore
                PracticeHelper areaLorePracticeHelper = new PracticeHelper(Abilities.AreaLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);
                areaLorePracticeHelper.AddActionPreferencesToList(alreadyConsidered, log);

                // read area lore
                ReadingHelper readAreaLoreHelper = new ReadingHelper(Abilities.AreaLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);

                // consider value of increasing InVi casting total
                CastingTotalIncreaseHelper inViHelper = new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy - 1, Desire / 10, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVisUse, _desireFunc);
            }
        }
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
        {
            _currentAura = Mage.Covenant == null ? 0 : Mage.Covenant.Aura.Strength;
            _auraCount = Mage.KnownAuras.Count;

            // for now
            _currentScore= CalculateFindAuraScore();
            double probOfBetter = 1 - (_currentAura * _currentAura * _auraCount / (5 * _currentScore));
            double maxAura = Math.Sqrt(5.0 * _currentScore / _auraCount);
            double averageGain = maxAura * probOfBetter / 2.0;
            double desire = _desireFunc(averageGain, ConditionDepth);

            if (desire > 0.01)
            {

                log.Add("Finding a better aura to build a lab in worth " + desire.ToString("0.00"));
                alreadyConsidered.Add(new FindAura(Abilities.AreaLore, desire));

                // consider the value of increasing find aura related scores
                //practice area lore
                PracticeHelper areaLorePracticeHelper = new PracticeHelper(Abilities.AreaLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);
                areaLorePracticeHelper.AddActionPreferencesToList(alreadyConsidered, log);

                // read area lore
                ReadingHelper readAreaLoreHelper = new ReadingHelper(Abilities.AreaLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire);

                // consider value of increasing InVi casting total
                CastingTotalIncreaseHelper inViHelper = new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy - 1, Desire / 10, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVisUse, _desireFunc);

            }
        }
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
        {
            _currentTotal = GetTotal();
            if (!ConditionFulfilled)
            {
                // the basic structure is (portion of necessary gain action provides) * (desire / time left until needed)
                foreach (Ability ability in Abilities)
                {
                    if (MagicArts.IsArt(ability))
                    {
                        AddPracticeToActionList(ability, alreadyConsidered, log);
                    }
                    else if (Character.GetType() == typeof(Magus))
                    {
                        AddVisUseToActionList(ability, alreadyConsidered, log);
                    }

                    var topicalBooks = Character.ReadableBooks.Where(b => b.Topic == ability);
                    if (topicalBooks.Any())
                    {
                        AddReadingToActionList(topicalBooks, ability, alreadyConsidered, log);
                    }
                }
            }
        }
Example #6
0
        private void AddVisUseToActionList(Ability ability, ConsideredActions alreadyConsidered, IList <string> log)
        {
            Magus mage = (Magus)Character;
            CharacterAbilityBase magicArt = mage.GetAbility(ability);
            double effectiveDesire        = GetDesirabilityOfIncrease(magicArt.GetValueGain(mage.VisStudyRate));

            if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0)
            {
                // see if the mage has enough vis of this type
                double stockpile = mage.GetVisCount(ability);
                double visNeed   = 0.5 + (magicArt.Value / 10.0);

                // if so, assume vis will return an average of 6XP + aura
                if (stockpile > visNeed)
                {
                    log.Add("Studying vis for " + magicArt.Ability.AbilityName + " worth " + effectiveDesire.ToString("0.000"));
                    VisStudying visStudy = new VisStudying(magicArt.Ability, effectiveDesire);
                    alreadyConsidered.Add(visStudy);
                    // TODO: how do we decrement the cost of the vis?
                }
                // putting a limit here to how far the circular loop will go
                else if (ConditionDepth <= 10)
                {
                    List <Ability> visType = new List <Ability>();
                    visType.Add(magicArt.Ability);
                    // Magus magus, uint ageToCompleteBy, double desire, Ability ability, double totalNeeded, ushort conditionDepth
                    VisCondition visCondition =
                        new VisCondition(mage, AgeToCompleteBy - 1, effectiveDesire, ability, visNeed, (ushort)(ConditionDepth + 1));
                    visCondition.AddActionPreferencesToList(alreadyConsidered, log);
                }
            }
        }
Example #7
0
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
 {
     if (!ConditionFulfilled)
     {
         FindAura findAuraAction = new FindAura(Abilities.AreaLore, this.Desire / (AgeToCompleteBy - Character.SeasonalAge));
         alreadyConsidered.Add(findAuraAction);
         log.Add("Finding an aura worth " + this.Desire.ToString("0.000"));
     }
 }
Example #8
0
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
 {
     if (_desireFunc != null)
     {
         double gain           = this.Mage.GetAbility(_ability).GetValueGain(4);
         double practiceDesire = _desireFunc(gain, ConditionDepth);
         log.Add("Practicing " + _ability.AbilityName + " worth " + practiceDesire.ToString("0.000"));
         alreadyConsidered.Add(new Practice(_ability, practiceDesire));
     }
 }
Example #9
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            var bestBook = Mage.GetBestBookToWrite();

            if (bestBook != null)
            {
                double effectiveDesire = _desireFunc(bestBook.Value, ConditionDepth);
                log.Add("Writing " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.000"));
                Write writingAction = new Write(bestBook.Topic, bestBook.Title, Abilities.Latin, bestBook.Level, effectiveDesire);
                alreadyConsidered.Add(writingAction);
            }
        }
Example #10
0
        private void AddPracticeToActionList(Ability ability, ConsideredActions alreadyConsidered, IList <string> log)
        {
            // For now, assume 4pt practice on everything
            double effectiveDesire = GetDesirabilityOfIncrease(Character.GetAbility(ability).GetValueGain(4));

            if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0)
            {
                Practice practiceAction = new Practice(ability, effectiveDesire);
                log.Add("Practicing " + ability.AbilityName + " worth " + (effectiveDesire).ToString("0.000"));
                alreadyConsidered.Add(practiceAction);
            }
        }
Example #11
0
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
 {
     if (_desireFunc != null)
     {
         double alPracticeDesire = _desireFunc(4, ConditionDepth);
         if (alPracticeDesire > 0.01)
         {
             log.Add("Practicing Area Lore before finding a new aura worth " + alPracticeDesire.ToString("0.00"));
             alreadyConsidered.Add(new Practice(_ability, alPracticeDesire));
         }
     }
 }
Example #12
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            double storedVis = VisTypes.Sum(v => _mage.GetVisCount(v));

            _visStillNeeded = AmountNeeded - storedVis;
            if (_visStillNeeded > 0)
            {
                // extract
                if (_vimSufficient)
                {
                    if (!_auraCondition.ConditionFulfilled)
                    {
                        _auraCondition.AddActionPreferencesToList(alreadyConsidered, log);
                    }
                    else if (!_labCondition.ConditionFulfilled)
                    {
                        _labCondition.AddActionPreferencesToList(alreadyConsidered, log);
                    }
                    else
                    {
                        double currentDistillRate  = _mage.GetVisDistillationRate();
                        double extractDesirability = GetDesirabilityOfVisGain(currentDistillRate, ConditionDepth);
                        if (extractDesirability > 0.00001)
                        {
                            // we can get what we want in one season, go ahead and do it
                            log.Add("Extracting vis worth " + extractDesirability.ToString("0.000"));
                            alreadyConsidered.Add(new VisExtracting(Abilities.MagicTheory, extractDesirability));

                            if (currentDistillRate < _visStillNeeded)
                            {
                                // we are in the multi-season-to-fulfill scenario

                                // the difference between the desire of starting now
                                // and the desire of starting after gaining experience
                                // is the effective value of raising skills
                                double labTotal = _mage.GetLabTotal(MagicArtPairs.CrVi, Activity.DistillVis);
                                LabTotalIncreaseHelper helper =
                                    new LabTotalIncreaseHelper(_mage, AgeToCompleteBy - 1, extractDesirability / labTotal, (ushort)(ConditionDepth + 1), MagicArtPairs.CrVi, false, GetDesirabilityOfLabTotalGain);
                                helper.AddActionPreferencesToList(alreadyConsidered, log);
                            }
                        }
                    }
                }
                // search for vis source
                FindVisSourceHelper visSourceHelper = new FindVisSourceHelper(_mage, VisTypes, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), !_vimSufficient, GetDesirabilityOfVisGain);
                visSourceHelper.AddActionPreferencesToList(alreadyConsidered, log);

                // consider writing a book to trade for vis
                WritingHelper writingHelper = new WritingHelper(_mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), GetDesirabilityOfVisGain);
                writingHelper.AddActionPreferencesToList(alreadyConsidered, log);
            }
        }
Example #13
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            var bestBook = Mage.GetBestBookToRead(_ability);

            if (bestBook != null)
            {
                double gain            = Mage.GetBookLevelGain(bestBook);
                double effectiveDesire = _desireFunc(gain, ConditionDepth);
                log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.000"));
                Read readingAction = new Read(bestBook, effectiveDesire);
                alreadyConsidered.Add(readingAction);
            }
        }
Example #14
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);
        }
Example #15
0
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
 {
     var bestBook = Mage.GetBestBookToRead(_ability);
     if (bestBook != null)
     {
         double gain = Mage.GetBookLevelGain(bestBook);
         double effectiveDesire = _desireFunc(gain, ConditionDepth);
         if (effectiveDesire > 0.01)
         {
             log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.00"));
             Reading readingAction = new Reading(bestBook, effectiveDesire);
             alreadyConsidered.Add(readingAction);
         }
     }
 }
Example #16
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
        {
            double storedVis = VisTypes.Sum(v => _mage.GetVisCount(v));
            _visStillNeeded = AmountNeeded - storedVis;
            if (_visStillNeeded > 0)
            {
                // extract
                if (_vimSufficient)
                {
                    if (!_mage.KnownAuras.Any())
                    {
                        _auraCondition.AddActionPreferencesToList(alreadyConsidered, log);
                    }
                    else if (_mage.Laboratory == null)
                    {
                        _labCondition.AddActionPreferencesToList(alreadyConsidered, log);
                    }
                    else
                    {
                        double labTotal = _mage.GetLabTotal(MagicArtPairs.CrVi, Activity.DistillVis);
                        double currentDistillRate = labTotal / 10;
                        double extractDesirability = GetDesirabilityOfVisGain(currentDistillRate, ConditionDepth);
                        if (extractDesirability > 0.01)
                        {
                            // we can get what we want in one season, go ahead and do it
                            log.Add("Extracting vis worth " + (extractDesirability).ToString("0.00"));
                            alreadyConsidered.Add(new VisExtracting(Abilities.MagicTheory, extractDesirability));

                            if (currentDistillRate < _visStillNeeded)
                            {
                                // we are in the multi-season-to-fulfill scenario

                                // the difference between the desire of starting now
                                // and the desire of starting after gaining experience
                                // is the effective value of raising skills
                                LabTotalIncreaseHelper helper =
                                    new LabTotalIncreaseHelper(_mage, AgeToCompleteBy - 1, extractDesirability / labTotal, (ushort)(ConditionDepth + 1), MagicArtPairs.CrVi, false, GetDesirabilityOfLabTotalGain);
                                //helper.ModifyActionList(_mage, alreadyConsidered, log);
                            }
                        }
                    }
                }
                // search for vis source
                FindVisSourceHelper visSourceHelper = new FindVisSourceHelper(_mage, VisTypes, AgeToCompleteBy, Desire, ConditionDepth, !_vimSufficient, GetDesirabilityOfVisGain);
            }

            // trade?
        }
Example #17
0
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
 {
     if(!ConditionFulfilled)
     {
         HasAuraCondition auraCondition = new HasAuraCondition(_mage, this.AgeToCompleteBy, this.Desire, (ushort)(this.ConditionDepth + 1));
         if(!auraCondition.ConditionFulfilled)
         {
             auraCondition.AddActionPreferencesToList(alreadyConsidered, log);
         }
         else
         {
             BuildLaboratory buildLabAction = new BuildLaboratory(Abilities.MagicTheory, this.Desire / (AgeToCompleteBy - Character.SeasonalAge));
             alreadyConsidered.Add(buildLabAction);
             log.Add("Building a lab worth " + this.Desire.ToString("0.000"));
         }
     }
 }
Example #18
0
        public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
        {
            if (AgeToCompleteBy - Mage.SeasonalAge > 0)
            {
                // increase non-vim through vis study
                AddVisUseToActionList(_arts.Technique, alreadyConsidered, log);
                if (AllowVimVisUse || _arts.Form.AbilityName != "Vim")
                {
                    AddVisUseToActionList(_arts.Form, alreadyConsidered, log);
                }

                // increase either art through reading
                ReadingHelper techReadingHelper = new ReadingHelper(_arts.Technique, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), _desireFunc);
                ReadingHelper formReadingHelper = new ReadingHelper(_arts.Form, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), _desireFunc);
                techReadingHelper.AddActionPreferencesToList(alreadyConsidered, log);
                formReadingHelper.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);
     }
 }
Example #20
0
 public virtual void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
 {
     if (!_completed)
     {
         bool conditionsFulfilled = true;
         foreach (ACondition condition in Conditions)
         {
             if (!condition.ConditionFulfilled)
             {
                 conditionsFulfilled = false;
                 condition.AddActionPreferencesToList(alreadyConsidered, log);
             }
         }
         if (conditionsFulfilled)
         {
             _completed = true;
         }
     }
 }
Example #21
0
 public virtual void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
 {
     if (!_completed)
     {
         bool conditionsFulfilled = true;
         foreach (ACondition condition in Conditions)
         {
             if (!condition.ConditionFulfilled)
             {
                 conditionsFulfilled = false;
                 condition.AddActionPreferencesToList(alreadyConsidered, log);
             }
         }
         if (conditionsFulfilled)
         {
             _completed = true;
         }
     }
 }
Example #22
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?
            }
        }
        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);
        }
Example #24
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);
            }
        }
Example #25
0
 IAction DecideSeasonalActivity()
 {
     if (IsCollaborating)
     {
         return(_mandatoryAction);
     }
     else
     {
         ConsideredActions actions = new ConsideredActions();
         foreach (IGoal goal in _goals)
         {
             if (!goal.IsComplete())
             {
                 // TODO: it should probably be an error case for a goal to still be here
                 // for now, ignore
                 List <string> dummy = new List <string>();
                 goal.AddActionPreferencesToList(actions, dummy);
             }
         }
         Log.AddRange(actions.Log());
         return(actions.GetBestAction());
     }
 }
 private void AddPracticeToActionList(Ability ability, ConsideredActions alreadyConsidered, IList<string> log)
 {
     // For now, assume 4pt practice on everything
     double effectiveDesire = GetDesirabilityOfIncrease(Character.GetAbility(ability).GetValueGain(4));
     if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0)
     {
         Practice practiceAction = new Practice(ability, effectiveDesire);
         log.Add("Practicing " + ability.AbilityName + " worth " + (effectiveDesire).ToString("0.00"));
         alreadyConsidered.Add(practiceAction);
     }
 }
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
 {
     this.Conditions[0] = new VisCondition((Magus)this.Conditions[0].Character, 140, this.Conditions[0].Desire, visTypes, (this.Conditions[0].Character.SeasonalAge / 20) + 1, 1);
     base.AddActionPreferencesToList(alreadyConsidered, log);
 }
Example #28
0
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
 {
     throw new NotImplementedException();
 }
        private void AddReadingToActionList(IEnumerable<IBook> topicalBooks, Ability ability, ConsideredActions alreadyConsidered, IList<string> log)
        {
            IBook bestBook = Character.GetBestBookToRead(ability);

            if (bestBook != null)
            {
                double gain = Character.GetBookLevelGain(bestBook);
                double effectiveDesire = GetDesirabilityOfIncrease(gain);
                if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0)
                {
                    log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.00"));
                    Reading readingAction = new Reading(bestBook, effectiveDesire);
                    alreadyConsidered.Add(readingAction);
                }
            }
        }
Example #30
0
 IAction DecideSeasonalActivity()
 {
     if (IsCollaborating)
     {
         return _mandatoryAction;
     }
     else
     {
         ConsideredActions actions = new ConsideredActions();
         foreach (IGoal goal in _goals)
         {
             if (!goal.IsComplete())
             {
                 // TODO: it should probably be an error case for a goal to still be here
                 // for now, ignore
                 List<string> dummy = new List<string>();
                 goal.AddActionPreferencesToList(actions, dummy);
             }
         }
         Log.AddRange(actions.Log());
         return actions.GetBestAction();
     }
 }
Example #31
0
 public abstract void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log);
        private void AddVisUseToActionList(Ability ability, ConsideredActions alreadyConsidered, IList<string> log)
        {
            Magus mage = (Magus)Character;
            CharacterAbilityBase magicArt = mage.GetAbility(ability);
            double effectiveDesire = GetDesirabilityOfIncrease(magicArt.GetValueGain(mage.VisStudyRate));
            if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0)
            {
                // see if the mage has enough vis of this type
                double stockpile = mage.GetVisCount(ability);
                double visNeed = 0.5 + (magicArt.Value / 10.0);

                // if so, assume vis will return an average of 6XP + aura
                if (stockpile > visNeed)
                {
                    log.Add("Studying vis for " + magicArt.Ability.AbilityName + " worth " + effectiveDesire.ToString("0.00"));
                    VisStudying visStudy = new VisStudying(magicArt.Ability, effectiveDesire);
                    alreadyConsidered.Add(visStudy);
                    // TODO: how do we decrement the cost of the vis?
                }
                // putting a limit here to how far the circular loop will go
                else if (ConditionDepth <= 10)
                {
                    List<Ability> visType = new List<Ability>();
                    visType.Add(magicArt.Ability);
                    // Magus magus, uint ageToCompleteBy, double desire, Ability ability, double totalNeeded, ushort conditionDepth
                    VisCondition visCondition =
                        new VisCondition(mage, AgeToCompleteBy - 1, effectiveDesire, ability, visNeed, (ushort)(ConditionDepth + 1));
                    visCondition.AddActionPreferencesToList(alreadyConsidered, log);
                }
            }
        }
Example #33
0
 public abstract void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log);
Example #34
0
        private void AddReadingToActionList(IEnumerable <IBook> topicalBooks, Ability ability, ConsideredActions alreadyConsidered, IList <string> log)
        {
            IBook bestBook = Character.GetBestBookToRead(ability);

            if (bestBook != null)
            {
                double gain            = Character.GetBookLevelGain(bestBook);
                double effectiveDesire = GetDesirabilityOfIncrease(gain);
                if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0)
                {
                    log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.000"));
                    Read readingAction = new Read(bestBook, effectiveDesire);
                    alreadyConsidered.Add(readingAction);
                }
            }
        }
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log)
 {
     base.AddActionPreferencesToList(alreadyConsidered, log);
     // increase Sta
 }
Example #36
0
 public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log)
 {
     base.AddActionPreferencesToList(alreadyConsidered, log);
     // increase Sta
 }