Example #1
0
        public void ModifyActionList(Magus mage, ConsideredActions alreadyConsidered, IList <string> log)
        {
            double dueDateDesire = _desirePerPoint / (Tier + 1);

            if (DueDate != null)
            {
                if (DueDate == 0)
                {
                    log.Add("Has Covenant Condition failed");
                    return;
                }
                dueDateDesire /= (double)DueDate;
            }

            double currentAura = mage.Covenant.Aura.Strength;
            double auraCount   = mage.KnownAuras.Count;
            double areaLore    = mage.GetAbility(Abilities.AreaLore).Value;

            areaLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 10;
            areaLore += mage.GetAttribute(AttributeType.Perception).Value;
            double probOfBetter = 1 - (currentAura * currentAura * auraCount / (5 * areaLore));
            double maxAura      = Math.Sqrt(5.0 * areaLore / auraCount);
            double averageGain  = maxAura * probOfBetter / 2.0;

            if (probOfBetter > 0)
            {
                double desire = dueDateDesire * averageGain;
                log.Add("Finding a better aura to build a lab in worth " + desire.ToString("0.00"));
                alreadyConsidered.Add(new FindAura(Abilities.AreaLore, desire));
            }
        }
Example #2
0
        private void HandleAuras(Magus mage, ConsideredActions alreadyConsidered, IList <string> log)
        {
            double greatestAura = mage.KnownAuras.Select(a => a.Strength).Max();
            double currentAura  = mage.Covenant.Aura.Strength;

            if (greatestAura > currentAura)
            {
                Aura bestAura = mage.KnownAuras.Where(a => a.Strength == greatestAura).First();
                if (mage.Laboratory == null)
                {
                    // just move the covenant right now
                    log.Add("Since no lab built, moving to better aura.");
                    mage.FoundCovenant(bestAura);
                }
                else
                {
                    // how do we want to rate the value of moving and having to build a new lab?
                    // it seems like basically the same as any other single-season activity
                    double gain          = greatestAura - currentAura;
                    double dueDateDesire = CalculateDesire(gain) / (BaseTier + 1);
                    if (BaseDueDate != null)
                    {
                        if (BaseDueDate == 0)
                        {
                            return;
                        }
                        dueDateDesire /= (double)(BaseDueDate - 1);
                    }
                    log.Add("Moving to new aura (to boost lab total) worth " + dueDateDesire.ToString("0.00"));
                    alreadyConsidered.Add(new BuildLaboratory(bestAura, Abilities.MagicTheory, dueDateDesire));
                }
            }
            else
            {
                double auraCount = mage.KnownAuras.Count;
                double areaLore  = mage.GetAbility(Abilities.AreaLore).Value;
                areaLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 10;
                areaLore += mage.GetAttribute(AttributeType.Perception).Value;
                double probOfBetter = 1 - (currentAura * currentAura * auraCount / (5 * areaLore));
                double maxAura      = Math.Sqrt(5.0 * areaLore / auraCount);
                double averageGain  = maxAura * probOfBetter / 2.0;

                double dueDateDesire = CalculateDesire(averageGain) / (BaseTier + 1);
                if (BaseDueDate != null)
                {
                    if (BaseDueDate == 0)
                    {
                        return;
                    }
                    dueDateDesire /= (double)(BaseDueDate - 1);
                }

                if (probOfBetter > 0)
                {
                    log.Add("Finding a better aura to build a lab in worth " + dueDateDesire.ToString("0.00"));
                    alreadyConsidered.Add(new FindAura(Abilities.AreaLore, dueDateDesire));
                }
            }
        }
Example #3
0
        private void HandleAuras(Magus mage, ConsideredActions alreadyConsidered, IList<string> log)
        {
            double greatestAura = mage.KnownAuras.Select(a => a.Strength).Max();
            double currentAura = mage.Covenant.Aura.Strength;
            if (greatestAura > currentAura)
            {
                Aura bestAura = mage.KnownAuras.Where(a => a.Strength == greatestAura).First();
                if (mage.Laboratory == null)
                {
                    // just move the covenant right now
                    log.Add("Since no lab built, moving to better aura.");
                    mage.FoundCovenant(bestAura);
                }
                else
                {
                    // how do we want to rate the value of moving and having to build a new lab?
                    // it seems like basically the same as any other single-season activity
                    double gain = greatestAura - currentAura;
                    double dueDateDesire = CalculateDesire(gain) / (BaseTier + 1);
                    if (BaseDueDate != null)
                    {
                        if (BaseDueDate == 0)
                        {
                            return;
                        }
                        dueDateDesire /= (double)(BaseDueDate - 1);
                    }
                    log.Add("Moving to new aura (to boost lab total) worth " + dueDateDesire.ToString("0.00"));
                    alreadyConsidered.Add(new BuildLaboratory(bestAura, Abilities.MagicTheory, dueDateDesire));
                }
            }
            else
            {
                double auraCount = mage.KnownAuras.Count;
                double areaLore = mage.GetAbility(Abilities.AreaLore).Value;
                areaLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 10;
                areaLore += mage.GetAttribute(AttributeType.Perception).Value;
                double probOfBetter = 1 - (currentAura * currentAura * auraCount / (5 * areaLore));
                double maxAura = Math.Sqrt(5.0 * areaLore / auraCount);
                double averageGain = maxAura * probOfBetter / 2.0;

                double dueDateDesire = CalculateDesire(averageGain) / (BaseTier + 1);
                if (BaseDueDate != null)
                {
                    if (BaseDueDate == 0)
                    {
                        return;
                    }
                    dueDateDesire /= (double)(BaseDueDate - 1);
                }

                if (probOfBetter > 0)
                {
                    log.Add("Finding a better aura to build a lab in worth " + dueDateDesire.ToString("0.00"));
                    alreadyConsidered.Add(new FindAura(Abilities.AreaLore, dueDateDesire));
                }
            }
        }
Example #4
0
        public void ModifyActionList(Magus mage, ConsideredActions alreadyConsidered, IList<string> log)
        {
            double dueDateDesire = _desirePerPoint / (Tier + 1);
            if (DueDate != null)
            {
                if (DueDate == 0)
                {
                    log.Add("Has Covenant Condition failed");
                    return;
                }
                dueDateDesire /= (double)DueDate;
            }

            double currentAura = mage.Covenant.Aura.Strength;
            double auraCount = mage.KnownAuras.Count;
            double areaLore = mage.GetAbility(Abilities.AreaLore).Value;
            areaLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 10;
            areaLore += mage.GetAttribute(AttributeType.Perception).Value;
            double probOfBetter = 1 - (currentAura * currentAura * auraCount / (5 * areaLore));
            double maxAura = Math.Sqrt(5.0 * areaLore / auraCount);
            double averageGain = maxAura * probOfBetter / 2.0;

            if (probOfBetter > 0)
            {
                double desire = dueDateDesire * averageGain;
                log.Add("Finding a better aura to build a lab in worth " + desire.ToString("0.00"));
                alreadyConsidered.Add(new FindAura(Abilities.AreaLore, desire));
            }
        }
Example #5
0
        public FindVisSourceHelper(Magus mage, List <Ability> visTypes, uint ageToCompleteBy, double desirePerPoint, ushort conditionDepth, bool allowVimVis, CalculateDesireFunc desireFunc) :
            base(mage, ageToCompleteBy, desirePerPoint, conditionDepth, desireFunc)
        {
            _visTypes    = visTypes;
            _allowVimVis = allowVimVis;
            _auraCount   = mage.KnownAuras.Count;
            if (_auraCount == 0)
            {
                _currentAura = 0;
                _currentVis  = 0;
            }
            else
            {
                // TODO: we should go to the aura with the most vis "cap space", not the largest
                Aura bestAura = mage.KnownAuras.Aggregate((a, b) => a.Strength > b.Strength ? a : b);
                _currentAura = bestAura.Strength;
                _currentVis  = bestAura.VisSources.Sum(vs => vs.Amount);
            }

            _currentScore = mage.GetAbility(Abilities.MagicLore).Value + mage.GetAttribute(AttributeType.Perception).Value + (mage.GetCastingTotal(MagicArtPairs.InVi) / 10);
        }