Esempio n. 1
0
        public static bool Mobile_SkillCheckLocation(Mobile from, SkillName skillName, double minSkill, double maxSkill)
        {
            var skill = from.Skills[skillName];

            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));
        }
Esempio n. 2
0
        public static bool Mobile_SkillCheckTarget(
            Mobile from,
            SkillName skillName,
            object target,
            double minSkill,
            double maxSkill)
        {
            var skill = from.Skills[skillName];

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

            var value = skill.Value;

            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, target, chance));
        }
Esempio n. 3
0
        public static bool Mobile_SkillCheckLocation(Mobile from, SkillName skillName, double minSkill, double maxSkill)
        {
            Skill skill = from.Skills[skillName];

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

            double value = skill.Value;

            double chance = (value - minSkill) / (maxSkill - minSkill);

            CrystalBallOfKnowledge.TellSkillDifficulty(from, skillName, chance);

            if (chance < 0.0)
            {
                return(false);                // Too difficult
            }
            else if (chance >= (skill.Cap / 100.0))
            {
                return(true);                // No challenge
            }
            Point2D loc = new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize);

            return(CheckSkill(from, skill, loc, chance));
        }
Esempio n. 4
0
		public static bool Mobile_SkillCheckDirectTarget(Mobile from, SkillName skillName, object target, double chance)
		{
			var skill = from.Skills[skillName];

			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);
		}
Esempio n. 5
0
		public static bool Mobile_SkillCheckDirectLocation(Mobile from, SkillName skillName, double chance)
		{
			var skill = from.Skills[skillName];

			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, new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize), chance);
		}
Esempio n. 6
0
        public static bool Mobile_SkillCheckDirectTarget(Mobile from, SkillName skillName, object target, double chance)
        {
            Skill skill = from.Skills[skillName];

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

            CrystalBallOfKnowledge.TellSkillDifficulty(from, skillName, chance);

            if (chance < 0.0)
            {
                return(false); // Too difficult
            }
            else if (chance >= 1.0)
            {
                return(true); // No challenge
            }
            return(CheckSkill(from, skill, target, chance));
        }
Esempio n. 7
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));
        }
Esempio n. 8
0
        public static bool Mobile_SkillCheckTarget(
            Mobile from,
            SkillName skillName,
            object target,
            double minSkill,
            double maxSkill)
        {
            var skill = from.Skills[skillName];

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

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

            var value = skill.Value;

            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);

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

            return(CheckSkill(from, skill, target, chance));
        }
Esempio n. 9
0
        public static bool Mobile_SkillCheckDirectLocation(Mobile from, SkillName skillName, double chance)
        {
            Skill skill = from.Skills[skillName];

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

            CrystalBallOfKnowledge.TellSkillDifficulty(from, skillName, chance);

            if (chance < 0.0)
            {
                return(false); // Too difficult
            }
            else if (chance >= 1.0)
            {
                return(true); // No challenge
            }
            Point2D loc = new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize);

            return(CheckSkill(from, skill, loc, chance));
        }
Esempio n. 10
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            if (m.Target != null)
            {
                m.SendLocalizedMessage(501845); // You are busy doing something else and cannot focus.

                return(TimeSpan.FromSeconds(5.0));
            }

            if (m.Mana >= m.ManaMax)
            {
                m.SendLocalizedMessage(501846); // You are at peace.

                return(TimeSpan.FromSeconds(10.0));
            }

            if (Misc.RegenRates.GetArmorOffset(m) > 0)
            {
                m.SendLocalizedMessage(500135); // Regenative forces cannot penetrate your armor!

                return(TimeSpan.FromSeconds(10.0));
            }

            Item oneHanded = m.FindItemOnLayer(Layer.OneHanded);
            Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded);

            if (m.Player)
            {
                if (!CheckOkayHolding(oneHanded))
                {
                    m.AddToBackpack(oneHanded);
                }

                if (!CheckOkayHolding(twoHanded))
                {
                    m.AddToBackpack(twoHanded);
                }
            }
            else if (!CheckOkayHolding(oneHanded) || !CheckOkayHolding(twoHanded))
            {
                m.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate.

                return(TimeSpan.FromSeconds(2.5));
            }

            double skillVal = m.Skills[SkillName.Meditation].Value;
            double chance   = (50.0 + ((skillVal - (m.ManaMax - m.Mana)) * 2)) / 100;

            // must bypass normal checks so passive skill checks aren't triggered
            CrystalBallOfKnowledge.TellSkillDifficultyActive(m, SkillName.Meditation, chance);

            if (chance > Utility.RandomDouble())
            {
                m.CheckSkill(SkillName.Meditation, 0.0, 100.0);

                m.SendLocalizedMessage(501851); // You enter a meditative trance.
                m.Meditating = true;
                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657));

                if (m.Player || m.Body.IsHuman)
                {
                    m.PlaySound(0xF9);
                }

                m.ResetStatTimers();
            }
            else
            {
                m.SendLocalizedMessage(501850); // You cannot focus your concentration.
            }

            return(TimeSpan.FromSeconds(10.0));
        }