示例#1
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Item.Deleted )
					return;

				/*if ( targeted is Item && !((Item)targeted).IsStandardLoot() )
				{
					from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
				}
				else */
				if( Core.AOS && targeted == from )
				{
					from.SendLocalizedMessage( 1062845 + Utility.Random( 3 ) );	//"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
				}
				else if( Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && ( DateTime.Now - from.LastMoveTime ) < from.ComputeMovementSpeed( from.Direction ) )
				{
					from.SendLocalizedMessage( 1063305 ); // Didn't your parents ever tell you not to run with scissors in your hand?!
				}
				else if( targeted is IScissorable )
				{
					IScissorable obj = (IScissorable)targeted;

					if( obj.Scissor( from, m_Item ) )
						from.PlaySound( 0x248 );
				}
				else
				{
					from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
				}
			}
示例#2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is Item && !((Item)targeted).IsStandardLoot())
                {
                    // Scissors can not be used on that to produce anything.
                    // from.SendLocalizedMessage(502440);

                    if (targeted is IScissorable)
                    {
                        from.SendGump(new BlessedClothingCutGump((IScissorable)targeted, m_Item));
                    }
                    else
                    {
                        from.SendLocalizedMessage(502440);
                    }
                }
                else if (m_Item.EraAOS && targeted == from)
                {
                    // That doesn't seem like the smartest thing to do.
                    // That was an encounter you don't wish to repeat.
                    // Ha! You missed!
                    from.SendLocalizedMessage(1062845 + Utility.Random(3));
                }
                else if (m_Item.EraSE && Utility.RandomDouble() > 0.20 && (from.Direction & Direction.Running) != 0 &&
                         DateTime.UtcNow - from.LastMoveTime < from.ComputeMovementSpeed(from.Direction))
                {
                    // Didn't your parents ever tell you not to run with scissors in your hand?!
                    from.SendLocalizedMessage(1063305);
                }
                else if (targeted is Item && !((Item)targeted).Movable)
                {
                    if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
                    {
                        var obj = (IScissorable)targeted;

                        if (obj.Scissor(from, m_Item))
                        {
                            from.PlaySound(0x248);
                        }
                    }
                }
                else if (targeted is IScissorable)
                {
                    var obj = (IScissorable)targeted;

                    if (obj.Scissor(from, m_Item))
                    {
                        from.PlaySound(0x248);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502440);                     // Scissors can not be used on that to produce anything.
                }
            }
示例#3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                /*if ( targeted is Item && !((Item)targeted).IsStandardLoot() )
                 * {
                 * from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
                 * }
                 * else */
                if (Core.AOS && targeted == from)
                {
                    from.SendLocalizedMessage(1062845 + Utility.Random(3));
                    //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
                }
                else if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 &&
                         (Core.TickCount - from.LastMoveTime) < from.ComputeMovementSpeed(from.Direction))
                {
                    from.SendLocalizedMessage(1063305);                     // Didn't your parents ever tell you not to run with scissors in your hand?!
                }
                else if (targeted is Item && !((Item)targeted).Movable)
                {
                    if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
                    {
                        IScissorable obj = (IScissorable)targeted;

                        if (obj.Scissor(from, m_Item))
                        {
                            from.PlaySound(0x248);

                            if (Siege.SiegeShard)
                            {
                                Siege.CheckUsesRemaining(from, m_Item);
                            }
                        }
                    }
                }
                else if (targeted is IScissorable)
                {
                    IScissorable obj = (IScissorable)targeted;

                    if (obj.Scissor(from, m_Item))
                    {
                        from.PlaySound(0x248);

                        if (Siege.SiegeShard)
                        {
                            Siege.CheckUsesRemaining(from, m_Item);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502440);                     // Scissors can not be used on that to produce anything.
                }
            }
示例#4
0
        public override TimeSpan OnSwing(Mobile attacker, IDamageable damageable)
        {
            long nextShoot;

            if (attacker is PlayerMobile)
            {
                nextShoot = ((PlayerMobile)attacker).NextMovementTime + (Core.SE ? 250 : Core.AOS ? 500 : 1000);
            }
            else
            {
                nextShoot = attacker.LastMoveTime + attacker.ComputeMovementSpeed();
            }

            // Make sure we've been standing still for .25/.5/1 second depending on Era
            if (nextShoot <= Core.TickCount ||
                (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot))
            {
                bool canSwing = true;

                if (Core.AOS)
                {
                    canSwing = (!attacker.Paralyzed && !attacker.Frozen);

                    if (canSwing)
                    {
                        Spell sp = attacker.Spell as Spell;

                        canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement);
                    }
                }

                if (canSwing && attacker.HarmfulCheck(damageable))
                {
                    attacker.DisruptiveAction();
                    attacker.Send(new Swing(0, attacker, damageable));

                    if (OnFired(attacker, damageable))
                    {
                        if (CheckHit(attacker, damageable))
                        {
                            OnHit(attacker, damageable);
                        }
                        else
                        {
                            OnMiss(attacker, damageable);
                        }
                    }
                }

                attacker.RevealingAction();

                return(GetDelay(attacker));
            }

            attacker.RevealingAction();

            return(TimeSpan.FromSeconds(0.25));
        }
示例#5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                PlayerMobile player = from as PlayerMobile;

                if (m_Item.Deleted)
                {
                    return;
                }

                if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && (Core.TickCount - from.LastMoveTime) < from.ComputeMovementSpeed(from.Direction))
                {
                    from.SendLocalizedMessage(1063305);                       // Didn't your parents ever tell you not to run with scissors in your hand?!
                }

                else if (targeted is Item && !((Item)targeted).Movable)
                {
                    if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
                    {
                        IScissorable obj = (IScissorable)targeted;

                        if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
                        {
                            from.PlaySound(0x248);
                        }
                    }
                }

                else if (targeted is IScissorable)
                {
                    IScissorable obj = (IScissorable)targeted;

                    if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
                    {
                        from.PlaySound(0x248);
                    }
                }

                else
                {
                    from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything.
                }
            }
示例#6
0
    public bool AddStep(Direction d)
    {
        if (Mobile == null)
        {
            return false;
        }

        _steps ??= new long[CalcMoves.MaxSteps + 1]; // Extra index as a sentinel
        var stepsLength = _steps.Length;

        var now = Core.TickCount;

        var lastIndex = -1;

        // Expire old steps
        while (_expiredIndex != _stepIndex)
        {
            var step = _steps[_expiredIndex];

            // Is the step ahead of us, or the next step rolled over and we didn't yet
            if (step > now || lastIndex > -1 && _steps[lastIndex] > step)
            {
                break;
            }

            lastIndex = _expiredIndex++;

            if (_expiredIndex == stepsLength)
            {
                _expiredIndex -= stepsLength;
            }
        }

        var stepsTaken = (_stepIndex < _expiredIndex ? _stepIndex + stepsLength : _stepIndex) - _expiredIndex;
        var maxSteps = _steps.Length - 1;

        // Can we take a step?
        if (stepsTaken >= maxSteps)
        {
            return false;
        }

        var delay = Mobile.ComputeMovementSpeed(d);

        var prev = _stepIndex - 1;
        if (prev < 0)
        {
            prev += stepsLength;
        }

        // Give a 5% buffer on the first step
        _steps[_stepIndex++] = stepsTaken > 0 ? _steps[prev] + delay : now + delay * 950 / 1000;

        if (_stepIndex == stepsLength)
        {
            _stepIndex -= stepsLength;
        }

        // If CalcMoves.MaxSteps is modified, we need to adjust accordingly
        AdjustSteps(CalcMoves.MaxSteps);

        return true;
    }
示例#7
0
        public bool AddStep(Direction d)
        {
            if (Mobile == null)
            {
                return(false);
            }

            var maxSteps = CalcMoves.MaxSteps;

            _stepDelays ??= new long[maxSteps];
            var length = _stepDelays.Length;

            var index = _stepIndex - _stepCount;

            if (index < 0)
            {
                index += length;
            }

            var now  = Core.TickCount;
            var last = _startDelay;

            // Discard old steps by decrementing the step counter
            while (index != _stepIndex || _stepCount >= maxSteps)
            {
                var step = _stepDelays[index++];
                if (now - last < step)
                {
                    break;
                }

                last += step;
                _stepCount--;
                if (index >= length)
                {
                    index = 0;
                }
            }

            _startDelay = last;

            // If we are out of steps, fail
            if (_stepCount >= maxSteps)
            {
                return(false);
            }

            var delay = Mobile.ComputeMovementSpeed(d);

            // Add the delay
            _stepDelays[_stepIndex++] = delay;

            if (_stepIndex >= length)
            {
                _stepIndex = 0;
            }

            if (_stepCount == 0)
            {
                _startDelay = now;
            }
            _stepCount++;

            return(true);
        }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is BaseArmor && ((BaseArmor)targeted).LootType == LootType.Cursed)
                {
                    from.SendMessage("It would be unwise to put cursed goods to such use.");
                }
                else if (targeted == from)
                {
                    from.SendLocalizedMessage(1062845 + Utility.Random(3));                             //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
                }
                else if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && (DateTime.Now - from.LastMoveTime) < from.ComputeMovementSpeed(from.Direction))
                {
                    from.SendLocalizedMessage(1063305);                       // Didn't your parents ever tell you not to run with scissors in your hand?!
                }
                else if (targeted is Item && !((Item)targeted).Movable)
                {
                    if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
                    {
                        IScissorable obj = (IScissorable)targeted;

                        if (obj.Scissor(from, m_Item))
                        {
                            from.PlaySound(0x248);
                        }
                    }
                }
                else if (targeted is IScissorable)
                {
                    IScissorable obj = (IScissorable)targeted;

                    if (obj.Scissor(from, m_Item))
                    {
                        from.PlaySound(0x248);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502440);                       // Scissors can not be used on that to produce anything.
                }
            }
示例#9
0
			protected override void OnTarget(Mobile from, object targeted)
			{
				if (m_Item.Deleted)
				{
					return;
				}

				if (targeted is Item && !((Item)targeted).IsStandardLoot())
				{
					// Scissors can not be used on that to produce anything.
					// from.SendLocalizedMessage(502440); 

					if (targeted is IScissorable)
					{
						from.SendGump(new BlessedClothingCutGump((IScissorable)targeted, m_Item));
					}
					else
					{
						from.SendLocalizedMessage(502440);
					}
				}
				else if (m_Item.EraAOS && targeted == from)
				{
					// That doesn't seem like the smartest thing to do.
					// That was an encounter you don't wish to repeat.
					// Ha! You missed!
					from.SendLocalizedMessage(1062845 + Utility.Random(3));
				}
				else if (m_Item.EraSE && Utility.RandomDouble() > 0.20 && (from.Direction & Direction.Running) != 0 &&
						 DateTime.UtcNow - from.LastMoveTime < from.ComputeMovementSpeed(from.Direction))
				{
					// Didn't your parents ever tell you not to run with scissors in your hand?!
					from.SendLocalizedMessage(1063305);
				}
				else if (targeted is Item && !((Item)targeted).Movable)
				{
					if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
					{
						var obj = (IScissorable)targeted;

						if (obj.Scissor(from, m_Item))
						{
							from.PlaySound(0x248);
						}
					}
				}
				else if (targeted is IScissorable)
				{
					var obj = (IScissorable)targeted;

					if (obj.Scissor(from, m_Item))
					{
						from.PlaySound(0x248);
					}
				}
				else
				{
					from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything.
				}
			}
示例#10
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted == from)
                {
                    // "That doesn't seem like the smartest thing to do."
                    // "That was an encounter you don't wish to repeat."
                    // "Ha! You missed!"
                    from.SendLocalizedMessage(1062845 + Utility.Random(3));
                }
                else if (Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && (DateTime.UtcNow - from.LastMoveTime) < from.ComputeMovementSpeed(from.Direction))
                {
                    from.SendLocalizedMessage(1063305);                       // Didn't your parents ever tell you not to run with scissors in your hand?!
                }
                else if (targeted is Item && (!((Item)targeted).Movable || ((Item)targeted).QuestItem))
                {
                    from.SendLocalizedMessage(502440);                       // Scissors can not be used on that to produce anything.
                }
                else if (targeted is Mobile || (targeted is Item && !((Item)targeted).IsChildOf(from.Backpack)))
                {
                    from.SendLocalizedMessage(502437);                       // Items you wish to cut must be in your backpack.
                }
                else if (targeted is IScissorable)
                {
                    IScissorable obj = (IScissorable)targeted;

                    if (obj.Scissor(from, m_Item))
                    {
                        from.PlaySound(0x248);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502440);                       // Scissors can not be used on that to produce anything.
                }
            }
示例#11
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                /*if ( targeted is Item && !((Item)targeted).IsStandardLoot() )
                 * {
                 *      from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
                 * }
                 * else */
                if (targeted is NubiaPlayer)
                {
                    NubiaPlayer client = targeted as NubiaPlayer;
                    if (client.InRange(from.Location, 1))
                    {
                        from.SendGump(new GumpCoiffeur(from as NubiaPlayer, client));
                    }
                    else
                    {
                        from.SendMessage("vous êtes trop loin");
                    }
                }
                else if (Core.AOS && targeted == from)
                {
                    from.SendLocalizedMessage(1062845 + Utility.Random(3));     //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
                }
                else if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && (DateTime.Now - from.LastMoveTime) < from.ComputeMovementSpeed(from.Direction))
                {
                    from.SendLocalizedMessage(1063305); // Didn't your parents ever tell you not to run with scissors in your hand?!
                }
                else if (targeted is Item && !((Item)targeted).Movable)
                {
                    return;
                }
                else if (targeted is IScissorable)
                {
                    IScissorable obj = (IScissorable)targeted;

                    if (obj.Scissor(from, m_Item))
                    {
                        from.PlaySound(0x248);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything.
                }
            }
示例#12
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Item.Deleted )
					return;

				/*if ( targeted is Item && !((Item)targeted).IsStandardLoot() )
				{
					from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
				}
				else */
				if( Core.AOS && targeted == from )
				{
					from.SendLocalizedMessage( 1062845 + Utility.Random( 3 ) );	//"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
				}
				else if( Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && ( DateTime.Now - from.LastMoveTime ) < from.ComputeMovementSpeed( from.Direction ) )
				{
					from.SendLocalizedMessage( 1063305 ); // Didn't your parents ever tell you not to run with scissors in your hand?!
				}
				else if( targeted is Item && !((Item)targeted).Movable ) 
				{
					if( targeted is IScissorable && ( targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore ) )
					{
						IScissorable obj = (IScissorable) targeted;

                        if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
                            from.PlaySound(0x248);
					}
				}
                else if (targeted is PlayerMobile)
                {
                    PlayerMobile hair = (PlayerMobile)targeted;
                    
                    if(hair.HairItemID == 0)
                    {
                        from.SendMessage("Cette personne est chauve");
                        return;
                    }

                    int delay = 4;
                    if (from.Dex > 80)
                        delay--;
                    if (from.Skills[SkillName.Stealing].Value > 50)
                        delay--;

                    from.Say("*Approche discrètement, ciseaux à la main*");
                    Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback<object[]>(CutHair), new object[] { from, hair });
                }
				else if( targeted is IScissorable )
				{
					IScissorable obj = (IScissorable)targeted;

                    if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
                        from.PlaySound(0x248);
				}
				else
				{
					from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
				}
			}
示例#13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                /*if ( targeted is Item && !((Item)targeted).IsStandardLoot() )
                 * {
                 *      from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
                 * }
                 * else */
                if (Core.AOS && targeted == from)
                {
                    from.SendLocalizedMessage(1062845 + Utility.Random(3));                             //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
                }
                else if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && (DateTime.Now - from.LastMoveTime) < from.ComputeMovementSpeed(from.Direction))
                {
                    from.SendLocalizedMessage(1063305);                       // Didn't your parents ever tell you not to run with scissors in your hand?!
                }
                else if (targeted is Item && !((Item)targeted).Movable)
                {
                    if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
                    {
                        IScissorable obj = (IScissorable)targeted;

                        if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
                        {
                            from.PlaySound(0x248);
                        }
                    }
                }
                else if (targeted is PlayerMobile)
                {
                    PlayerMobile hair = (PlayerMobile)targeted;

                    if (hair.HairItemID == 0)
                    {
                        from.SendMessage("Cette personne est chauve");
                        return;
                    }

                    int delay = 4;
                    if (from.Dex > 80)
                    {
                        delay--;
                    }
                    if (from.Skills[SkillName.Stealing].Value > 50)
                    {
                        delay--;
                    }

                    from.Say("*Approche discrètement, ciseaux à la main*");
                    Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback <object[]>(CutHair), new object[] { from, hair });
                }
                else if (targeted is IScissorable)
                {
                    IScissorable obj = (IScissorable)targeted;

                    if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
                    {
                        from.PlaySound(0x248);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502440);                       // Scissors can not be used on that to produce anything.
                }
            }