Example #1
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 #2
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);
     }
 }
        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);
                }
            }
        }