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); } } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log) { _currentAura = Mage.Covenant == null ? 0 : Mage.Covenant.Aura.Strength; _auraCount = Mage.KnownAuras.Count; // for now _currentScore= CalculateFindAuraScore(); double probOfBetter = 1 - (_currentAura * _currentAura * _auraCount / (5 * _currentScore)); double maxAura = Math.Sqrt(5.0 * _currentScore / _auraCount); double averageGain = maxAura * probOfBetter / 2.0; double desire = _desireFunc(averageGain, ConditionDepth); if (desire > 0.01) { log.Add("Finding a better aura to build a lab in worth " + desire.ToString("0.00")); alreadyConsidered.Add(new FindAura(Abilities.AreaLore, desire)); // consider the value of increasing find aura related scores //practice area lore PracticeHelper areaLorePracticeHelper = new PracticeHelper(Abilities.AreaLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); areaLorePracticeHelper.AddActionPreferencesToList(alreadyConsidered, log); // read area lore ReadingHelper readAreaLoreHelper = new ReadingHelper(Abilities.AreaLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); // consider value of increasing InVi casting total CastingTotalIncreaseHelper inViHelper = new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy - 1, Desire / 10, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVisUse, _desireFunc); } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log) { _currentAura = Mage.Covenant == null ? 0 : Mage.Covenant.Aura.Strength; _auraCount = Mage.KnownAuras.Count; // for now _currentScore = CalculateFindAuraScore(); double probOfBetter = 1 - (_currentAura * _currentAura * (_auraCount + 1) / (5 * _currentScore)); double maxAura = Math.Sqrt(5.0 * _currentScore / (_auraCount + 1)); double averageGain = maxAura * probOfBetter / 2.0; double desire = _desireFunc(averageGain, ConditionDepth); if (desire > 0.00001) { log.Add("Finding a better aura to build a lab in worth " + desire.ToString("0.000")); alreadyConsidered.Add(new FindAura(Abilities.AreaLore, desire)); // consider the value of increasing find aura related scores //practice area lore PracticeHelper areaLorePracticeHelper = new PracticeHelper(Abilities.AreaLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); areaLorePracticeHelper.AddActionPreferencesToList(alreadyConsidered, log); // read area lore ReadingHelper readAreaLoreHelper = new ReadingHelper(Abilities.AreaLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); // consider value of increasing InVi casting total CastingTotalIncreaseHelper inViHelper = new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy - 1, Desire / 10, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVisUse, _desireFunc); } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log) { if (!ConditionFulfilled) { FindAura findAuraAction = new FindAura(Abilities.AreaLore, this.Desire / (AgeToCompleteBy - Character.SeasonalAge)); alreadyConsidered.Add(findAuraAction); log.Add("Finding an aura worth " + this.Desire.ToString("0.000")); } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log) { if (_desireFunc != null) { double gain = this.Mage.GetAbility(_ability).GetValueGain(4); double practiceDesire = _desireFunc(gain, ConditionDepth); log.Add("Practicing " + _ability.AbilityName + " worth " + practiceDesire.ToString("0.000")); alreadyConsidered.Add(new Practice(_ability, practiceDesire)); } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log) { if (_desireFunc != null) { double alPracticeDesire = _desireFunc(4, ConditionDepth); if (alPracticeDesire > 0.01) { log.Add("Practicing Area Lore before finding a new aura worth " + alPracticeDesire.ToString("0.00")); alreadyConsidered.Add(new Practice(_ability, alPracticeDesire)); } } }
private void AddPracticeToActionList(Ability ability, ConsideredActions alreadyConsidered, IList <string> log) { // For now, assume 4pt practice on everything double effectiveDesire = GetDesirabilityOfIncrease(Character.GetAbility(ability).GetValueGain(4)); if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0) { Practice practiceAction = new Practice(ability, effectiveDesire); log.Add("Practicing " + ability.AbilityName + " worth " + (effectiveDesire).ToString("0.000")); alreadyConsidered.Add(practiceAction); } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log) { var bestBook = Mage.GetBestBookToWrite(); if (bestBook != null) { double effectiveDesire = _desireFunc(bestBook.Value, ConditionDepth); log.Add("Writing " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.000")); Write writingAction = new Write(bestBook.Topic, bestBook.Title, Abilities.Latin, bestBook.Level, effectiveDesire); alreadyConsidered.Add(writingAction); } }
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); } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log) { var bestBook = Mage.GetBestBookToRead(_ability); if (bestBook != null) { double gain = Mage.GetBookLevelGain(bestBook); double effectiveDesire = _desireFunc(gain, ConditionDepth); log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.000")); Read readingAction = new Read(bestBook, effectiveDesire); alreadyConsidered.Add(readingAction); } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList <string> log) { 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 _magicLoreTotal = Mage.GetAbility(Abilities.MagicLore).Value; _magicLoreTotal += Mage.GetAttribute(AttributeType.Perception).Value; _magicLoreTotal += Mage.GetCastingTotal(MagicArtPairs.InVi) / 5; if (Mage.KnownAuras.Any()) { Aura aura = Mage.KnownAuras.OrderByDescending(a => a.GetAverageVisSourceSize(_magicLoreTotal)).First(); double averageFind = aura.GetAverageVisSourceSize(_magicLoreTotal); if (averageFind > 0) { // originally, we modified by chance vis will be of the proper type // this feels wrong; what's probably more sensible is to scale // according to the relative value of vis // so 5 * 4 + 9 * 2 + 1 = 39/15 // that represents the relative value of a random vis source compared to vim vis double gain = (averageFind * 39 / 15); double desire = _desireFunc(gain, ConditionDepth); // TODO: modify by lifelong value of source? log.Add("Looking for vis source worth " + (desire).ToString("0.000")); alreadyConsidered.Add(new FindVisSource(aura, Abilities.MagicLore, desire)); } // consider the value of increasing the casting total first CastingTotalIncreaseHelper castingHelper = new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVis, CalculateScoreGainDesire); castingHelper.AddActionPreferencesToList(alreadyConsidered, log); // consider the value of increasing Magic Lore PracticeHelper practiceHelper = new PracticeHelper(Abilities.MagicLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); practiceHelper.AddActionPreferencesToList(alreadyConsidered, log); ReadingHelper readingHelper = new ReadingHelper(Abilities.MagicLore, Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); readingHelper.AddActionPreferencesToList(alreadyConsidered, log); // TODO: consider increasing Perception } // consider finding a whole new aura FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), !_visTypes.Contains(MagicArts.Vim), CalculateAuraGainDesire); auraHelper.AddActionPreferencesToList(alreadyConsidered, log); }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log) { var bestBook = Mage.GetBestBookToRead(_ability); if (bestBook != null) { double gain = Mage.GetBookLevelGain(bestBook); double effectiveDesire = _desireFunc(gain, ConditionDepth); if (effectiveDesire > 0.01) { log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.00")); Reading readingAction = new Reading(bestBook, effectiveDesire); alreadyConsidered.Add(readingAction); } } }
private void AddReadingToActionList(IEnumerable <IBook> topicalBooks, Ability ability, ConsideredActions alreadyConsidered, IList <string> log) { IBook bestBook = Character.GetBestBookToRead(ability); if (bestBook != null) { double gain = Character.GetBookLevelGain(bestBook); double effectiveDesire = GetDesirabilityOfIncrease(gain); if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0) { log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.000")); Read readingAction = new Read(bestBook, effectiveDesire); alreadyConsidered.Add(readingAction); } } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log) { if(!ConditionFulfilled) { HasAuraCondition auraCondition = new HasAuraCondition(_mage, this.AgeToCompleteBy, this.Desire, (ushort)(this.ConditionDepth + 1)); if(!auraCondition.ConditionFulfilled) { auraCondition.AddActionPreferencesToList(alreadyConsidered, log); } else { BuildLaboratory buildLabAction = new BuildLaboratory(Abilities.MagicTheory, this.Desire / (AgeToCompleteBy - Character.SeasonalAge)); alreadyConsidered.Add(buildLabAction); log.Add("Building a lab worth " + this.Desire.ToString("0.000")); } } }
private void AddVisUseToActionList(Ability art, ConsideredActions alreadyConsidered, IList <string> log) { CharacterAbilityBase magicArt = Mage.GetAbility(art); double stockpile = Mage.GetVisCount(art); double visNeed = 0.5 + (magicArt.Value / 10.0); // if so, assume vis will return an average of 6XP + aura if (stockpile > visNeed) { double gain = magicArt.GetValueGain(Mage.VisStudyRate); double effectiveDesire = _desireFunc(gain, ConditionDepth); VisStudying visStudy = new VisStudying(magicArt.Ability, effectiveDesire); alreadyConsidered.Add(visStudy); // consider the value of finding a better aura to study vis in FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy - 1, Desire, (ushort)(ConditionDepth + 1), AllowVimVisUse, _desireFunc); // TODO: how do we decrement the cost of the vis? } }
public override void AddActionPreferencesToList(ConsideredActions alreadyConsidered, IList<string> log) { 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 _magicLoreTotal = Mage.GetAbility(Abilities.MagicLore).Value; _magicLoreTotal += Mage.GetAttribute(AttributeType.Perception).Value; _magicLoreTotal += Mage.GetCastingTotal(MagicArtPairs.InVi) / 5; if (_magicLoreTotal > 0 && Mage.KnownAuras.Any()) { Aura aura = Mage.KnownAuras.OrderByDescending(a => a.GetAverageVisSourceSize(_magicLoreTotal)).First(); double averageFind = aura.GetAverageVisSourceSize(_magicLoreTotal); if (averageFind > 0) { // modify by chance vis will be of the proper type double gain = (averageFind * _visTypes.Count() / 15); double desire = _desireFunc(gain, ConditionDepth); // TODO: modify by lifelong value of source? log.Add("Looking for vis source worth " + (desire).ToString("0.00")); alreadyConsidered.Add(new FindVisSource(aura, Abilities.MagicLore, desire)); } // consider the value of increasing the casting total first CastingTotalIncreaseHelper castingHelper = new CastingTotalIncreaseHelper(Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), MagicArtPairs.InVi, _allowVimVis, CalculateScoreGainDesire); castingHelper.AddActionPreferencesToList(alreadyConsidered, log); // consider the value of increasing Magic Lore PracticeHelper practiceHelper = new PracticeHelper(Abilities.MagicLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); practiceHelper.AddActionPreferencesToList(alreadyConsidered, log); ReadingHelper readingHelper = new ReadingHelper(Abilities.MagicLore, Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), CalculateScoreGainDesire); readingHelper.AddActionPreferencesToList(alreadyConsidered, log); // TODO: consider increasing Perception } // consider finding a whole new aura FindNewAuraHelper auraHelper = new FindNewAuraHelper(Mage, AgeToCompleteBy, Desire, (ushort)(ConditionDepth + 1), !_visTypes.Contains(MagicArts.Vim), CalculateAuraGainDesire); }
private void AddReadingToActionList(IEnumerable<IBook> topicalBooks, Ability ability, ConsideredActions alreadyConsidered, IList<string> log) { IBook bestBook = Character.GetBestBookToRead(ability); if (bestBook != null) { double gain = Character.GetBookLevelGain(bestBook); double effectiveDesire = GetDesirabilityOfIncrease(gain); if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0) { log.Add("Reading " + bestBook.Title + " worth " + (effectiveDesire).ToString("0.00")); Reading readingAction = new Reading(bestBook, effectiveDesire); alreadyConsidered.Add(readingAction); } } }
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); } } }
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 (!_mage.KnownAuras.Any()) { _auraCondition.AddActionPreferencesToList(alreadyConsidered, log); } else if (_mage.Laboratory == null) { _labCondition.AddActionPreferencesToList(alreadyConsidered, log); } else { double labTotal = _mage.GetLabTotal(MagicArtPairs.CrVi, Activity.DistillVis); double currentDistillRate = labTotal / 10; double extractDesirability = GetDesirabilityOfVisGain(currentDistillRate, ConditionDepth); if (extractDesirability > 0.01) { // we can get what we want in one season, go ahead and do it log.Add("Extracting vis worth " + (extractDesirability).ToString("0.00")); 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 LabTotalIncreaseHelper helper = new LabTotalIncreaseHelper(_mage, AgeToCompleteBy - 1, extractDesirability / labTotal, (ushort)(ConditionDepth + 1), MagicArtPairs.CrVi, false, GetDesirabilityOfLabTotalGain); //helper.ModifyActionList(_mage, alreadyConsidered, log); } } } } // search for vis source FindVisSourceHelper visSourceHelper = new FindVisSourceHelper(_mage, VisTypes, AgeToCompleteBy, Desire, ConditionDepth, !_vimSufficient, GetDesirabilityOfVisGain); } // trade? }
private void AddPracticeToActionList(Ability ability, ConsideredActions alreadyConsidered, IList<string> log) { // For now, assume 4pt practice on everything double effectiveDesire = GetDesirabilityOfIncrease(Character.GetAbility(ability).GetValueGain(4)); if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0) { Practice practiceAction = new Practice(ability, effectiveDesire); log.Add("Practicing " + ability.AbilityName + " worth " + (effectiveDesire).ToString("0.00")); alreadyConsidered.Add(practiceAction); } }