public override bool IsComplete(Character character) { return character.GetType() == typeof(Magus) && ((Magus)(character)).Apprentice != _apprentice; }
public bool IsComplete(Character character) { // TODO: there's nothing preventing a character from having multiple apprentices return character.GetType() == typeof(Magus) && ((Magus)character).Apprentice != null; }
public override void ModifyActionList(Character character, ConsideredActions alreadyConsidered, IList<string> log) { double remainingTotal = GetRemainingTotal(character); if(remainingTotal <= 0) { return; } double dueDateDesire = Desire / (Tier + 1); if (DueDate != null) { if (DueDate == 0) { log.Add("Ability Condition failed!"); return; } dueDateDesire /= (double)DueDate; } if (dueDateDesire > 0.01 && Tier <= 10) { IEnumerable<IBook> readableBooks = character.ReadableBooks; foreach (Ability ability in _abilities) { bool isArt = MagicArts.IsArt(ability); CharacterAbilityBase charAbility = character.GetAbility(ability); // Handle Reading var topicalBooks = readableBooks.Where(b => b.Topic == ability); AddReading(character, alreadyConsidered, topicalBooks, remainingTotal, dueDateDesire); // Abilities get practice, arts get vis study if (!isArt && (ability.AbilityType != AbilityType.Supernatural || charAbility.Value > 0)) { double desire = dueDateDesire * charAbility.GetValueGain(4) / remainingTotal; log.Add("Practicing " + ability.AbilityName + " worth " + desire.ToString("0.00")); Practice practiceAction = new Practice(ability, desire); alreadyConsidered.Add(practiceAction); } else if (isArt && character.GetType() == typeof(Magus)) { Magus mage = (Magus)character; HandleVisUse(mage, charAbility, remainingTotal, dueDateDesire, alreadyConsidered, log); } // TODO: Learning By Training // TODO: Learning by Teaching } } }
public override void ModifyVisNeeds(Character character, VisDesire[] desires) { if (!IsComplete(character)) { foreach (Ability ability in _abilities) { if (MagicArts.IsArt(ability) && character.GetType() == typeof(Magus)) { CharacterAbilityBase charAbility = character.GetAbility(ability); double experienceNeeded = charAbility.GetExperienceUntilLevel(_total); double visPer = 0.5 + (charAbility.Value + _total) / 20.0; double visNeeded = experienceNeeded * visPer / ((Magus)(character)).VisStudyRate; desires[charAbility.Ability.AbilityId % 300].Quantity += visNeeded; } } } }
public void ModifyActionList(Character character, ConsideredActions alreadyConsidered, IList<string> log) { if (character.GetType() == typeof(Magus)) { Magus mage = (Magus)character; Desire = CalculateDesire(mage); double visNeed = character.SeasonalAge / 20.0; VisCondition visCondition = new VisCondition(_artsRequired, visNeed, Desire, Tier, DueDate == null ? null : DueDate - 1); bool visComplete = visCondition.IsComplete(character); bool labComplete = _hasLabCondition.IsComplete(character); if (!visComplete) { visCondition.ModifyActionList(character, alreadyConsidered, log); } if (!labComplete) { _hasLabCondition.Desire = Desire; _hasLabCondition.ModifyActionList(character, alreadyConsidered, log); } if (visComplete && labComplete) { //effectively, every five points of lab total is worth a decade of effectiveness double dueDateDesire = Desire / (Tier + 1); if (DueDate != null) { if (DueDate == 0) { log.Add("Not enough time to perform longevity ritual"); return; } dueDateDesire /= (double)DueDate; } if (DueDate == null || DueDate < 4) { log.Add("Performing longevity ritual worth " + dueDateDesire.ToString("0.00")); alreadyConsidered.Add(new LongevityRitual(Abilities.MagicTheory, dueDateDesire)); } double labTotalDesire = mage.GetLabTotal(MagicArtPairs.CrVi, Activity.DistillVis) * 8; if (DueDate != null) { labTotalDesire /= (double)DueDate; } // every point of lab total is effectively two years LongevityRitualAbilitiesHelper helper = new LongevityRitualAbilitiesHelper(labTotalDesire, (byte)(Tier + 1), DueDate == null ? null : DueDate - 1); helper.ModifyActionList(character, alreadyConsidered, log); } } }
public bool IsComplete(Character character) { if (character.GetType() != typeof(Magus)) { throw new ArgumentException("Only magi can have Vis conditions"); } Magus mage = (Magus)character; double total = 0; foreach (Ability visType in _visTypes) { total += mage.GetVisCount(visType); } return total >= _total; }
public bool IsComplete(Character character) { if (character.GetType() != typeof(Magus)) { throw new ArgumentException("Only magi have lab totals!"); } Magus mage = (Magus)character; return _hasLabCondition.IsComplete(character) && mage.GetLabTotal(_artPair, _labWorkType) >= _total; }
protected Magus ConfirmCharacterIsMage(Character character) { if (typeof(Magus) != character.GetType()) { throw new InvalidCastException("Only magi can extract vis!"); } return (Magus)character; }
protected override void DoAction(Character character) { if (character.GetType() == typeof(Magus)) { character.Log.Add("Searching for a vis site in aura " + Aura.Strength.ToString("0.00")); Magus mage = (Magus)character; // add bonus to area lore equal to casting total div 5? // TODO: once spells are implemented, increase finding chances based on aura-detection spells double magicLore = mage.GetAbility(Abilities.MagicLore).Value; magicLore += mage.GetAttribute(AttributeType.Perception).Value; magicLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 5; double roll = Die.Instance.RollDouble() * 5; // die roll will be 0-5; area lore will be between 0 and 25; aura will be 0-9, giving vis counts of 0-35 double visSourceFound = Math.Sqrt(roll * magicLore * Aura.Strength); visSourceFound -= Aura.VisSources.Select(v => v.AnnualAmount).Sum(); if (visSourceFound > 1.0) { Season seasons = DetermineSeasons(ref visSourceFound); Ability art = DetermineArt(); string logMessage = art.AbilityName + " vis source of size " + visSourceFound.ToString("0.00") + " found: "; if ((seasons & Season.Spring) == Season.Spring) { logMessage += "Sp"; } if ((seasons & Season.Summer) == Season.Summer) { logMessage += "Su"; } if ((seasons & Season.Autumn) == Season.Autumn) { logMessage += "Au"; } if ((seasons & Season.Winter) == Season.Winter) { logMessage += "Wi"; } mage.Log.Add(logMessage); Aura.VisSources.Add(new VisSource(Aura, art, seasons, visSourceFound)); } } }
protected override void DoAction(Character character) { character.Log.Add("Searched for an aura"); // see if the character can safely spont aura-finding spells if (typeof(Magus) == character.GetType()) { MageAuraSearch((Magus)character); } else { CharacterAuraSearch(character); } // TODO: store knowledge of locations // TODO: as we go, eventually, do we want locations to be set, rather than generated upon finding? }
protected override void DoAction(Character character) { // see if the character can safely spont gift-finding spells if (typeof(Magus) == character.GetType()) { MageApprenticeSearch((Magus)character); } else { CharacterApprenticeSearch(character); } }