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