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); } } }
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); } }
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); } }
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 DisplayVis() { Magus mage = (Magus)_character; txtCreoVis.Text = mage.GetVisCount(MagicArts.Creo).ToString(FORMAT_STRING); txtIntellegoVis.Text = mage.GetVisCount(MagicArts.Intellego).ToString(FORMAT_STRING); txtMutoVis.Text = mage.GetVisCount(MagicArts.Muto).ToString(FORMAT_STRING); txtPerdoVis.Text = mage.GetVisCount(MagicArts.Perdo).ToString(FORMAT_STRING); txtRegoVis.Text = mage.GetVisCount(MagicArts.Rego).ToString(FORMAT_STRING); txtAnimalVis.Text = mage.GetVisCount(MagicArts.Animal).ToString(FORMAT_STRING); txtAquamVis.Text = mage.GetVisCount(MagicArts.Aquam).ToString(FORMAT_STRING); txtAuramVis.Text = mage.GetVisCount(MagicArts.Auram).ToString(FORMAT_STRING); txtCorpusVis.Text = mage.GetVisCount(MagicArts.Corpus).ToString(FORMAT_STRING); txtHerbamVis.Text = mage.GetVisCount(MagicArts.Herbam).ToString(FORMAT_STRING); txtIgnemVis.Text = mage.GetVisCount(MagicArts.Ignem).ToString(FORMAT_STRING); txtImaginemVis.Text = mage.GetVisCount(MagicArts.Imaginem).ToString(FORMAT_STRING); txtMentemVis.Text = mage.GetVisCount(MagicArts.Mentem).ToString(FORMAT_STRING); txtTerramVis.Text = mage.GetVisCount(MagicArts.Terram).ToString(FORMAT_STRING); txtVimVis.Text = mage.GetVisCount(MagicArts.Vim).ToString(FORMAT_STRING); }