예제 #1
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));
                }
            }
        }
예제 #2
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));
            }
        }
예제 #3
0
        protected void HandleVisUse(Magus mage, CharacterAbilityBase magicArt, ConsideredActions alreadyConsidered, IList <string> log)
        {
            // see if the mage has enough vis of this type
            double stockpile  = mage.GetVisCount(magicArt.Ability);
            double visNeed    = 0.5 + (magicArt.Value / 10.0);
            double increase   = magicArt.GetValueGain(mage.VisStudyRate);
            double baseDesire = CalculateDesire(increase) / (BaseTier + 1);

            if (BaseDueDate != null)
            {
                baseDesire /= (double)BaseDueDate;
            }
            // if so, assume vis will return an average of 6XP + aura
            if (stockpile > visNeed)
            {
                log.Add("Studying vis for " + magicArt.Ability.AbilityName + " worth " + baseDesire.ToString("0.00"));
                VisStudying visStudy = new VisStudying(magicArt.Ability, baseDesire);
                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 (baseDesire >= 0.01)
            {
                List <Ability> visType = new List <Ability>();
                visType.Add(magicArt.Ability);
                VisCondition visCondition =
                    new VisCondition(visType, visNeed - stockpile, baseDesire, (byte)(BaseTier + 1), BaseDueDate == null ? null : BaseDueDate - 1);
                visCondition.ModifyActionList(mage, alreadyConsidered, log);
            }
        }
예제 #4
0
        protected void HandlePractice(Character character, ConsideredActions alreadyConsidered, IList <string> log, Ability ability)
        {
            // Handle Practice
            // For now, assume 4pt practice on everything
            // after lots of math, the right equation is:
            // Desire * (labTotal + increase)/(labTotal + increase + level)
            double increase = character.GetAbility(ability).GetValueGain(4);
            double desire   = CalculateDesire(increase) / (BaseTier + 1);

            if (BaseDueDate != null)
            {
                desire /= (double)BaseDueDate;
            }
            Practice practiceAction = new Practice(ability, desire);

            log.Add("Practicing " + ability.AbilityName + " worth " + (desire).ToString("0.00"));
            alreadyConsidered.Add(practiceAction);
        }
예제 #5
0
        protected void HandleReading(Character character, ConsideredActions alreadyConsidered, IEnumerable <IBook> topicalBooks)
        {
            if (topicalBooks.Any())
            {
                var bestBook =
                    (from book in topicalBooks
                     orderby character.GetBookLevelGain(book),
                     book.Level ascending
                     select book).First();
                double increase = character.GetBookLevelGain(bestBook);
                double desire   = CalculateDesire(increase) / (BaseTier + 1);
                if (BaseDueDate != null)
                {
                    desire /= (double)BaseDueDate;
                }

                Reading readingAction = new Reading(bestBook, desire);
                alreadyConsidered.Add(readingAction);
            }
        }
예제 #6
0
 protected void HandlePractice(Character character, ConsideredActions alreadyConsidered, IList<string> log, Ability ability)
 {
     // Handle Practice
     // For now, assume 4pt practice on everything
     // after lots of math, the right equation is:
     // Desire * (labTotal + increase)/(labTotal + increase + level)
     double increase = character.GetAbility(ability).GetValueGain(4);
     double desire = CalculateDesire(increase) / (BaseTier + 1);
     if (BaseDueDate != null)
     {
         desire /= (double)BaseDueDate;
     }
     Practice practiceAction = new Practice(ability, desire);
     log.Add("Practicing " + ability.AbilityName + " worth " + (desire).ToString("0.00"));
     alreadyConsidered.Add(practiceAction);
 }
예제 #7
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));
                }
            }
        }
예제 #8
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));
            }
        }
예제 #9
0
 protected void HandleVisUse(Magus mage, CharacterAbilityBase magicArt, ConsideredActions alreadyConsidered, IList<string> log)
 {
     // see if the mage has enough vis of this type
     double stockpile = mage.GetVisCount(magicArt.Ability);
     double visNeed = 0.5 + (magicArt.Value / 10.0);
     double increase = magicArt.GetValueGain(mage.VisStudyRate);
     double baseDesire = CalculateDesire(increase) / (BaseTier + 1);
     if (BaseDueDate != null)
     {
         baseDesire /= (double)BaseDueDate;
     }
     // if so, assume vis will return an average of 6XP + aura
     if (stockpile > visNeed)
     {
         log.Add("Studying vis for " + magicArt.Ability.AbilityName + " worth " + baseDesire.ToString("0.00"));
         VisStudying visStudy = new VisStudying(magicArt.Ability, baseDesire);
         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 (baseDesire >= 0.01)
     {
         List<Ability> visType = new List<Ability>();
         visType.Add(magicArt.Ability);
         VisCondition visCondition =
             new VisCondition(visType, visNeed - stockpile, baseDesire, (byte)(BaseTier + 1), BaseDueDate == null ? null : BaseDueDate - 1);
         visCondition.ModifyActionList(mage, alreadyConsidered, log);
     }
 }
예제 #10
0
        protected void HandleReading(Character character, ConsideredActions alreadyConsidered, IEnumerable<IBook> topicalBooks)
        {
            if (topicalBooks.Any())
            {
                var bestBook =
                    (from book in topicalBooks
                     orderby character.GetBookLevelGain(book),
                             book.Level ascending
                     select book).First();
                double increase = character.GetBookLevelGain(bestBook);
                double desire = CalculateDesire(increase) / (BaseTier + 1);
                if (BaseDueDate != null)
                {
                    desire /= (double)BaseDueDate;
                }

                Reading readingAction = new Reading(bestBook, desire);
                alreadyConsidered.Add(readingAction);
            }
        }