Ejemplo n.º 1
0
        public double GetValueGain(double experience, double levelLimit = 0)
        {
            CharacterAbilityBase copy = MakeCopy();

            copy.AddExperience(experience, levelLimit);
            return(copy.Value - Value);
        }
Ejemplo n.º 2
0
        public virtual void ReadBook(IBook book)
        {
            Log.Add("Reading " + book.Title);
            CharacterAbilityBase ability = GetAbility(book.Topic);
            bool previouslyRead          = _booksRead.Contains(book);

            if (!previouslyRead || (book.Level != 1000 && ability.Value < book.Level))
            {
                ability.AddExperience(book.Quality, book.Level);
            }
            if (!previouslyRead)
            {
                _booksRead.Add(book);
            }
        }
Ejemplo n.º 3
0
        public virtual double GetAbilityMaximumFromReading(Ability ability)
        {
            CharacterAbilityBase charAbility = GetAbility(ability).MakeCopy();
            double value = charAbility.Value;
            var    books = GetReadableBooksFromCollection(ability);
            IBook  summa = books.Where(b => b.Level < 1000).OrderBy(b => b.Level).FirstOrDefault();

            if (summa != null && summa.Level > value)
            {
                charAbility.AddExperience(1000, summa.Level);
            }
            foreach (IBook book in books.Where(b => b.Level == 1000))
            {
                charAbility.AddExperience(book.Quality);
            }
            return(charAbility.Value);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Works on a summa on the given topic.
        /// If the work invested is not enough to finish a book on that topic,
        /// the incomplete work is added to the list
        /// </summary>
        /// <param name="topic"></param>
        /// <param name="desiredLevel"></param>
        /// <returns>the summa if it is completed, null otherwise</returns>
        protected Summa WriteSumma(Ability topic, string name, double desiredLevel)
        {
            Summa s;
            CharacterAbilityBase ability = GetAbility(topic);
            Summa previousWork           = _incompleteBooks.Where(b => b.Title == name).FirstOrDefault();

            if (previousWork == null)
            {
                double difference = (ability.Value / 2) - desiredLevel;
                if (difference < 0)
                {
                    throw new ArgumentOutOfRangeException();
                }
                s = new Summa()
                {
                    Author  = this,
                    Level   = desiredLevel,
                    Topic   = topic,
                    Title   = name,
                    Quality = MagicArts.IsArt(ability.Ability) ?
                              this.GetAttribute(AttributeType.Communication).Value + difference + 6 :
                              this.GetAttribute(AttributeType.Communication).Value + (difference * 3) + 6
                };
            }
            else
            {
                s = previousWork;
            }

            s.PointsComplete += this.GetAttribute(AttributeType.Communication).Value + GetAbility(_writingLanguage).Value;
            if (s.PointsComplete >= s.GetWritingPointsNeeded())
            {
                _booksWritten.Add(s);
                if (previousWork != null)
                {
                    _incompleteBooks.Remove(previousWork);
                }
                return(s);
            }
            return(null);
        }
Ejemplo n.º 6
0
        public double RateLifetimeBookValue(IBook book, CharacterAbilityBase charAbility = null)
        {
            if (book.Level == 1000)
            {
                return(RateSeasonalExperienceGain(book.Topic, book.Quality));
            }
            if (charAbility == null)
            {
                charAbility = GetAbility(book.Topic);
            }

            if (charAbility.Value >= book.Level)
            {
                return(0);
            }

            double expValue    = charAbility.GetExperienceUntilLevel(book.Level);
            double bookSeasons = expValue / book.Quality;

            return(RateSeasonalExperienceGain(book.Topic, book.Quality) * bookSeasons);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Determines the value of an experience gain in terms of the value of vis,
        /// and the amount of time it would take the character to produce and learn from
        /// that amount of vis
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="gain"></param>
        /// <returns>the vis equivalence (vis savings) of this gain relative to vis study</returns>
        public override double RateSeasonalExperienceGain(Ability ability, double gain)
        {
            if (!MagicArts.IsArt(ability))
            {
                return(base.RateSeasonalExperienceGain(ability, gain));
            }
            double baseDistillVisRate = GetVisDistillationRate();
            double distillVisRate     = baseDistillVisRate;

            if (MagicArts.IsTechnique(ability))
            {
                distillVisRate /= 4.0;
            }
            else if (ability != MagicArts.Vim)
            {
                distillVisRate /= 2.0;
            }

            CharacterAbilityBase charAbility = GetAbility(ability);
            double visUsedPerStudySeason     = 0.5 + ((charAbility.Value + (charAbility.GetValueGain(gain) / 2)) / 10.0);
            // the gain per season depends on how the character views vis
            double studySeasons = gain / VisStudyRate;
            double visNeeded    = studySeasons * visUsedPerStudySeason;
            // compare to the number of seasons we would need to extract the vis
            // plus the number of seasons we would need to study the extracted vis
            double extractTime        = visNeeded / distillVisRate;
            double totalVisEquivalent = (extractTime + studySeasons) * baseDistillVisRate;

            // credit back the value of the exposure gained in the process of distilling
            double exposureGained                = 2.0 * extractTime;
            double exposureSeasonsOfVis          = exposureGained / VisStudyRate;
            CharacterAbilityBase vim             = GetAbility(MagicArts.Vim);
            CharacterAbilityBase creo            = GetAbility(MagicArts.Creo);
            CharacterAbilityBase exposureAbility = creo.Value < vim.Value ? creo : vim;
            double visValueOfExposure            = 0.5 + ((exposureAbility.Value + (exposureAbility.GetValueGain(exposureGained) / 2)) / 10.0) * exposureSeasonsOfVis;

            return(totalVisEquivalent - visValueOfExposure);
        }
Ejemplo n.º 8
0
 public bool CanWriteTractatus(CharacterAbilityBase charAbility)
 {
     return(charAbility.GetTractatiiLimit() > GetTractatiiWrittenOnTopic(charAbility.Ability));
 }