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.000")); 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.000") + " 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)); } } }
public override void Act(Character character) { Magus mage = ConfirmCharacterIsMage(character); // determine the amount of vis needed CharacterAbilityBase charAbility = mage.GetAbility(Art); double visNeeded = 0.5 + (charAbility.Value / 10.0); // decrement the used vis mage.UseVis(Art, visNeeded); // add experience ushort roll = Die.Instance.RollExplodingDie(); double aura = mage.Covenant != null && mage.Covenant.Aura != null ? mage.Covenant.Aura.Strength : 0; double gain = roll + aura; character.Log.Add("Studying " + visNeeded.ToString("0.000") + " pawns of " + Art.AbilityName + " vis."); character.Log.Add("Gained " + gain + " experience."); charAbility.AddExperience(gain); }
private void MageAuraSearch(Magus mage) { // add bonus to area lore equal to casting total div 10? // TODO: once spells are implemented, increase finding chances based on aura-detection spells double areaLore = mage.GetAbility(Abilities.AreaLore).Value; areaLore += mage.GetAttribute(AttributeType.Perception).Value; areaLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 10; double roll = Die.Instance.RollDouble() * 5; // die roll will be 0-5; area lore will be between 0 and 15, giving auras between 0 and 9 double auraFound = Math.Sqrt(roll * areaLore / (mage.KnownAuras.Count() + 1)); if (auraFound > 1) { Aura aura = new Aura(Domain.Magic, auraFound); mage.Log.Add("Found an aura of strength " + auraFound.ToString("0.000")); mage.KnownAuras.Add(aura); if (mage.Covenant == null || (mage.Laboratory == null && mage.Covenant.Aura.Strength < aura.Strength)) { mage.FoundCovenant(aura); } } }
private void MageAuraSearch(Magus mage) { // add bonus to area lore equal to casting total div 10? // TODO: once spells are implemented, increase finding chances based on aura-detection spells double areaLore = mage.GetAbility(Abilities.AreaLore).Value; areaLore += mage.GetAttribute(AttributeType.Perception).Value; areaLore += mage.GetCastingTotal(MagicArtPairs.InVi) / 10; double roll = Die.Instance.RollDouble() * 5; // die roll will be 0-5; area lore will be between 0 and 15, giving auras between 0 and 9 double auraFound = Math.Sqrt(roll * areaLore / (mage.KnownAuras.Count() + 1)); if (auraFound > 1) { Aura aura = new Aura(Domain.Magic, auraFound); mage.Log.Add("Found an aura of strength " + auraFound.ToString("0.00")); mage.KnownAuras.Add(aura); if (mage.Covenant == null || (mage.Laboratory == null && mage.Covenant.Aura.Strength < aura.Strength)) { mage.FoundCovenant(aura); } } }
private static void DistributeExperience(Magus mage, int extraXP, bool isAcademic, bool isMartial) { var abilities = Abilities.GetEnumerator() .Where(a => a.AbilityType == AbilityType.General || (isAcademic && a.AbilityType == AbilityType.Academic) || (isMartial && a.AbilityType == AbilityType.Martial)); int abilityCount = abilities.Count(); while (extraXP > 0) { int valueAdd = extraXP >= 5 ? 5 : extraXP; int roll = (int)(Die.Instance.RollDouble() * abilityCount); Ability ability = abilities.ElementAt(roll); if (ability.AbilityType == AbilityType.Academic) { if (mage.GetAbility(Abilities.ArtesLiberales).Value < 1) { mage.GetAbility(Abilities.ArtesLiberales).AddExperience(valueAdd); } else if (mage.GetAbility(Abilities.Latin).Value < 3) { mage.GetAbility(Abilities.Latin).AddExperience(valueAdd); } else { mage.GetAbility(ability).AddExperience(valueAdd); } } else { mage.GetAbility(ability).AddExperience(valueAdd); } extraXP -= valueAdd; } }
public static Magus GenerateNewApprentice() { Magus magus = new Magus(Abilities.MagicTheory, Abilities.Latin, Abilities.ArtesLiberales, Abilities.AreaLore); NormalizeAttributes(magus); magus.GetAbility(Abilities.English).AddExperience(75); // randomly assign 45 points to childhood skills in 5 point blocks // Area Lore, Athletics, Awareness, Brawl, Charm, Folk Ken, Guile, Stealth, Survival, Swim double experienceBlock = 5.0; CharacterAbilityBase charAbility = null; for (byte i = 0; i < 9; i++) { switch (Die.Instance.RollSimpleDie()) { case 1: charAbility = magus.GetAbility(Abilities.AreaLore); break; case 2: charAbility = magus.GetAbility(Abilities.Athletics); break; case 3: charAbility = magus.GetAbility(Abilities.Awareness); break; case 4: charAbility = magus.GetAbility(Abilities.Brawl); break; case 5: charAbility = magus.GetAbility(Abilities.Charm); break; case 6: charAbility = magus.GetAbility(Abilities.FolkKen); break; case 7: charAbility = magus.GetAbility(Abilities.Guile); break; case 8: charAbility = magus.GetAbility(Abilities.Stealth); break; case 9: charAbility = magus.GetAbility(Abilities.Survival); break; case 10: charAbility = magus.GetAbility(Abilities.Swim); break; } charAbility.AddExperience(experienceBlock); } // figure out how much older than 5 the child is ushort age = (ushort)(20 + Die.Instance.RollDouble() * 80); // add experience for the additional time. int extraXP = (age - 20) * 4; // for now, lets say 10% chance of academics, 20% of martial bool isAcademic = Die.Instance.RollSimpleDie() == 1; bool isMartial = Die.Instance.RollSimpleDie() <= 2; DistributeExperience(magus, extraXP, isAcademic, isMartial); // TODO: how do we initialize the goals of this new apprentice? InitializeApprenticeGoals(magus); return magus; }