public override bool Matches(IAction action) { if (action.Action != Activity.Teach) { return(false); } Teach teach = (Teach)action; return(teach.Student == this.Student && teach.Topic == this.Topic); }
public override void ModifyActionList(Character character, ConsideredActions alreadyConsidered, IList<string> log) { double dueDateDesire = Desire / (double)(Tier + 1); if(DueDate != null) { if (DueDate > 0) { dueDateDesire /= (double)DueDate; } else { character.Log.Add("Behind schedule on teaching!"); } } Magus mage = (Magus)character; // TODO: figure out what to teach Ability ability = Abilities.MagicTheory; double xpDiff = mage.GetAbility(ability).Experience - mage.Apprentice.GetAbility(ability).Experience; double quality = mage.GetAttributeValue(AttributeType.Communication) + mage.GetAbility(Abilities.Teaching).Value + 6.0; if (quality > xpDiff) { var arts = mage.GetAbilities().Where(a => MagicArts.IsArt(a.Ability)).OrderBy(a => a.Value); foreach (CharacterAbilityBase art in arts) { xpDiff = art.Experience - mage.Apprentice.GetAbility(art.Ability).Experience; if (quality <= xpDiff) { ability = art.Ability; break; } } } _teachAction = new Teach(Students.First(), ability, Abilities.Teaching, dueDateDesire); alreadyConsidered.Add(_teachAction); }