Ejemplo n.º 1
0
        public virtual bool Matches(IAction action)
        {
            if (action.Action != Activity.Practice)
            {
                return(false);
            }
            Practice practice = (Practice)action;

            return(practice.Ability == this.Ability);
        }
Ejemplo n.º 2
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
                }
            }
        }