public void PraticeSkill(Skill skill) { PracticeSkill(skill, PracticeType.normal); }
/// <summary> /// Checks whether a character is high enough level to have access to a particular skill. /// Since skills are class-based, it uses a check of the player's class to get the answer. /// /// If any of the CharClass items used in this call become private we'll have to rewrite /// this _function to forward the request. /// </summary> /// <param name="skill">The skill number.</param> /// <returns></returns> private bool HasLevelForSkill(Skill skill) { if (skill == null) return false; return HasLevelForSkill(skill.Name); }
/// <summary> /// Practice a skill. Has a random chance of improving the skill. /// </summary> /// <param name="skill"></param> public void PracticeSkill( Skill skill, PracticeType practiceType ) { if( IsNPC() || practiceType == PracticeType.none) { return; } int aptitude = 0; if (((PC)this).SkillAptitude.ContainsKey(skill.Name)) { aptitude = ((PC)this).SkillAptitude[skill.Name]; } int chance = 5 + (GetCurrInt() / 10); // Modify for difficulty. We can't do anything about 'only on success', so we assume it // succeeded if they made it into this function. switch (practiceType) { default: break; case PracticeType.easy: chance *= 2; break; case PracticeType.difficult: chance /= 2; break; } // Have to be below the max and below 95% and make a successful // skill check and be able to have the skill. if (HasLevelForSkill(skill) && (aptitude < Limits.MAX_SKILL_ADEPT) // Cap skill gains at 26 + 2x the number of levels the char is past gaining the skill. && aptitude < (26 + (2 * Level - skill.ClassAvailability[(int)CharacterClass.ClassNumber])) && MUDMath.NumberRange( 1, 1000 ) <= ( 5 + ( GetCurrInt() / 10 ) ) ) { ((PC)this).SkillAptitude[skill.Name] = aptitude + 1; string buf = "&+cYe feel yer skill in " + skill.Name + " improving.&n\r\n"; SendText( buf ); } return; }