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


C# Mobile.DoHarmful方法代码示例

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


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

示例1: IsEnemy

		public override bool IsEnemy( Mobile m )
		{
			if ( AssassinControl.IsAssassin( m ) )
			{
				m.DoHarmful( this );

				if ( CanFlag )
				{
					AssassinControl.BecomeNotorious( m );
					//m.CriminalAction( false );

					switch( Utility.Random( 5 ) )
					{
						case 0: Say( "Halt!" ); break;
						case 1: Say( "Stop right there!" ); break;
						case 2: Say( "Hey you!" ); break;
						case 3: Say( "I know you." ); break;
						case 4: Say( "Stop that man!" ); break;
						case 5: Say( "Hey!" ); break;
					}
				}

				return true;
			}
			else
				return false;
		}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:27,代码来源:ACreedGuard.cs

示例2: DoFlamestrike

		public void DoFlamestrike( Mobile attacker, Mobile defender )
		{
			if ( !attacker.CanBeHarmful( defender, false ) )
				return;

			attacker.DoHarmful( defender );

			double damage = GetAosDamage( attacker, 48, 1, 5 );
			
			defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
			defender.PlaySound( 0x208 );

			SpellHelper.Damage( TimeSpan.FromSeconds( 1.0 ), defender, attacker, damage, 0, 100, 0, 0, 0 );
		}
开发者ID:nick12344356,项目名称:The-Basement,代码行数:14,代码来源:SearingSpear.cs

示例3: TorchAttack

        /// <summary>
        /// Allows the adventurer to use a torch as a second weapon at <code>PerkLevel.Fifth</code>
        /// </summary>
        public void TorchAttack( Mobile attacker, Mobile defender )
        {
            if (Level == PerkLevel.Fifth)
            {
                Item torch = attacker.FindItemOnLayer(Layer.TwoHanded);
                if (torch != null && torch is Items.Torch)
                {
                    int hitChance = (attacker.Dex / 6);
                    if (hitChance > Utility.RandomMinMax(0, 100))
                    {
                            int torchDamage = Utility.RandomMinMax(1, 5) + (attacker.Str / 10);

                            attacker.DoHarmful(defender);
                            defender.Damage(torchDamage);
                            attacker.SendMessage("You follow through with your torch, using it to strike your opponent.");
                            defender.SendMessage("{0} strikes you with {1} torch.", attacker, attacker.Female ? "her" : "his");
                            attacker.PlaySound(0x142);
                    }                   
                }
            }
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:24,代码来源:Adventurer.cs

示例4: Explode

		public void Explode(Mobile from, bool direct, Point3D loc, Map map)
		{
			if (Deleted)
			{
				return;
			}

			Consume();

			for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;

				if (targ != null && targ.Potion == this)
				{
					Target.Cancel(m);
				}
			}

			if (map == null)
			{
				return;
			}

			Effects.PlaySound(loc, map, 0x307);

			Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
			int alchemyBonus = 0;

			if (direct)
			{
				alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
			}

			IPooledEnumerable eable = LeveledExplosion
										  ? map.GetObjectsInRange(loc, ExplosionRange)
										  : (IPooledEnumerable)map.GetMobilesInRange(loc, ExplosionRange);
			ArrayList toExplode = new ArrayList();

			int toDamage = 0;

			foreach (object o in eable)
			{
				if (o is Mobile &&
					(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
				{
					toExplode.Add(o);
					++toDamage;
				}
				else if (o is BaseExplosionPotion && o != this)
				{
					toExplode.Add(o);
				}
			}

			eable.Free();

			int min = Scale(from, MinDamage);
			int max = Scale(from, MaxDamage);

			for (int i = 0; i < toExplode.Count; ++i)
			{
				object o = toExplode[i];

				if (o is Mobile)
				{
					Mobile m = (Mobile)o;

					if (from != null)
					{
						from.DoHarmful(m);
					}

					int damage = Utility.RandomMinMax(min, max);

					damage += alchemyBonus;

					if (!Core.AOS && damage > 40)
					{
						damage = 40;
					}
					else if (Core.AOS && toDamage > 2)
					{
						damage /= toDamage - 1;
					}

					AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
				}
				else if (o is BaseExplosionPotion)
				{
					BaseExplosionPotion pot = (BaseExplosionPotion)o;

					pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
				}
			}
		}
开发者ID:aj9251,项目名称:ServUO,代码行数:97,代码来源:BaseExplosionPotion.cs

示例5: Explode

		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;

            if (from != null)
            {
                CustomRegion cR = from.Region as CustomRegion;
                CustomRegion cR2 = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion) || (cR2 != null && !cR2.Controller.CanUsePotExplosion))
                    return;
            }
            else
            {
                CustomRegion cR = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion))
                    return;
            }

		    if (!EventItem || (EventItem && EventItemConsume))
                Consume();
            else
            {
                Mobile m;
                if (m_Users != null && m_Users[0] is Mobile)
                    m = (Mobile)m_Users[0];
                else
                    m = from;

                if (m != null && RootParentEntity != m)
                    m.AddToBackpack(this);

                m_Timer = null;
            }

		    for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;

				if ( targ != null && targ.Potion == this )
					Target.Cancel( m );
			}

			if ( map == null )
				return;

			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );

			int alchemyBonus = 0;

            if (direct && from != null)
			    alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));

			IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
			ArrayList toExplode = new ArrayList();

			int toDamage = 0;

			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
				else if ( o is BaseExplosionPotion && o != this )
				{
					toExplode.Add( o );
				}
			}

			eable.Free();

			int min = Scale( from, MinDamage );
			int max = Scale( from, MaxDamage );
		    int count = 1;

			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o = toExplode[i];

				if ( o is Mobile )
				{
				    Mobile m = (Mobile)o;
                    GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                    //Taran: Don't hurt mobiles in guarded
                    if (reg == null || reg.Disabled)
                    {
                        if (from != null && from.CanBeHarmful(m, false))
                        {
                            from.DoHarmful(m);

                            int damage = Utility.RandomMinMax(min, max);

                            damage += alchemyBonus;
//.........这里部分代码省略.........
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:BaseExplosionPotion.cs

示例6: DoDispel

		public virtual void DoDispel(Mobile attacker, Mobile defender)
		{
			bool dispellable = false;

			if (defender is BaseCreature)
			{
				dispellable = ((BaseCreature)defender).Summoned && !((BaseCreature)defender).IsAnimatedDead;
			}

			if (!dispellable)
			{
				return;
			}

			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			MagerySpell sp = new DispelSpell(attacker, null);

			if (sp.CheckResisted(defender))
			{
				defender.FixedEffect(0x3779, 10, 20);
			}
			else
			{
				Effects.SendLocationParticles(
					EffectItem.Create(defender.Location, defender.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
				Effects.PlaySound(defender, defender.Map, 0x201);

				defender.Delete();
			}
		}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:36,代码来源:BaseWeapon.cs

示例7: OnTarget

			protected override void OnTarget( Mobile from, object target )
			{
				from.RevealingAction();

				if ( target is Mobile )
				{
					Mobile targ = (Mobile)target;

					//Pixie - 11/10/04 - added this so discordance is an aggressive action.
					from.DoHarmful( targ );

					if ( targ is BaseCreature && ((BaseCreature)targ).BardImmune )
					{
						from.SendLocalizedMessage( 1049535 ); // A song of discord would have no effect on that.
					}
					else if ( !targ.Player )
					{
						TimeSpan len = TimeSpan.FromSeconds( from.Skills[SkillName.Discordance].Value * 2 );
						double diff = m_Instrument.GetDifficultyFor( targ ) - 10.0;
						double music = from.Skills[SkillName.Musicianship].Value;

						if ( music > 100.0 )
							diff -= (music - 100.0) * 0.5;

						if ( !BaseInstrument.CheckMusicianship( from ) )
						{
							from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
							m_Instrument.PlayInstrumentBadly( from );
							m_Instrument.ConsumeUse( from );
						}
						else if ( from.CheckTargetSkill( SkillName.Discordance, target, diff-25.0, diff+25.0 ) )
						{
							if ( !m_Table.Contains( targ ) )
							{
								from.SendLocalizedMessage( 1049539 ); // You play the song surpressing your targets strength
								m_Instrument.PlayInstrumentWell( from );
								m_Instrument.ConsumeUse( from );

								ArrayList mods = new ArrayList();
								double scalar;

								if ( Core.AOS )
								{
									double discord = from.Skills[SkillName.Discordance].Value;
									int effect;

									if ( discord > 100.0 )
										effect = -20 + (int)((discord - 100.0) / -2.5);
									else
										effect = (int)(discord / -5.0);

									scalar = effect * 0.01;

									mods.Add( new ResistanceMod( ResistanceType.Physical, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Fire, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Cold, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Poison, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Energy, effect ) );

									for ( int i = 0; i < targ.Skills.Length; ++i )
									{
										if ( targ.Skills[i].Value > 0 )
											mods.Add( new DefaultSkillMod( (SkillName)i, true, targ.Skills[i].Value * scalar ) );
									}
								}
								else
								{
									scalar = ( from.Skills[SkillName.Discordance].Value / -5.0 ) / 100.0;

									mods.Add( new StatMod( StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero ) );
									mods.Add( new StatMod( StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero ) );
									mods.Add( new StatMod( StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero ) );

									for ( int i = 0; i < targ.Skills.Length; ++i )
									{
										if ( targ.Skills[i].Value > 0 )
											mods.Add( new DefaultSkillMod( (SkillName)i, true, targ.Skills[i].Value * scalar ) );
									}
								}

								DiscordanceInfo info = new DiscordanceInfo( from, targ, len, scalar, mods );
								info.m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1.25 ), new TimerStateCallback( ProcessDiscordance ), info );

								m_Table[targ] = info;
							}
							else
							{
								from.SendLocalizedMessage( 1049537 );// Your target is already in discord.
							}
						}
						else
						{
							from.SendLocalizedMessage( 1049540 );// You fail to disrupt your target
							m_Instrument.PlayInstrumentBadly( from );
							m_Instrument.ConsumeUse( from );
						}
					}
					else
					{
						m_Instrument.PlayInstrumentBadly( from );
//.........这里部分代码省略.........
开发者ID:zerodowned,项目名称:angelisland,代码行数:101,代码来源:Discordance.cs

示例8: DoMagicArrow

		public virtual void DoMagicArrow(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			double damage = GetAosDamage(attacker, 10, 1, 4);

			attacker.MovingParticles(defender, 0x36E4, 5, 0, false, true, 3006, 4006, 0);
			attacker.PlaySound(0x1E5);

			SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
		}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:16,代码来源:BaseWeapon.cs

示例9: DoFireball

		public virtual void DoFireball(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			double damage = GetAosDamage(attacker, 19, 1, 5);

			attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
			attacker.PlaySound(0x15E);

			SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
		}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:16,代码来源:BaseWeapon.cs

示例10: DoAreaAttack

		public virtual void DoAreaAttack( Mobile from, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
		{
			Map map = from.Map;

			if ( map == null )
				return;

			ArrayList list = new ArrayList();

			IPooledEnumerable eable = from.GetMobilesInRange( 10 );
			foreach ( Mobile m in eable)
			{
				if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) && from.InLOS( m ) )
					list.Add( m );
			}
			eable.Free();

			if ( list.Count == 0 )
				return;

			Effects.PlaySound( from.Location, map, sound );

			// TODO: What is the damage calculation?

			for ( int i = 0; i < list.Count; ++i )
			{
				Mobile m = (Mobile)list[i];

				double scalar = (11 - from.GetDistanceToSqrt( m )) / 10;

				if ( scalar > 1.0 )
					scalar = 1.0;
				else if ( scalar < 0.0 )
					continue;

				from.DoHarmful( m, true );
				m.FixedEffect( 0x3779, 1, 15, hue, 0 );
				AOS.Damage( m, from, (int)(GetBaseDamage( from ) * scalar), phys, fire, cold, pois, nrgy );
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:40,代码来源:BaseWeapon.cs

示例11: DoAreaAttack

        public virtual void DoAreaAttack( Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
        {
            Map map = from.Map;

            if( map == null )
                return;

            List<Mobile> list = new List<Mobile>();

            foreach( Mobile m in from.GetMobilesInRange(10) )
            {
                if( from != m && defender != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false) && (!Core.ML || from.InLOS(m)) )
                    list.Add(m);
            }

            if( list.Count == 0 )
                return;

            Effects.PlaySound(from.Location, map, sound);

            // TODO: What is the damage calculation?

            for( int i = 0; i < list.Count; ++i )
            {
                Mobile m = list[i];

                from.DoHarmful(m, true);
                m.FixedEffect(0x3779, 1, 15, hue, 0);
                AOS.Damage(m, from, (int)((GetBaseDamage(from) + 5)), phys, fire, cold, pois, nrgy);
            }
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:31,代码来源:BaseWeapon.cs

示例12: OnTarget

			protected override void OnTarget( Mobile from, object targeted )
			{
				from.RevealingAction();

				if ( targeted is BaseCreature )
				{
					BaseCreature creature = (BaseCreature)targeted;

					if ( !m_Instrument.IsChildOf( from.Backpack ) )
					{
						from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
					}
                    else if (creature.UnprovokableTarget)
					{
						from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
					}
					//else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
					else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, m_Creature.RangePerception ) )
					{
						from.SendLocalizedMessage( 1049450 ); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
					}
					else if ( m_Creature != creature )
					{
						from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds( 7.0 );

						double diff = ((m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( creature )) * 0.35) - 5.0;
						double music = from.Skills[SkillName.Musicianship].Value;

						if ( music > 100.0 )
							diff -= (music - 100.0) * 0.5;

						if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( creature, true ) )
						{
							if ( !BaseInstrument.CheckMusicianship( from ) )
							{
								from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds( 5.05);
								from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
								m_Instrument.PlayInstrumentBadly( from );
								m_Instrument.ConsumeUse( from );
							}
							else
							{
								from.DoHarmful( m_Creature, true );
								from.DoHarmful( creature, true );

								if ( !from.CheckTargetSkill( SkillName.Provocation, creature, diff-25.0, diff+25.0 ) )
								{
									from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds( 5.05 );
									from.SendLocalizedMessage( 501599 ); // Your music fails to incite enough anger.
									m_Instrument.PlayInstrumentBadly( from );
									m_Instrument.ConsumeUse( from );
								}
								else
								{
									from.SendLocalizedMessage( 501602 ); // Your music succeeds, as you start a fight.
									m_Instrument.PlayInstrumentWell( from );
									m_Instrument.ConsumeUse( from );
									m_Creature.Provoke( from, creature, true );
								}
							}
						}
					}
					else
					{
						from.SendLocalizedMessage( 501593 ); // You can't tell someone to attack themselves!
					}
				}
				//allow for targetting a player
				else if( targeted is PlayerMobile )
				{
					PlayerMobile player = (PlayerMobile)targeted;

					if ( m_Creature.Unprovokable )
					{
						from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
					}
					else if ( m_Creature.Map != player.Map || 
						!m_Creature.InRange( player, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
					{
						from.SendLocalizedMessage( 1049450 ); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
						from.Target = new InternalFirstTarget( from, m_Instrument );
					}
					else //valid pair
					{
						from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );      //Appropriate skill delay for player provoke
						
						double diff = ((m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( player )) * 0.5) - 5.0;
						double music = from.Skills[SkillName.Musicianship].Value;

						if ( music > 100.0 )
							diff -= (music - 100.0) * 0.5;

						if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( player, true ) )
						{
							if ( !BaseInstrument.CheckMusicianship( from ) )
							{
								from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
								m_Instrument.PlayInstrumentBadly( from );
								m_Instrument.ConsumeUse( from );
							}
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:Provocation.cs

示例13: OnTarget

            protected override void OnTarget(Mobile from, object obj)
            {
                if (this.m_Bola.Deleted)
                    return;

                if (obj is Mobile)
                {
                    Mobile to = (Mobile)obj;

                    if (!this.m_Bola.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it.
                    }
                    else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null))
                    {
                        from.SendLocalizedMessage(1040015); // Your hands must be free to use this
                    }
                    else if (from.Mounted)
                    {
                        from.SendLocalizedMessage(1040016); // You cannot use this while riding a mount
                    }
                    else if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(from))
                    {
                        from.SendLocalizedMessage(1070902); // You can't use this while in an animal form!
                    }
                    else if (!to.Mounted)
                    {
                        from.SendLocalizedMessage(1049628); // You have no reason to throw a bola at that.
                    }
                    else if (!from.CanBeHarmful(to))
                    {
                    }
                    else if (from.BeginAction(typeof(Bola)))
                    {
                        EtherealMount.StopMounting(from);

                        if (Core.AOS)
                        {
                            Item one = from.FindItemOnLayer(Layer.OneHanded);
                            Item two = from.FindItemOnLayer(Layer.TwoHanded);

                            if (one != null)
                                from.AddToBackpack(one);

                            if (two != null)
                                from.AddToBackpack(two);
                        }

                        from.DoHarmful(to);

                        if (Core.AOS)
                            BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(3.0));

                        this.m_Bola.Consume();

                        from.Direction = from.GetDirectionTo(to);
                        from.Animate(11, 5, 1, true, false, 0);
                        from.MovingEffect(to, 0x26AC, 10, 0, false, false);

                        Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishThrow), new object[] { from, to });
                    }
                    else
                    {
                        from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049629); // You cannot throw a bola at that.
                }
            }
开发者ID:Crome696,项目名称:ServUO,代码行数:71,代码来源:Bola.cs

示例14: Explode


//.........这里部分代码省略.........
                        if (m_MoveOnUse)
                            Location = new Point3D(X, Y, loc.Z + 2);
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Too big blast radius to create target items");
                        return;
                    }

                    effects.Clear();
                }
                else
                {
                    new ThrowableItemTargetItem(m_TargetItemDuration, m_TargetItemID)
                    {
                        Name = m_TargetItemName,
                        Hue = m_TargetItemHue,
                        MinDamage = m_TargetItemMinDamage,
                        MaxDamage = m_TargetItemMaxDamage,
                        Location = loc,
                        Map = Map
                    };
                }

                
            }

            IPooledEnumerable eable = m_DetonateNearby ? map.GetObjectsInRange(loc, BlastRadius) : map.GetMobilesInRange(loc, BlastRadius);
            ArrayList toExplode = new ArrayList();

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                }
                else if (o is ThrowableItem && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = m_MinDamage;
            int max = m_MaxDamage;

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    if (m_MaxDamage > 0)
                    {
                        GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                        if (m_CheckGuarded && reg != null && !reg.Disabled)
                        {
                            if (from == null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)))
                            {
                                if (from != null)
                                    from.DoHarmful(m);

                                int damage = Utility.RandomMinMax(min, max);
                                AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                            }
                        }

                        else
                        {
                            if (from == null || from.CanBeHarmful(m, false))
                            {
                                if (from != null)
                                    from.DoHarmful(m);

                                int damage = Utility.RandomMinMax(min, max);
                                AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                            }
                        }
                    }
                }

                else if (o is ThrowableItem && detonatenearby)
                {
                    ThrowableItem throwable = (ThrowableItem)o;
                    Mobile m;

                    if (throwable.m_Users != null && throwable.m_Users[0] is Mobile)
                        m = (Mobile)throwable.m_Users[0];
                    else
                        m = from;

                    target = throwable.GetWorldLocation();
                    throwable.Explode(m, throwable.GetWorldLocation(), throwable.Map, false);
                }
            }
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:ThrowableItem.cs

示例15: OnTarget

            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                if ( targeted is BaseCreature )
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if ( m_Creature.Unprovokable || creature.Unprovokable )
                    {
                        from.SendAsciiMessage( "You have no chance of provoking those creatures." );
                    }
                    else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
                    {
                        from.SendAsciiMessage( "The creatures you are trying to provoke are too far away from each other for your music to have an effect." );
                    }
                    else if ( m_Creature != creature )
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );

                        double diff = ((m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( creature )) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if ( music > 100.0 )
                            diff -= (music - 100.0) * 0.5;

                        if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( creature, true ) )
                        {
                            if ( !BaseInstrument.CheckMusicianship( from ) )
                            {
                                from.SendAsciiMessage( "You play poorly, and there is no effect." );
                                m_Instrument.PlayInstrumentBadly( from );
                                m_Instrument.ConsumeUse( from );
                            }
                            else
                            {
                                from.DoHarmful( m_Creature );
                                from.DoHarmful( creature );

                                if ( !from.CheckTargetSkill( SkillName.Provocation, creature, 0, 100 ) )
                                {
                                    from.SendAsciiMessage( "Your music fails to incite enough anger." );
                                    m_Instrument.PlayInstrumentBadly( from );
                                    m_Instrument.ConsumeUse( from );
                                }
                                else
                                {
                                    from.SendAsciiMessage( "Your music succeeds, as you start a fight." );
                                    m_Instrument.PlayInstrumentWell( from );
                                    m_Instrument.ConsumeUse( from );
                                    m_Creature.Provoke( from, creature, true );
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage( "You can't tell someone to attack themselves!" );
                    }
                }
            }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:61,代码来源:Provocation.cs


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