예제 #1
0
        protected override void DoAction(Character character)
        {
            double experienceDifference = character.GetAbility(Topic).Experience - Student.GetAbility(Topic).Experience;

            if (experienceDifference <= 0)
            {
                throw new ArgumentOutOfRangeException("Teacher has nothing to teach this student!");
            }
            double quality = character.GetAbility(Abilities.Teaching).Value + character.GetAttributeValue(AttributeType.Communication) + 6;

            Student.Advance(new Learn(quality, character.GetAbility(Topic).Value, Topic, character));
            Completed = true;
        }
예제 #2
0
        protected override void DoAction(Character character)
        {
            double abilityDifference = character.GetAbility(AbilityToTrain).Value - Student.GetAbility(AbilityToTrain).Value;

            if (abilityDifference <= 0)
            {
                throw new ArgumentOutOfRangeException("Trainer has nothing to teach this student!");
            }
            double amountTrained = 3 + character.GetAbility(AbilityToTrain).Value;

            if (amountTrained > abilityDifference)
            {
                amountTrained = abilityDifference;
            }
            Student.GetAbility(AbilityToTrain).AddExperience(amountTrained);
        }
예제 #3
0
        protected override void DoAction(Character character)
        {
            double scribeAbilityValue = character.GetAbility(Abilities.Scribing).Value;

            if (Book.Level == 1000)
            {
                Tractatus tract = new Tractatus
                {
                    Author  = Book.Author,
                    Quality = Book.Quality,
                    Title   = Book.Title,
                    Topic   = Book.Topic
                };
                character.AddBookToCollection(tract);
            }
            else
            {
                // TODO: implement logic for copying summae
            }
        }
예제 #4
0
 public void Act(Character character)
 {
     character.GetAbility(_topic).AddExperience(_quality, _maxLevel);
 }
예제 #5
0
 public override void Act(Character character)
 {
     character.GetAbility(Ability).AddExperience(2);
 }
예제 #6
0
 public override sealed void Act(Character character)
 {
     DoMageAction(ConfirmCharacterIsMage(character));
      	        character.GetAbility(_exposure).AddExperience(2);
 }
예제 #7
0
 public override void Act(Character character)
 {
     character.GetAbility(Ability).AddExperience(2);
 }
예제 #8
0
 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;
             }
         }
     }
 }
예제 #9
0
 public virtual double GetRemainingTotal(Character character)
 {
     double currentTotal = 0;
     foreach (Ability ability in _abilities)
     {
         currentTotal += character.GetAbility(ability).Value;
     }
     return _total - currentTotal;
 }
예제 #10
0
 public IList<BookDesire> GetBookNeeds(Character character)
 {
     List<BookDesire> bookDesires = new List<BookDesire>();
     if (!_hasLab.IsComplete(character))
     {
         var bookNeeds = _hasLab.GetBookNeeds(character);
         if (bookNeeds != null)
         {
             bookDesires.AddRange(bookNeeds);
         }
     }
     if (_isVimSufficient && !IsComplete(character))
     {
         foreach (Ability ability in _extractAbilities)
         {
             bookDesires.Add(new BookDesire(ability, character.GetAbility(ability).Value));
         }
     }
     return bookDesires;
 }
예제 #11
0
 public override sealed void Act(Character character)
 {
     DoMageAction(ConfirmCharacterIsMage(character));
     character.GetAbility(_exposure).AddExperience(2);
 }
예제 #12
0
 public void Act(Character character)
 {
     DoAction(character);
     character.GetAbility(Exposure).AddExperience(2);
 }
예제 #13
0
 public void Act(Character character)
 {
     character.GetAbility(_topic).AddExperience(_quality, _maxLevel);
 }
예제 #14
0
 public virtual void Act(Character character)
 {
     character.Log.Add("Practicing " + Ability.AbilityName);
     character.GetAbility(Ability).AddExperience(4);
 }
예제 #15
0
 protected override void DoAction(Character character)
 {
     double experienceDifference = character.GetAbility(Topic).Experience - Student.GetAbility(Topic).Experience;
     if (experienceDifference <= 0)
     {
         throw new ArgumentOutOfRangeException("Teacher has nothing to teach this student!");
     }
     double quality = character.GetAbility(Abilities.Teaching).Value + character.GetAttributeValue(AttributeType.Communication) + 6;
     Student.Advance(new Learn(quality, character.GetAbility(Topic).Value, Topic, character));
     Completed = true;
 }
예제 #16
0
 private double CalculateDesire(Character character)
 {
     double quality = character.GetAttribute(AttributeType.Communication).Value + 6;
     // assuming someone half as skilled as the book provides
     double expValue = Level * (Level + 1) / 4.0;
     double bookSeasons = expValue / quality;
     double value =  character.RateSeasonalExperienceGain(Topic, quality) * bookSeasons;
     double seasons = Level / (character.GetAttribute(AttributeType.Communication).Value + character.GetAbility(Abilities.Latin).Value);
     if (!_isArt)
     {
         seasons *= 5;
     }
     return value / seasons;
 }
예제 #17
0
 protected override void DoAction(Character character)
 {
     double abilityDifference = character.GetAbility(AbilityToTrain).Value - Student.GetAbility(AbilityToTrain).Value;
     if (abilityDifference <= 0)
     {
         throw new ArgumentOutOfRangeException("Trainer has nothing to teach this student!");
     }
     double amountTrained = 3 + character.GetAbility(AbilityToTrain).Value;
     if (amountTrained > abilityDifference)
     {
         amountTrained = abilityDifference;
     }
     Student.GetAbility(AbilityToTrain).AddExperience(amountTrained);
 }
예제 #18
0
 public override IList<BookDesire> GetBookNeeds(Character character)
 {
     if (IsComplete(character) || IsCompletable(character))
     {
         return null;
     }
     List<BookDesire> bookDesires = new List<BookDesire>();
     double abilityCount = _abilities.Count;
     foreach (Ability ability in _abilities)
     {
         double currentLevel = character.GetAbility(ability).Value;
         //double minLevel = ((_total - currentLevel) / abilityCount) + currentLevel;
         bookDesires.Add(new BookDesire(ability, currentLevel));
     }
     return bookDesires;
 }
예제 #19
0
 protected override void DoAction(Character character)
 {
     double scribeAbilityValue = character.GetAbility(Abilities.Scribing).Value;
     if(Book.Level == 1000)
     {
         Tractatus tract = new Tractatus
         {
             Author = Book.Author,
             Quality = Book.Quality,
             Title = Book.Title,
             Topic = Book.Topic
         };
         character.AddBookToCollection(tract);
     }
     else
     {
         // TODO: implement logic for copying summae
     }
 }
예제 #20
0
        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
                }
            }
        }
예제 #21
0
 public void Act(Character character)
 {
     DoAction(character);
      	        character.GetAbility(Exposure).AddExperience(2);
 }
예제 #22
0
 public override double GetRemainingTotal(Character character)
 {
     double currentTotal = 0;
     foreach (Ability ability in _abilities)
     {
         currentTotal += character.GetAbility(ability).Value;
     }
     foreach(AttributeType attribute in _attributes)
     {
         currentTotal += character.GetAttribute(attribute).Value;
     }
     return _total - currentTotal;
 }
예제 #23
0
 public virtual void Act(Character character)
 {
     character.Log.Add("Practicing " + Ability.AbilityName);
     character.GetAbility(Ability).AddExperience(4);
 }