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


C# Mobile.GetDistanceToSqrt方法代码示例

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


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

示例1: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if ( (int)from.GetDistanceToSqrt( this ) > 2)
             {
            from.SendMessage( "You must be closer to the bank stone to pick it up" );
            return;
             }

             BaseHouse house = BaseHouse.FindHouseAt( from );

             if ( house == null )
             {
            from.SendMessage( "You can not pick up the bank stone from outside the house" );
             }
             else if ( !house.IsOwner( from ) )
             {
            from.SendMessage( "You must be owner of house to pick bank stone up" );
             }
             else
             {
            Container pack = from.Backpack;

            this.Delete();

            BankStoneDeed deed = new BankStoneDeed( );

            if ( pack == null || !pack.TryDropItem( from, deed, false ) )
               deed.MoveToWorld( from.Location, from.Map );

             }
        }
开发者ID:Ziden,项目名称:ServUO-EC-Test-Fork,代码行数:31,代码来源:BankStone.cs

示例2: OnHit

        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker) || !this.CheckMana(attacker, true))
                return;

            ClearCurrentAbility(attacker);

            attacker.SendMessage("You poisoning target"); 
            defender.SendMessage("You are poisoned");

            int level;

            if (Core.AOS)
            {
                if (attacker.InRange(defender, 2))
                {
                    int total = (attacker.Skills.Poisoning.Fixed) / 2;

                    if (total >= 1000)
                        level = 3;
                    else if (total > 850)
                        level = 2;
                    else if (total > 650)
                        level = 1;
                    else
                        level = 0;
                }
                else
                {
                    level = 0;
                }
            }
            else
            {
                double total = attacker.Skills[SkillName.Poisoning].Value;

                double dist = attacker.GetDistanceToSqrt(defender);

                if (dist >= 3.0)
                    total -= (dist - 3.0) * 10.0;

                if (total >= 200.0 && 1 > Utility.Random(10))
                    level = 3;
                else if (total > (Core.AOS ? 170.1 : 170.0))
                    level = 2;
                else if (total > (Core.AOS ? 130.1 : 130.0))
                    level = 1;
                else
                    level = 0;
            }

            defender.ApplyPoison(attacker, Poison.GetPoison(level));

            defender.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
            defender.PlaySound(0x474);
        }
开发者ID:m309,项目名称:ForkUO,代码行数:56,代码来源:SerpentArrow.cs

示例3: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if (from == null || from.Deleted)
				return;

			if ( !from.InLOS( this.GetWorldLocation() ) )
			{
				from.SendLocalizedMessage( 502800 ); // You can't see that.
			}
			else if ( from.GetDistanceToSqrt( this.GetWorldLocation() ) > 4 )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
			}
			else if ( !IsNaked( from ) )
			{
				from.SendMessage( "You must be naked to join." );
			}
			else if ( from.Backpack == null )
			{
				from.SendMessage("You can not join without a backpack.");
			}
			else if ( m_Game != null )
			{
				if ( m_Game.OpenJoin )
				{
					if ( m_Game.IsInGame( from ) )
					{
						from.SendMessage( "You are already playing!" );
						//from.SendGump( new GameTeamSelector( m_Game ) );
					}
					else
					{
						if ( from.AccessLevel == AccessLevel.Player )
						{
							from.CloseGump( typeof(GameJoinGump) );
							from.SendGump( new GameJoinGump( m_Game, m_GameName, m_RandomTeam ) );
						}
						else
							from.SendMessage( "It might not be wise for staff to be playing..." );
					}
				}
				else
				{
					from.SendMessage( "{0} join is closed.", m_GameName );
				}
			}
			else
			{
				from.SendMessage( "This stone must be linked to a game stone.  Please contact a game master." );
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:51,代码来源:GameJoin.cs

示例4: 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;
			}

			var 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];

				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:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:50,代码来源:BaseWeapon.cs

示例5: CheckHit

		public virtual bool CheckHit(Mobile attacker, Mobile defender)
		{
			BaseWeapon atkWeapon = attacker.Weapon as BaseWeapon;
			BaseWeapon defWeapon = defender.Weapon as BaseWeapon;

			Skill atkSkill = attacker.Skills[atkWeapon.Skill];
			Skill defSkill = defender.Skills[defWeapon.Skill];

			double atkValue = atkWeapon.GetAttackSkillValue(attacker, defender);
			double defValue = defWeapon.GetDefendSkillValue(attacker, defender);

			double ourValue, theirValue;

			int bonus = GetHitChanceBonus();

			#region Stygian Abyss
            int hciMod = 0;

			if (atkWeapon is BaseThrown)
			{
                int min = ((BaseThrown)atkWeapon).MinThrowRange;
                double dist = attacker.GetDistanceToSqrt(defender);

                //Distance malas
                if (attacker.InRange(defender, 1))	//Close Quarters
                    bonus -= (12 - Math.Min(12, ((int)attacker.Skills[SkillName.Throwing].Value + attacker.RawDex) / 20));
                else if (dist < min) 				//too close
                    bonus -= 12;

                //shield penalty
                BaseShield shield = attacker.FindItemOnLayer(Layer.TwoHanded) as BaseShield;

                if (shield != null)
                {
                    double skill = Math.Max(1.0, attacker.Skills[SkillName.Parry].Value);

                    hciMod = (int)Math.Min(50, 1200 / skill);
                }
			}
			#endregion

			if (Core.AOS)
			{
				if (atkValue <= -20.0)
				{
					atkValue = -19.9;
				}

				if (defValue <= -20.0)
				{
					defValue = -19.9;
				}

				bonus += AosAttributes.GetValue(attacker, AosAttribute.AttackChance);

				if (DivineFurySpell.UnderEffect(attacker))
				{
					bonus += 10; // attacker gets 10% bonus when they're under divine fury
				}

				if (CheckAnimal(attacker, typeof(GreyWolf)) || CheckAnimal(attacker, typeof(BakeKitsune)))
				{
					bonus += 20; // attacker gets 20% bonus when under Wolf or Bake Kitsune form
				}

				if (HitLower.IsUnderAttackEffect(attacker))
				{
					bonus -= 25; // Under Hit Lower Attack effect -> 25% malus
				}

				WeaponAbility ability = WeaponAbility.GetCurrentAbility(attacker);

				if (ability != null)
				{
					bonus += ability.AccuracyBonus;
				}

				SpecialMove move = SpecialMove.GetCurrentMove(attacker);

				if (move != null)
				{
					bonus += move.GetAccuracyBonus(attacker);
				}

                #region SA
                //Gargoyles get a +5 HCI
                if (attacker.Race == Race.Gargoyle)
                    bonus += 5;

                if (hciMod > 0)
                    bonus -= (int)(((double)bonus * ((double)hciMod / 100)));

                //Gargoyle Cap of 50
                bonus = Math.Min(attacker.Race == Race.Gargoyle ? 50 : 45, bonus);
                #endregion

				ourValue = (atkValue + 20.0) * (100 + bonus);

				bonus = AosAttributes.GetValue(defender, AosAttribute.DefendChance);

//.........这里部分代码省略.........
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:101,代码来源:BaseWeapon.cs

示例6: HandleDeath

        public static void HandleDeath(Mobile victim, Mobile killer)
        {
            if (killer == null)
                killer = victim.FindMostRecentDamager(true);

            PlayerState killerState = PlayerState.Find(killer);

            Container pack = victim.Backpack;

            if (pack != null)
            {
                Container killerPack = (killer == null ? null : killer.Backpack);
                Item[] sigils = pack.FindItemsByType(typeof(Sigil));

                for (int i = 0; i < sigils.Length; ++i)
                {
                    Sigil sigil = (Sigil)sigils[i];

                    if (killerState != null && killerPack != null)
                    {
                        if (killer.GetDistanceToSqrt(victim) > 64)
                        {
                            sigil.ReturnHome();
                            killer.SendLocalizedMessage(1042230); // The sigil has gone back to its home location.
                        }
                        else if (Sigil.ExistsOn(killer))
                        {
                            sigil.ReturnHome();
                            killer.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil.
                        }
                        else if (!killerPack.TryDropItem(killer, sigil, false))
                        {
                            sigil.ReturnHome();
                            killer.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full.
                        }
                    }
                    else
                    {
                        sigil.ReturnHome();
                    }
                }
            }

            if (killerState == null)
                return;

            if (victim is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)victim;
                Faction victimFaction = bc.FactionAllegiance;

                if (bc.Map == Faction.Facet && victimFaction != null && killerState.Faction != victimFaction)
                {
                    int silver = killerState.Faction.AwardSilver(killer, bc.FactionSilverWorth);

                    if (silver > 0)
                        killer.SendLocalizedMessage(1042748, silver.ToString("N0")); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature.
                }

                #region Ethics
                if (bc.Map == Faction.Facet && bc.GetEthicAllegiance(killer) == BaseCreature.Allegiance.Enemy)
                {
                    Ethics.Player killerEPL = Ethics.Player.Find(killer);

                    if (killerEPL != null && (100 - killerEPL.Power) > Utility.Random(100))
                    {
                        ++killerEPL.Power;
                        ++killerEPL.History;
                    }
                }
                #endregion

                return;
            }

            PlayerState victimState = PlayerState.Find(victim);

            if (victimState == null)
                return;

            #region Dueling
            if (victim.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                return;
            #endregion

            if (killer == victim || killerState.Faction != victimState.Faction)
                ApplySkillLoss(victim);

            if (killerState.Faction != victimState.Faction)
            {
                if (victimState.KillPoints <= -6)
                {
                    killer.SendLocalizedMessage(501693); // This victim is not worth enough to get kill points from. 

                    #region Ethics
                    Ethics.Player killerEPL = Ethics.Player.Find(killer);
                    Ethics.Player victimEPL = Ethics.Player.Find(victim);

                    if (killerEPL != null && victimEPL != null && victimEPL.Power > 0 && victimState.CanGiveSilverTo(killer))
                    {
//.........这里部分代码省略.........
开发者ID:jasegiffin,项目名称:JustUO,代码行数:101,代码来源:Faction.cs

示例7: CheckGuardCandidate

		public void CheckGuardCandidate(Mobile m)
		{
			if (IsDisabled())
			{
				return;
			}

			if (IsGuardCandidate(m))
			{
				GuardTimer timer = null;
				m_GuardCandidates.TryGetValue(m, out timer);

				if (timer == null)
				{
					timer = new GuardTimer(m, m_GuardCandidates);
					timer.Start();

					m_GuardCandidates[m] = timer;
					m.SendLocalizedMessage(502275); // Guards can now be called on you!

					Map map = m.Map;

					if (map != null)
					{
						Mobile fakeCall = null;
						double prio = 0.0;

						foreach (Mobile v in m.GetMobilesInRange(8))
						{
							if (!v.Player && v != m && !IsGuardCandidate(v) &&
								((v is BaseCreature) ? ((BaseCreature)v).IsHumanInTown() : (v.Body.IsHuman && v.Region.IsPartOf(this))))
							{
								double dist = m.GetDistanceToSqrt(v);

								if (fakeCall == null || dist < prio)
								{
									fakeCall = v;
									prio = dist;
								}
							}
						}

						if (fakeCall != null)
						{
							fakeCall.Say(Utility.RandomList(1007037, 501603, 1013037, 1013038, 1013039, 1013041, 1013042, 1013043, 1013052));
							MakeGuard(m);
							timer.Stop();
							m_GuardCandidates.Remove(m);
							m.SendLocalizedMessage(502276); // Guards can no longer be called on you.
						}
					}
				}
				else
				{
					timer.Stop();
					timer.Start();
				}
			}
		}
开发者ID:Crome696,项目名称:ServUO,代码行数:59,代码来源:GuardedRegion.cs

示例8: 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

示例9: ProduceEffect

        public virtual void ProduceEffect( Mobile from, bool first )
        {
            if( first && EffectSound > 0 )
                Caster.PlaySound( EffectSound );

            if( EffectID > 0 )
                from.MovingEffect( TargetMobile, EffectID, 5, 0, false, true, EffectHue, 0 );

            DamageDelay = 0.1 * from.GetDistanceToSqrt( TargetMobile.Location );
            new MageChainEffectTimer( this ).Start();
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:11,代码来源:CustomMageSpell.cs

示例10: CanBuy

        private bool CanBuy(Mobile buyer, List<Item> styles)
        {
            if (!IsActiveSeller)
                return false;

            if (!buyer.CheckAlive())
                return false;

            if (!CheckVendorAccess(buyer))
            {
                Say(501522); // I shall not treat with scum like thee!
                return false;
            }

            if (styles.Count == 0)
            {
                SayTo(buyer, 500187); // Your order cannot be fulfilled, please try again.
                return false;
            }

            if (Math.Round(buyer.GetDistanceToSqrt(this)) > m_MaxDistanceForCut)
            {
                Speak(m_ToFarAway);
                return false;
            }
            if (buyer.Mounted && m_NeedsToBeDismounted)
            {
                Speak(m_PleaseDismount);
                return false;
            }
            if (buyer.Warmode && m_NeedsPeaceForCut)
            {
                Speak(m_GoPeace);
                return false;
            }
            if (buyer.HairItemID == 5147 || buyer.HairItemID == 7947)
            {
                Speak(m_NotHuman);
                return false;
            }

            int beardCount = 0, hairCount = 0;

            foreach (Item item in styles)
            {
                if (IsHair(item))
                    hairCount++;
                else if (IsBeard(item))
                {
                    if (buyer.Female && !m_AllowFemalesBuyingBeard)
                    {
                        Speak(m_FemaleBuyingBeard);
                        return false;
                    }

                    beardCount++;
                }

                if (hairCount > 1 || beardCount > 1)
                {
                    Speak(m_TooManyStylesBought);
                    return false;
                }
            }

            return true;
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:67,代码来源:INXHairStylist.cs

示例11: GetDamageScalar

        public override double GetDamageScalar( Mobile attacker, Mobile defender, int maxRange )
        {
            int dist = (int) Math.Min( attacker.GetDistanceToSqrt( defender ), maxRange );
            double scalar = 0.0;
            try
            {
                scalar = m_DamagePenalties[maxRange - 4][dist];
                //TODO - Revisar, da un index fuera de rango a veces
            }
            catch ( Exception ex )
            {
                Logger.Error( "Exception in Throwing code, maxRange={0}, dist={1}, attacker={2}, defender={3}, exception={4}", maxRange, dist, attacker, defender, ex );
            }

            if ( m_Debug )
                attacker.SendMessage( "Your damage scalar due to distance is x{0:0.00}", 1.0 - scalar );

            return 1.0 - scalar;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:19,代码来源:BaseThrowing.cs

示例12: GetAccuracyScalar

        public override double GetAccuracyScalar( Mobile attacker, Mobile defender, int maxRange )
        {
            int dist = (int) Math.Min( attacker.GetDistanceToSqrt( defender ), maxRange );
            double scalar = 0.0;
            try
            {
                //TODO - Revisar, da un index fuera de rango a veces
                scalar = m_AccuracyPenalties[maxRange - 4][dist];
            }
            catch ( Exception ex )
            {
                Logger.Error( "Exception in Throwing code, maxRange={0}, dist={1}, attacker={2}, defender={3}, exception={4}", maxRange, dist, attacker, defender, ex );
            }

            if ( dist < 2 )
                scalar *= 1.0 - Math.Min( 1.0, ( ( attacker.Skills[SkillName.Swords].Value / 240.0 ) + ( attacker.Dex / 300.0 ) ) );

            if ( m_Debug )
                attacker.SendMessage( "Your hit chance scalar due to distance is x{0:0.00}", 1.0 - scalar );

            return 1.0 - scalar;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:22,代码来源:BaseThrowing.cs

示例13: OnTarget

		protected override void OnTarget(Mobile from, object targeted)
		{
			if( targeted == null || !(targeted  is Item) )
				return;

			if (_guardPost == null)
			{
				//Guard post stage
				if (!(targeted is KinGuardPost))
				{
					from.SendMessage("You may only fund guard posts");
					return;
				}

				//Grab guardpost
				KinGuardPost gp = targeted as KinGuardPost;
				if (gp == null) return;

				//Verify owner
				KinCityData data = KinCityManager.GetCityData(gp.City);
				if( data == null )
				{
					from.SendMessage("That guard post does not appear to be a valid part of a faction city");
					return;
				}
				
				//Owner or city leader can fund
				if (gp.Owner != from && gp.Owner != data.CityLeader )
				{
					from.SendMessage("That guard post does not belong to you");
					return;
				}

				from.SendMessage("Select the silver you wish to fund it with");
				
				//Issue new target
				from.Target = new KinGuardPostFundTarget(gp);
			}
			else
			{
				Silver silver = targeted as Silver;
			  //Silver stage
				if (silver == null)
				{
					from.SendMessage("You may only fund the guard post with silver");
					return;
				}
				if (!from.Backpack.Items.Contains(targeted))
				{
					from.SendMessage("The silver must be in your backpack");
				}
				if (from.GetDistanceToSqrt(_guardPost.Location) > 3)
				{
					from.SendMessage("You are not close enough to the guard post");
					return;
				}
				
				//Verify owner
				KinCityData data = KinCityManager.GetCityData(_guardPost.City);
				if (data == null)
				{
					from.SendMessage("That guard post does not appear to be a valid part of a faction city");
					return;
				}

				//check again that the guard post exists and they are the owner
				if (_guardPost.Deleted || (_guardPost.Owner != from && _guardPost.Owner != data.CityLeader))
				{
					from.SendMessage("The guard post no longer or exists or you are no longer the rightful owner");
					return;
				}
				
				int amount = silver.Amount;
				
				if (amount <= 0)
				{
					//should be impossible
					from.SendMessage("Your guard post was not successfully funded");
					return;
				}

				//Fund guardpost
				silver.Delete();
				_guardPost.Silver += amount;
				//if( !_guardPost.Running ) _guardPost.Running = true;
				from.SendMessage("Your guard post was successfully funded with {0} silver",amount);
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:88,代码来源:GuardPostFundTarget.cs

示例14: OnHit

        public void OnHit(Mobile from, Item tool)
        {
            // Vérifions que le joueur ne soit pas trop loin ^^
            if(from.GetDistanceToSqrt(this.Location) > 2)
            {
                from.SendMessage("Vous êtes trop loin");
                return;
            }

            // Pour ne pas taper dessus trop vite
            if (lastHit + TimeSpan.FromSeconds(1) > DateTime.Now)
                return;

            lastHit = DateTime.Now;

            // On retire un point
            Hits--;

            // Petite animation
            from.Direction = from.GetDirectionTo(this);
            from.Animate(Utility.RandomList(Mining.System.Definitions[0].EffectActions), 5, 1, true, false, 0);
            from.PlaySound(Utility.RandomList(Mining.System.Definitions[0].EffectSounds));

            // S'il n'y a plus de points on delete le rocher
            if (Hits == 0)
            {
                // Delete après l'animation de minage
                Timer.DelayCall(TimeSpan.FromMilliseconds(900), new TimerCallback(Delete));

                // On réduit de 1 le nombre d'utilisation de l'outil ayant servis
                if (tool is IUsesRemaining)
                {
                    ((IUsesRemaining)tool).UsesRemaining--;
                }

                // Et la récompense tordue :p
                int max = Utility.Random(5);
                int countGem = 0;
                int countOre = 0;
                for (int i = 0; i < max; i++)
                {
                    if (Utility.RandomBool())
                    {
                        countGem++;
                        from.AddToBackpack(Loot.Construct(Loot.GemTypes, Utility.Random(Loot.GemTypes.Length)));
                    }
                    else
                    {
                        if (Utility.RandomBool())
                        {
                            countOre++;
                            int chance = Utility.Random(100);

                            if (chance > 0)
                                from.AddToBackpack(new IronOre());
                            else
                                from.AddToBackpack(new SilverOre());    // environ 1 chance sur 200
                        }
                    }
                }

                if (countGem > 0)
                {
                    from.SendMessage(String.Format("Vous avez trouver {0} gemmes", countGem));

                    if (countOre > 0)
                        from.SendMessage("ainsi qu'un peu de minerai...");
                }
                else
                {
                    if (countOre > 0)
                        from.SendMessage("Vous trouvez un peu de minerai...");
                }
            }
        }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:75,代码来源:FriableRock.cs

示例15: OnHit

		public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
		{
			var pm = attacker as PlayerMobile;

			var battle = AutoPvP.FindBattle(pm);

			if (attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) &&
				0.4 >= Utility.RandomDouble() && battle == null)
			{
				defender.AddToBackpack(Ammo);
			}

			if (EraML && m_Velocity > 0)
			{
				var bonus = (int)attacker.GetDistanceToSqrt(defender);

				if (bonus > 0 && m_Velocity > Utility.Random(100))
				{
					AOS.Damage(defender, attacker, bonus * 3, 100, 0, 0, 0, 0);

					if (attacker.Player)
					{
						attacker.SendLocalizedMessage(1072794); // Your arrow hits its mark with velocity!
					}

					if (defender.Player)
					{
						defender.SendLocalizedMessage(1072795); // You have been hit by an arrow with velocity!
					}
				}
			}

			base.OnHit(attacker, defender, damageBonus);
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:34,代码来源:BaseRanged.cs


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