예제 #1
0
        public static bool Mobile_SkillCheckDirectTarget(Mobile from, SkillName skillName, object target, double chance)
        {
            var skill = from.Skills[skillName];

            if (from.Skills[skill.SkillName].Value <= 0.0)
            {
                from.SendMessage("You know nothing about how this is done."); return(false);
            }


            #region Level System Skills
            LevelHandler.DoGainSkillExp(from, skill, skillName);
            #endregion

            if (skill == null)
            {
                return(false);
            }

            CrystalBallOfKnowledge.TellSkillDifficulty(from, skillName, chance);

            if (chance < 0.0)
            {
                return(false);                // Too difficult
            }
            if (chance >= 1.0)
            {
                return(true);                // No challenge
            }
            return(CheckSkill(from, skill, target, chance));
        }
예제 #2
0
        public static bool Mobile_SkillCheckLocation(Mobile from, SkillName skillName, double minSkill, double maxSkill)
        {
            var skill = from.Skills[skillName];

            if (from.Skills[skill.SkillName].Value <= 0.0)
            {
                from.SendMessage("You know nothing about how this is done."); return(false);
            }

            #region Level System Skills
            LevelHandler.DoGainSkillExp(from, skill, skillName);
            #endregion

            if (skill == null)
            {
                return(false);
            }

            var value = skill.Value;

            //TODO: Is there any other place this can go?
            if (skillName == SkillName.Fishing && BaseGalleon.FindGalleonAt(from, from.Map) is TokunoGalleon)
            {
                value += 1;
            }

            if (value < minSkill)
            {
                return(false);                // Too difficult
            }
            if (value >= maxSkill)
            {
                return(true);                // No challenge
            }
            var chance = (value - minSkill) / (maxSkill - minSkill);

            CrystalBallOfKnowledge.TellSkillDifficulty(from, skillName, chance);

            return(CheckSkill(from, skill, new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize), chance));
        }