当前位置: 首页>>代码示例>>C#>>正文


C# Mobile.HarmfulCheck方法代码示例

本文整理汇总了C#中Mobile.HarmfulCheck方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.HarmfulCheck方法的具体用法?C# Mobile.HarmfulCheck怎么用?C# Mobile.HarmfulCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mobile的用法示例。


在下文中一共展示了Mobile.HarmfulCheck方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnSwing

		public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) {
			// Make sure we've been standing still for one second
			if( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.AOS ? 0.5 : 1.0 )) || (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( defender ) ) {
					attacker.DisruptiveAction();
					attacker.Send( new Swing( 0, attacker, defender ) );

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

				return GetDelay( attacker );
			} else {
				return TimeSpan.FromSeconds( 0.25 );
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:32,代码来源:BaseThrowingWeap.cs

示例2: OnSwing

		public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
		{
			// Make sure we've been standing still for .25/.5/1 second depending on Era
			if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( 1.0 )) )
			{
				if ( attacker.HarmfulCheck( defender ) )
				{
					attacker.DisruptiveAction();
					attacker.Send( new Swing( 0, attacker, defender ) );

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

				attacker.RevealingAction();

				return GetDelay( attacker );
			}
			else
			{
				attacker.RevealingAction();

				return TimeSpan.FromSeconds( 0.25 );
			}
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:30,代码来源:BaseRanged.cs

示例3: OnSwing

		public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
		{
			WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );

			// Make sure we've been standing still for .25/.5/1 second depending on Era
			if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) || (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 );
					}
				}

                #region Dueling
                if (attacker is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)attacker;

                    if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this))
                        canSwing = false;
                }
                #endregion


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

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

				attacker.RevealingAction();

				return GetDelay( attacker );
			}
			else
			{
				attacker.RevealingAction();

				return TimeSpan.FromSeconds( 0.25 );
			}
		}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:57,代码来源:BaseRanged.cs

示例4: OnTarget

			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted is Mobile )
				{
					Mobile m = (Mobile)targeted;
			
					if ( m != from && from.HarmfulCheck( m ) )
					{
						Direction to = from.GetDirectionTo( m );

						from.Direction = to;

						from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 );

						if ( Utility.RandomDouble() <= (Math.Sqrt( from.Dex / 100.0 ) * 1.0) )
						{
							from.MovingEffect( m, 0x10E5, 7, 1, false, false, 0x481, 0 );
							AOS.Damage( m, from, Utility.Random( 5, from.Str / 10 ), 100, 0, 0, 0, 0 );
							m.Paralyze( TimeSpan.FromSeconds( 10 ) );
							Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from );
							
						}
						else
						{
							int x = 0, y = 0;

							switch ( to & Direction.Mask )
							{
								case Direction.North: --y; break;
								case Direction.South: ++y; break;
								case Direction.West: --x; break;
								case Direction.East: ++x; break;
								case Direction.Up: --x; --y; break;
								case Direction.Down: ++x; ++y; break;
								case Direction.Left: --x; ++y; break;
								case Direction.Right: ++x; --y; break;
							}

							x += Utility.Random( -1, 3 );
							y += Utility.Random( -1, 3 );

							x += m.X;
							y += m.Y;

							from.MovingEffect( m_MBoomerang, 0x10E5, 7, 1, false, false, 0x481, 0 );

							from.SendMessage( "You miss." );
							Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from );
						}
				
					}
				}
			}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:53,代码来源:Boomerang.cs

示例5: OnSwing

		public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
		{
			if ( attacker.HarmfulCheck( defender ) )
			{
				attacker.DisruptiveAction();

				if ( attacker.NetState != null )
					attacker.Send( new Swing( 0, attacker, defender ) );

				if ( CheckHit( attacker, defender ) )
					OnHit( attacker, defender, damageBonus );
				else
					OnMiss( attacker, defender );
			}

			return GetDelay( attacker );
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:17,代码来源:BaseWeapon.cs

示例6: OnSwing

        public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
        {
            bool canSwing = true;
            int OldSwingState = attacker.SwingState;
            int NewSwingState = this.AdvanceSwingState(attacker);

            if (OldSwingState == NewSwingState)
                return TimeSpan.Zero;

            if (NewSwingState < 2)
                return TimeSpan.Zero;

            if (NewSwingState == 2)
                PlaySwingAnimation(attacker);

            if (NewSwingState == 3 && attacker.HarmfulCheck(defender))
            {
                attacker.DisruptiveAction();

                if (attacker.NetState != null)
                    attacker.Send(new Swing(0, attacker, defender));

                if (attacker is BaseCreature)
                {
                    BaseCreature bc = (BaseCreature)attacker;
                    WeaponAbility ab = bc.GetWeaponAbility();

                    if (ab != null)
                    {
                        if (bc.WeaponAbilityChance > Utility.RandomDouble())
                            WeaponAbility.SetCurrentAbility(bc, ab);
                        else
                            WeaponAbility.ClearCurrentAbility(bc);
                    }
                }

                if (CheckHit(attacker, defender))
                    OnHit(attacker, defender, damageBonus);
                else
                    OnMiss(attacker, defender);
            }

            return GetDelay( attacker );
        }
开发者ID:Godkong,项目名称:RunUO,代码行数:44,代码来源:BaseWeapon.cs

示例7: HARMFULCHECK

			public static bool HARMFULCHECK(TriggerObject trigObject, Mobile from, Mobile to)
			{
				return from != null && to != null && from.HarmfulCheck(to);
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:4,代码来源:UberScriptFunctions.cs

示例8: OnSwing

        public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
        {
            // Make sure we've been standing still for one second
            if ( attacker.HarmfulCheck( defender ) )
            {
                attacker.DisruptiveAction();
                attacker.Send( new Swing( 0, attacker, defender ) );

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

            return GetDelay( attacker );
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:19,代码来源:BaseRanged.cs

示例9: OnSwing

        public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
        {
            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)
                {
                    PlayerMobile p = attacker as PlayerMobile;

                    canSwing = (p == null || p.PeacedUntil <= DateTime.Now);
                }
            }

            if (attacker is Player && attacker.Weapon is Fists )
            {
                Item weapon = attacker.Weapon as Fists;

                if (attacker is Player)
                {
                    Pugilist pug = Perk.GetByType<Pugilist>((Player)attacker);

                    if (pug != null)
                    {
                        pug.MartialArt(attacker, defender);
                    }
                }

                if (attacker != null)
                {
                    if (attacker.Stam < 2)
                    {
                        attacker.SendMessage("You do not have the stamina to swing your fists.");
                        canSwing = false;
                    }
                    else
                    {
                        if (CanMoveEquipped(attacker))
                            attacker.Stam -= 2;
                    }
                }
            }

            if (Parent is Player && attacker.Weapon is BaseWeapon)
            {
                Item weapon = attacker.Weapon as BaseWeapon;

                if (weapon != null)
                {
                    if (attacker.Stam < (int)(((weapon.Weight + 2) / 2) + 2))
                        {
                            canSwing = false;
                            attacker.SendMessage("You do not have the stamina to swing your weapon.");
                        }
                        else
                        {
                            if(CanMoveEquipped(attacker))
                                attacker.Stam -= (int)(((weapon.Weight + 2) / 2) + 2);
                        }             
                }
            }          

            if( canSwing && attacker.HarmfulCheck(defender) )
            {
                attacker.DisruptiveAction();

                if( attacker.NetState != null )
                    attacker.Send(new Swing(0, attacker, defender));

                if( attacker is BaseCreature )
                {
                    BaseCreature bc = (BaseCreature)attacker;
                    WeaponAbility ab = bc.GetWeaponAbility();

                    if( ab != null )
                    {
                        if( bc.WeaponAbilityChance > Utility.RandomDouble() )
                            WeaponAbility.SetCurrentAbility(bc, ab);
                        else
                            WeaponAbility.ClearCurrentAbility(bc);
                    }
                }

                if( CheckHit(attacker, defender) )
                    OnHit(attacker, defender, damageBonus);
                else
                    OnMiss(attacker, defender);

                if (attacker.NetState != null)
                    attacker.Send(new Swing(0, attacker, defender));
            }

            return GetDelay(attacker);
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:hubroot,代码行数:101,代码来源:BaseWeapon.cs

示例10: OnTarget

            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Dagger.Deleted )
                {
                    return;
                }
                else if ( !from.Items.Contains( m_Dagger ) )
                {
                    from.SendMessage( "You must be holding that weapon to use it." );
                }
                else if ( targeted is Mobile )
                {
                    Mobile m = (Mobile)targeted;

                    if ( m != from && from.HarmfulCheck( m ) )
                    {
                        Direction to = from.GetDirectionTo( m );

                        from.Direction = to;

                        from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 );

                        if ( Utility.RandomDouble() >= (Math.Sqrt( m.Dex / 100.0 ) * 0.8) )
                        {
                            from.MovingEffect( m, 0x1BFE, 7, 1, false, false, 0x481, 0 );

                            AOS.Damage( m, from, Utility.Random( 5, from.Str / 10 ), 100, 0, 0, 0, 0 );

                            m_Dagger.MoveToWorld( m.Location, m.Map );
                        }
                        else
                        {
                            int x = 0, y = 0;

                            switch ( to & Direction.Mask )
                            {
                                case Direction.North: --y; break;
                                case Direction.South: ++y; break;
                                case Direction.West: --x; break;
                                case Direction.East: ++x; break;
                                case Direction.Up: --x; --y; break;
                                case Direction.Down: ++x; ++y; break;
                                case Direction.Left: --x; ++y; break;
                                case Direction.Right: ++x; --y; break;
                            }

                            x += Utility.Random( -1, 3 );
                            y += Utility.Random( -1, 3 );

                            x += m.X;
                            y += m.Y;

                            m_Dagger.MoveToWorld( new Point3D( x, y, m.Z ), m.Map );

                            from.MovingEffect( m_Dagger, 0x1BFE, 7, 1, false, false, 0x481, 0 );

                            from.SendMessage( "You miss." );
                        }
                    }
                }
            }
开发者ID:Godkong,项目名称:Origins,代码行数:61,代码来源:ThrowingDagger.cs

示例11: OnSwing

        public override TimeSpan OnSwing(Mobile attacker, Mobile defender)
        {
            WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker);
            //attacker.SendMessage(this.SwingState.ToString());
            /*if (DateTime.Now <= (attacker.LastMoveTime + TimeSpan.FromSeconds(0.25)))
            {

                return TimeSpan.Zero;
            }*/
            // Make sure we've been standing still for .25/.5/1 second depending on Era
            /*if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0))) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot))
            {*/
            bool canSwing = true;
            int OldSwingState = attacker.SwingState;
            int NewSwingState = this.AdvanceSwingState(attacker);
            if (OldSwingState == NewSwingState)
                return TimeSpan.Zero;
            if (NewSwingState < 2)
                return TimeSpan.Zero;

            if (NewSwingState == 2)
            {
                if (!OnFired(attacker, defender))
                {
                    this.ResetSwingState(1);
                    return TimeSpan.Zero;
                }
                PlaySwingAnimation(attacker);
                //attacker.PlaySound(GetMissAttackSound(attacker, defender));
                attacker.DisruptiveAction();
                attacker.Send(new Swing(0, attacker, defender));

                if (CheckHit(attacker, defender))
                    OnHit(attacker, defender);
                else
                    OnMiss(attacker, defender);
            }

            if (NewSwingState == 3 && attacker.HarmfulCheck(defender))
            {

                /*if (OnFired(attacker, defender))
                {*/

                //}
            }

            attacker.RevealingAction();

            return GetDelay(attacker);
            /*}
            else
            {
                attacker.RevealingAction();

                return TimeSpan.FromSeconds(0.25);
            }*/
        }
开发者ID:Godkong,项目名称:Origins,代码行数:58,代码来源:BaseRanged.cs

示例12: OnSwing

        public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
        {
            WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker);

            if (this.Parent is Player)
            {
                Marksman mm = Perk.GetByType<Marksman>((Player)this.Parent);

                if (mm != null && mm.RunAndGun())
                {
                    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(defender))
                    {
                        attacker.DisruptiveAction();
                        attacker.Send(new Swing(0, attacker, defender));

                        Item weapon = this as BaseRanged;

                        if (weapon != null)
                        {
                            if (((Player)this.Parent).Stam < (int)(((weapon.Weight + 2) / 2) + 3))
                            {
                                canSwing = false;
                                ((Player)this.Parent).SendMessage("You do not have the stamina to draw your bow.");
                            }
                            else
                            {
                                ((Player)this.Parent).Stam -= (int)(((weapon.Weight + 2) / 2) + 3);
                            }
                        }

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

                    attacker.RevealingAction();

                    return GetDelay(attacker);
                }
            }

            // Make sure we've been standing still for .25/.5/1 second depending on Era
            if( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0))) || (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(defender) )
                {
                    attacker.DisruptiveAction();
                    attacker.Send(new Swing(0, attacker, defender));

                    Item weapon = this as BaseRanged;

                    if (Parent is Player)
                    {
                        if (weapon != null)
                        {
                            if (((Player)this.Parent).Stam < (int)(((weapon.Weight + 2) / 2) + 3))
                            {
                                canSwing = false;
                                ((Player)this.Parent).SendMessage("You do not have the stamina to draw your bow.");
                            }
                            else
                            {
                                ((Player)this.Parent).Stam -= (int)(((weapon.Weight + 2) / 2) + 3);
                            }
                        }
                    }

                    if( OnFired(attacker, defender) )
//.........这里部分代码省略.........
开发者ID:ITLongwell,项目名称:Ulmeta,代码行数:101,代码来源:BaseRanged.cs

示例13: OnSwing

        public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
        {
            // Make sure we've been standing still for 0.5 seconds
            if ( DateTime.Now > ( attacker.LastMoveTime + TimeSpan.FromSeconds( 0.5 ) ) || ( WeaponAbility.GetCurrentAbility( attacker ) is MovingShot ) )
            {
                if ( CanSwing( attacker ) && attacker.HarmfulCheck( defender ) )
                {
                    attacker.DisruptiveAction();
                    attacker.Send( new Swing( 0, attacker, defender ) );

                    Effects.SendPacket( attacker, attacker.Map, new GraphicalEffect( EffectType.Moving, attacker.Serial, defender.Serial, ItemID, attacker.Location, defender.Location, 18, 0, false, 2 ) );

                    if ( CheckHit( attacker, defender ) )
                        OnHit( attacker, defender );
                    else
                        OnMiss( attacker, defender );
                }

                return GetDelay( attacker );
            }
            else
            {
                return TimeSpan.FromSeconds( 0.5 + ( 0.25 * Utility.RandomDouble() ) );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:25,代码来源:BaseThrowing.cs

示例14: OnSwing

        public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
        {
            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( defender ) )
            {
                attacker.DisruptiveAction();

                // Swing packet causes the client to begin automatically changing direction
                // every few seconds to face the attacker, a feature that has never been in zulu -- jabs
                /*
                if ( attacker.NetState != null )
                    attacker.Send( new Swing( 0, attacker, defender ) );
                */

                //Removed weapon ability -- jabs
                /*
                if ( attacker is BaseCreature )
                {
                    BaseCreature bc = (BaseCreature)attacker;
                    WeaponAbility ab = bc.GetWeaponAbility();

                    if ( ab != null )
                    {
                        if ( bc.WeaponAbilityChance > Utility.RandomDouble() )
                            WeaponAbility.SetCurrentAbility( bc, ab );
                        else
                            WeaponAbility.ClearCurrentAbility( bc );
                    }
                }*/

                if (CheckHit(attacker, defender))
                {
                    OnHit( attacker, defender, damageBonus );
                }
                else
                    OnMiss(attacker, defender);
            }

            return GetDelay( attacker );
        }
开发者ID:notsentient,项目名称:RunZHA,代码行数:53,代码来源:BaseWeapon.cs

示例15: OnSwing

        public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
        {
            //Remove weapon ability -- jabs
            /*WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );*/

            // Make sure we've been standing still for .25/.5/1 second depending on Era
            if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) /*|| (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( defender ) && Map.LineOfSight(attacker, defender) )
                {
                    attacker.DisruptiveAction();

                    // Swing packet causes the client to begin automatically changing direction
                    // every few seconds to face the attacker, a feature that has never been in zulu -- jabs
                    //attacker.Send( new Swing( 0, attacker, defender ) );

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

                attacker.RevealingAction();

                return GetDelay( attacker );
            }
            else
            {
                attacker.RevealingAction();

                return TimeSpan.FromSeconds( 0.25 );
            }
        }
开发者ID:notsentient,项目名称:RunZHA,代码行数:50,代码来源:BaseRanged.cs


注:本文中的Mobile.HarmfulCheck方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。