Beispiel #1
0
 public HasLabCondition(double value, byte tier, uint? dueDate = null)
 {
     _desire = value;
     DueDate = dueDate;
     Tier = tier;
     _hasCovenant = new HasCovenantCondition(value, tier, dueDate == null ? null : dueDate - 2);
     _mtCondition = new AbilityScoreCondition(Abilities.MagicTheory, 3, value, tier, dueDate == null ? null : dueDate - 1);
 }
Beispiel #2
0
        public HasApprenticeCondition(double desire = 1, byte tier = 0, uint? dueDate = null)
        {
            DueDate = dueDate;
            Tier = tier;
            Desire = desire;

            // TODO: remove the magic number
            _artRequirements = new AbilityScoreCondition[15];
            uint? modifiedDueDate = dueDate == null || dueDate < 3 ? null : dueDate - 2;
            byte nextTier = (byte)(tier + 1);
            _artRequirements[0] = new AbilityScoreCondition(MagicArts.Creo, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[1] = new AbilityScoreCondition(MagicArts.Intellego, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[2] = new AbilityScoreCondition(MagicArts.Muto, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[3] = new AbilityScoreCondition(MagicArts.Perdo, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[4] = new AbilityScoreCondition(MagicArts.Rego, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[5] = new AbilityScoreCondition(MagicArts.Animal, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[6] = new AbilityScoreCondition(MagicArts.Aquam, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[7] = new AbilityScoreCondition(MagicArts.Auram, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[8] = new AbilityScoreCondition(MagicArts.Corpus, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[9] = new AbilityScoreCondition(MagicArts.Herbam, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[10] = new AbilityScoreCondition(MagicArts.Ignem, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[11] = new AbilityScoreCondition(MagicArts.Imaginem, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[12] = new AbilityScoreCondition(MagicArts.Mentem, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[13] = new AbilityScoreCondition(MagicArts.Terram, 5, Desire,
                nextTier, modifiedDueDate);
            _artRequirements[14] = new AbilityScoreCondition(MagicArts.Vim, 5, Desire,
                nextTier, modifiedDueDate);
        }
Beispiel #3
0
        public TractatusGoal(Ability topic, string name, ushort writtenCount, byte tier = 0, uint? dueDate = null)
        {
            Topic = topic;
            Tier = tier;
            DueDate = dueDate;

            _name = name;
            _previouslyWritten = writtenCount;
            _isArt = MagicArts.IsArt(topic);

            _writingAbilityCondition = new AbilityScoreCondition(Abilities.ArtesLiberales, 1, 0, (byte)(tier + 1), dueDate == null ? null : dueDate - 3);
            _languageAbilityCondition = new AbilityScoreCondition(Abilities.Latin, 5, 0, (byte)(tier + 1), dueDate == null ? null : dueDate - 2);
            double scoreNeeded = MagicArts.IsArt(topic) ? 5 * writtenCount + 5 : writtenCount + 1;
            if(scoreNeeded < 2)
            {
                scoreNeeded = 2;
            }
            _abilityScoreCondition = new AbilityScoreCondition(topic, scoreNeeded, 0, (byte)(tier + 1), dueDate == null ? null : dueDate - 1);
        }
Beispiel #4
0
        public void ModifyActionList(Character character, ConsideredActions alreadyConsidered, IList<string> log)
        {
            double dueDateDesire = Desire / (Tier + 1);
            if (DueDate != null)
            {
                if (DueDate == 0)
                {
                    log.Add("Vis Goal Failed");
                    return;
                }
                dueDateDesire /= (double)DueDate;
            }
            if (dueDateDesire > 0.01)
            {
                Magus mage = (Magus)character;
                bool hasLab = _hasLab.IsComplete(character);

                if (_isVimSufficient)
                {
                    // determine value of extracting vis from aura

                    if (!hasLab)
                    {
                        // if we don't have a lab, we need a lab
                        _hasLab.ModifyActionList(character, alreadyConsidered, log);
                    }
                    else
                    {
                        // Now we need to consider both the value of starting to distill vis now
                        // and the value of instead learning more before doing so.
                        double labTotal = mage.GetLabTotal(MagicArtPairs.CrVi, Activity.DistillVis);
                        double currentRate = labTotal / 10;
                        if (currentRate >= _total)
                        {
                            // we can get what we want in one season, go ahead and do it
                            log.Add("Extracting vis worth " + (dueDateDesire).ToString("0.00"));
                            alreadyConsidered.Add(new VisExtracting(Abilities.MagicTheory, dueDateDesire));
                        }
                        else
                        {
                            // we are in the multi-season-to-fulfill scenario
                            double desire = currentRate * dueDateDesire / _total;
                            log.Add("Extracting vis worth " + (desire).ToString("0.00"));
                            alreadyConsidered.Add(new VisExtracting(Abilities.MagicTheory, desire));

                            // the difference between the desire of starting now
                            // and the desire of starting after gaining experience
                            // is the effective value of practicing here

                            // TODO: this should really be a lab total increse, yes?
                            IncreaseAbilitiesForVisHelper helper = new IncreaseAbilitiesForVisHelper(_extractAbilities, Desire, labTotal, (byte)(Tier + 1), DueDate - 1);
                            helper.ModifyActionList(character, alreadyConsidered, log);
                        }
                    }
                }
                // determine current rate of automatic accrual of vis of the desired type
                double annualGain =
                    mage.KnownAuras.SelectMany(a => a.VisSources).Where(v => _visTypes.Contains(v.Art)).Select(v => v.AnnualAmount).Sum();
                if (annualGain == 0 || (DueDate != null && (annualGain * DueDate / 4) < _total))
                {
                    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
                    double magicLore = mage.GetAbility(Abilities.MagicLore).Value;
                    magicLore += mage.GetAttribute(AttributeType.Perception).Value;
                    magicLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 5;
                    if (magicLore > 0)
                    {
                        foreach (Aura aura in mage.KnownAuras)
                        {
                            double averageFind = aura.GetAverageVisSourceSize(magicLore);
                            if (averageFind > 0)
                            {
                                // modify by chance vis will be of the proper type
                                double desire = (averageFind * _visTypes.Count() / 15);

                                // TODO: modify by lifelong value of source?
                                log.Add("Looking for vis source worth " + (desire * dueDateDesire).ToString("0.00"));
                                alreadyConsidered.Add(new FindVisSource(aura, Abilities.MagicLore, desire * dueDateDesire));
                            }
                            // consider the value of getting better at the vis search skills first
                            double currentVis = aura.VisSources.Select(v => v.AnnualAmount).Sum();
                            IncreaseAbilitiesForVisSearchHelper helper =
                                new IncreaseAbilitiesForVisSearchHelper(Desire, currentVis, magicLore, aura.Strength, (byte)(Tier + 1), DueDate == null ? null : DueDate - 1);
                            helper.ModifyActionList(character, alreadyConsidered, log);
                        }
                    }

                    // consider increasing skills to be able to find vis
                    List<Ability> visSourceAbilities = new List<Ability>();
                    visSourceAbilities.Add(MagicArts.Intellego);
                    visSourceAbilities.Add(MagicArts.Vim);
                    visSourceAbilities.Add(Abilities.MagicLore);
                    AbilityScoreCondition condition =
                        new AbilityScoreCondition(visSourceAbilities, 2, Desire, (byte)(Tier + 1), DueDate == null ? null : DueDate - 1);
                    condition.ModifyActionList(character, alreadyConsidered, log);

                    // consider the value of looking for a new aura
                    double areaLore = mage.GetAbility(Abilities.AreaLore).Value;
                    areaLore += mage.GetAttribute(AttributeType.Perception).Value;
                    areaLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 10;
                    if (areaLore > 0 && magicLore > 0)
                    {
                        double auraFound = mage.GetAverageAuraFound();
                        double multiplier = Math.Sqrt(magicLore * auraFound) * 2 / 3;
                        double areaUnder = 11.180339887498948482045868343656 * multiplier;
                        double visFromAura = areaUnder * _visTypes.Count() / 75;
                        dueDateDesire = dueDateDesire * visFromAura * (Tier + 1) / (Tier + 2);
                        log.Add("Looking for aura (to find a vis source in) worth " + (dueDateDesire).ToString("0.00"));
                        alreadyConsidered.Add(new FindAura(Abilities.AreaLore, dueDateDesire));
                    }
                }
            }
        }
Beispiel #5
0
        public SummaGoal(Ability topic, double level, string name, byte tier = 0, uint? dueDate = null)
        {
            Topic = topic;
            Tier = tier;
            DueDate = dueDate;
            Level = level;

            _name = name;
            _isArt = MagicArts.IsArt(topic);

            _writingAbilityCondition = new AbilityScoreCondition(Abilities.ArtesLiberales, 1, 0, (byte)(tier + 1), dueDate == null ? null : dueDate - 3);
            _languageAbilityCondition = new AbilityScoreCondition(Abilities.Latin, 5, 0, (byte)(tier + 1), dueDate == null ? null : dueDate - 2);
            double scoreNeeded = level * 2.0;
            if(scoreNeeded < 2)
            {
                scoreNeeded = 2;
            }
            _abilityScoreCondition = new AbilityScoreCondition(topic, scoreNeeded, 0, (byte)(tier + 1), dueDate == null ? null : dueDate - 1);
        }