예제 #1
0
        public static bool StartBandageHeal(BaseCreature creature)
        {
            if (creature == null)
            {
                return(false);
            }

            if (creature.HealTarget == null)
            {
                BandageFail(creature);
            }

            creature.HealTarget.BeingBandaged = true;
            creature.BandageOtherReady        = false;

            creature.Emote("*begins bandaging*");

            creature.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5);
            creature.LastSwingTime     = DateTime.UtcNow + TimeSpan.FromSeconds(1.5);

            //Targeting Self
            if (creature == creature.HealTarget)
            {
                if (creature.Body.IsHuman)
                {
                    creature.Animate(33, 5, 1, true, false, 0);
                }

                else
                {
                    creature.Animate(11, 5, 1, true, false, 0);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(creature.CreatureBandageSelfDuration), new TimerStateCallback(EndBandageHeal), new object[] { creature, creature });
            }

            //Targeting Other
            else
            {
                if (creature.Body.IsHuman)
                {
                    creature.Animate(16, 7, 1, true, false, 0);
                }

                else
                {
                    creature.Animate(11, 5, 1, true, false, 0);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(creature.CreatureBandageOtherDuration), new TimerStateCallback(EndBandageHeal), new object[] { creature });
            }

            return(true);
        }
예제 #2
0
        public static void DoDetectHidden(BaseCreature creature)
        {
            if (creature.Deleted || creature.Map == null)
            {
                return;
            }

            creature.Emote("*searches*");

            double skillValue = creature.Skills.DetectHidden.Base;

            double minRange = skillValue / 20;
            double maxRange = skillValue / 10;

            int range = (int)(minRange + ((maxRange - minRange) * Utility.RandomDouble()));

            if (range > 0)
            {
                IPooledEnumerable inRange = creature.Map.GetMobilesInRange(creature.Location, range);

                foreach (Mobile mobile in inRange)
                {
                    if (!mobile.Hidden || !mobile.Alive)
                    {
                        continue;
                    }
                    if (mobile.AccessLevel > AccessLevel.Player)
                    {
                        continue;
                    }
                    if (!creature.InLOS(mobile))
                    {
                        continue;
                    }

                    PlayerMobile player      = mobile as PlayerMobile;
                    BaseCreature bc_Creature = mobile as BaseCreature;

                    bool isPlayer        = (player != null);
                    bool isTamedCreature = false;

                    if (bc_Creature != null)
                    {
                        if (bc_Creature.Controlled && bc_Creature.ControlMaster is PlayerMobile)
                        {
                            isTamedCreature = true;
                        }
                    }

                    if (!(isPlayer || isTamedCreature))
                    {
                        continue;
                    }

                    double revealChance = (skillValue / 100);

                    if (Utility.RandomDouble() < revealChance)
                    {
                        mobile.RevealingAction();
                        mobile.SendMessage("You have been revealed!");
                    }
                }

                inRange.Free();
            }
        }