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


C# Mobile.GetType方法代码示例

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


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

示例1: GenerateLootItem

		public override Tuple<Item[],int> GenerateLootItem( Mobile creature )
		{
			Type type = m_InstrumentTypes[Utility.Random(m_InstrumentTypes.Length)];
			BaseInstrument instrument = Activator.CreateInstance( type ) as BaseInstrument;

			if ( instrument == null )
				throw new Exception( String.Format( "Type {0} is not BaseInstrument or could not be instantiated.", type ) );

			int value = 50;

			if ( m_SlayerChance > Utility.RandomDouble() )
			{
				if ( creature != null )
					instrument.Slayer = SlayerGroup.GetLootSlayerType( creature.GetType() );
				else
					instrument.Slayer = BaseRunicTool.GetRandomSlayer();

				value += 100;
			}

			if ( 0.08 > Utility.RandomDouble() ) // chance that this is low quality
			{
				instrument.Quality = InstrumentQuality.Low;
				value -= 50;
			}

			return new Tuple<Item[], int>( new Item[]{ instrument }, value );
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:28,代码来源:InstrumentLootSets.cs

示例2: Slays

        public bool Slays( Mobile m )
        {
            Type t = m.GetType();

            for ( int i = 0; i < m_Types.Length; ++i )
                if ( m_Types[i] == t )
                    return true;

            return false;
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:10,代码来源:SlayerEntry.cs

示例3: OnHit

        public void OnHit( Mobile defender )
        {
            if ( m_TargetType == null )
            {
                m_TargetType = defender.GetType();

                // Odd but OSI recalculates when the target changes...
                int chivalry = (int) m_Owner.Skills.Chivalry.Value;
                m_DamageScalar = 10 + ( ( chivalry - 40 ) * 9 ) / 10;

                DeltaEnemies();
                UpdateBuffInfo();
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:14,代码来源:EnemyOfOne.cs

示例4: OnHit

		public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
		{
			bool bonus = false;
			Type t = defender.GetType();

			for( int i = 0; i < SlayerVs.Length; i++ )
			{
				if ( t == SlayerVs[i] )
				{
					bonus = true;
					break;
				}
			}

			if ( bonus )
				base.OnHit( attacker, defender, damageBonus + 2.0 );
			else
				base.OnHit( attacker, defender, damageBonus );
		}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:19,代码来源:NeedleFork.cs

示例5: IgnoreYoungProtection

		public override bool IgnoreYoungProtection( Mobile from )
		{
			if ( Completed )
				return false;

			IngredientInfo info = IngredientInfo.Get( this.Ingredient );
			Type fromType = from.GetType();

			for ( int i = 0; i < info.Creatures.Length; i++ )
			{
				if ( fromType == info.Creatures[i] )
					return true;
			}

			return false;
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:16,代码来源:Objectives.cs

示例6: OnKill

		public override void OnKill(Mobile killed, Mobile killer )
		{
			base.OnKill(killed, killer);

			// supports ignoring XmlPoints challenges
			if(m_ChallengeStatus)
			{
				m_ChallengeStatus = false;
				return;
			}

			if(killed == null || killer == null || killer == killed) return;
		    
			// check for within guild kills and ignore them
			if(SameGuild(killed,killer)) return;

			// this calculates the base faction level that will be gained/lost based upon the fame of the killed mob
			double value = (double)(killed.Fame/1000.0);
			if(value <= 0) value = 1;

			// calculates credits gained in a similar way
			int cval = (int)(killed.Fame*m_CreditScale);
			if(cval <= 0) cval = 1;

			Credits += cval;

			// prepare the group lists that will be checked for faction
			ArrayList glist = null;
			ArrayList dglist = null;

			// check to see whether this mob type has already been hashed into a group list
			if(GroupHash.Contains(killed.GetType()))
			{
				glist = (ArrayList)GroupHash[killed.GetType()];
			} 
			else
			{
				// otherwise look it up the slow way and prepare a hash entry for it at the same time
				// unless it is using dynamic faction
				glist = new ArrayList();
				foreach(Group g in KillGroups)
				{
					if(MatchType(g.Members, killed))
					{
						glist.Add(g);
					}
				}
				GroupHash.Add(killed.GetType(),glist);
			}

			// have to look up dynamic factions the exhaustive way
			// does this mob have dynamic faction assignments?
			ArrayList list = XmlAttach.FindAttachments(XmlAttach.MobileAttachments, killed, typeof(XmlDynamicFaction));
			if(list != null && list.Count > 0)
			{
				//if(XmlAttach.FindAttachment(XmlAttach.MobileAttachments, killed, typeof(XmlDynamicFaction)) != null)
				//{
				dglist = new ArrayList();
				foreach(Group g in KillGroups)
				{
					if(DynamicMatchType(g.Members, killed))
					{
						dglist.Add(g);
					}
				}
			}

			ArrayList alist = new ArrayList();
			if(glist != null && glist.Count > 0)
				alist.Add(glist);
			if(dglist != null && dglist.Count > 0)
				alist.Add(dglist);

			//  go through this with static and dynamic factions
			foreach(ArrayList al in alist)
			{
				foreach(Group g in al)
				{
					// tabulate the faction loss from target group allies
					if(g.Allies != null && g.Allies.Length > 0)
					{
						for(int i = 0; i< g.Allies.Length;i++)
						{
							Group ally = g.Allies[i];

							int facloss = 0;
							try
							{
								facloss = (int)(value*g.AllyLoss[i]);
							} 
							catch{}
							if(facloss <= 0) facloss = 1;
        
							int p = GetFactionLevel(ally.GroupType) - facloss;
							SetFactionLevel(ally.GroupType, p);
							if(verboseMobFactions)
								killer.SendMessage("lost {0} faction {1}", ally.GroupType,facloss);
						}
					}

//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:101,代码来源:XmlMobFactions.cs

示例7: HandleKill

		public static void HandleKill( PlayerMobile pm, Mobile mob )
		{
			MLQuestContext context = GetContext( pm );

			if ( context == null )
				return;

			List<MLQuestInstance> instances = context.QuestInstances;

			Type type = null;

			for ( int i = instances.Count - 1; i >= 0; --i )
			{
				MLQuestInstance instance = instances[i];

				if ( instance.ClaimReward )
					continue;

				/* A kill only counts for a single objective within a quest,
				 * but it can count for multiple quests. This is something not
				 * currently observable on OSI, so it is assumed behavior.
				 */
				foreach ( BaseObjectiveInstance objective in instance.Objectives )
				{
					if ( !objective.Expired && objective is KillObjectiveInstance )
					{
						KillObjectiveInstance kill = (KillObjectiveInstance)objective;

						if ( type == null )
							type = mob.GetType();

						if ( kill.AddKill( mob, type ) )
						{
							kill.CheckComplete();
							break;
						}
					}
				}
			}
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:40,代码来源:MLQuestSystem.cs

示例8: Mutate

		public Item Mutate(Mobile from, Item item)
		{           

			if (item != null && !(item is BaseWand))
			{
				if (item is BaseWeapon && 1 > Utility.Random(100))
				{
					item.Delete();
					item = new FireHorn();
					return item;
				}

				if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
				{
					if (item is BaseWeapon)
					{
						var weapon = (BaseWeapon)item;

						if (55 > Utility.Random(100))
						{
							weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
						}

						if (45 > Utility.Random(100))
						{
							int damageLevel = GetRandomOldBonus();

							if (PseudoSeerStone.Instance != null && PseudoSeerStone.Instance._HighestDamageLevelSpawn < damageLevel)
							{
								if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
								{
									return PuzzleChest.CreateRandomSkillScroll();
								}
								int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel *
												 (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
								if (platAmount > 0)
								{
									return (new Platinum(platAmount));
								}
								damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
							}
							weapon.DamageLevel = (WeaponDamageLevel)damageLevel;
						}

						if (25 > Utility.Random(100))
						{
							weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
						}

						if (5 > Utility.Random(100))
						{
							weapon.Slayer = SlayerName.Silver;
						}

						if (1 > Utility.Random(1000) ||
							(weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 &&
							 weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)))
						{
							weapon.Slayer = from != null ? SlayerGroup.GetLootSlayerType(from.GetType()) : BaseRunicTool.GetRandomSlayer();
						}

						if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 &&
							weapon.Slayer == SlayerName.None)
						{
							weapon.Identified = true;
						}
					}
					else if (item is BaseArmor)
					{
						var armor = (BaseArmor)item;

						if (55 > Utility.Random(100))
						{
							armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
						}

						if (25 > Utility.Random(100))
						{
							armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
						}

						if (armor.ProtectionLevel == 0 && armor.Durability == 0)
						{
							armor.Identified = true;
						}
					}
				}
				else if (item is BaseInstrument)
				{
					SlayerName slayer = from == null || from.EraAOS
											? BaseRunicTool.GetRandomSlayer()
											: SlayerGroup.GetLootSlayerType(from.GetType());

					var instr = (BaseInstrument)item;

					instr.Quality = InstrumentQuality.Regular;
					instr.Slayer = slayer;
				}
				else if (item is Spellbook) //Randomize spellbook
				{
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:LootPack.cs

示例9: MatchType

		private static bool MatchType( ArrayList array, Mobile m)
		{
			if(array == null || m == null) return false;

			foreach( object o in array)
			{
				if(o is Type && ((Type)o == m.GetType() || ((Type)o).IsSubclassOf(m.GetType()))) return true;
			}
			return false;
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:10,代码来源:XmlMobFactions.cs

示例10: GetSubLevelFor

        public int GetSubLevelFor(Mobile m)
        {
            Type[][] types = ChampionSpawnInfo.GetInfo(m_Type).SpawnTypes;
            Type t = m.GetType();

            for (int i = 0; i < types.GetLength(0); i++)
            {
                Type[] individualTypes = types[i];

                for (int j = 0; j < individualTypes.Length; j++)
                {
                    if (t == individualTypes[j])
                        return i;
                }
            }

            return -1;
        }
开发者ID:PepeBiondi,项目名称:runsa,代码行数:18,代码来源:ChampionSpawn.cs

示例11: GetBodyName

		public static string GetBodyName( Mobile m )
		{
			Type t = m.GetType();

			object[] attrs = t.GetCustomAttributes( typeof( SleepingNameAttribute ), true );

			if ( attrs != null && attrs.Length > 0 )
			{
				SleepingNameAttribute attr = attrs[0] as SleepingNameAttribute;

				if ( attr != null )
					return attr.Name;
			}

			return m.Name;
		}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:16,代码来源:SleepingBody.cs

示例12: GetCorpseName

        public static string GetCorpseName( Mobile m )
        {
            Type t = m.GetType();

            object[] attrs = t.GetCustomAttributes( typeof( CorpseNameAttribute ), true );

            if ( attrs != null && attrs.Length > 0 )
            {
                CorpseNameAttribute attr = attrs[0] as CorpseNameAttribute;

                if ( attr != null )
                    return attr.Name;
            }

            return null;
        }
开发者ID:Leodinas,项目名称:uolite,代码行数:16,代码来源:Corpse.cs

示例13: GetSaveFlag

 public static int GetSaveFlag(Mobile m)
 {
     return ConversionTable.IndexOf(m.GetType()) + Offset;
 }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:4,代码来源:MobileSaver.cs

示例14: Damage

		public override void Damage(int amount, Mobile from)
		{
			if (Spells.Necromancy.EvilOmenSpell.TryEndEffect(this))
				amount = (int)(amount * 1.25);

			Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath(from);

			/* Per EA's UO Herald Pub48 (ML):
			 * ((resist spellsx10)/20 + 10=percentage of damage resisted)
			 */

			if (oath == this)
			{
				amount = (int)(amount * 1.1);

				if (amount > 35 && from is PlayerMobile)  /* capped @ 35, seems no expansion */
				{
					amount = 35;
				}

				if (Core.ML)
				{
					from.Damage((int)(amount * (1 - (((from.Skills.MagicResist.Value * .5) + 10) / 100))), this);
				}
				else
				{
					from.Damage(amount, this);
				}
			}

			if (from != null && Talisman is BaseTalisman)
			{
				BaseTalisman talisman = (BaseTalisman)Talisman;

				if (talisman.Protection != null && talisman.Protection.Type != null)
				{
					Type type = talisman.Protection.Type;

					if (type == from.GetType())
						amount *= 1 - (int)(((double)talisman.Protection.Amount) / 100);
				}
			}

			base.Damage(amount, from);
		}
开发者ID:greeduomacro,项目名称:dragonknights-uo,代码行数:45,代码来源:PlayerMobile.cs

示例15: IsObjective

        public virtual bool IsObjective( Mobile mob )
        {
            if ( m_Creatures == null )
                return false;

            if ( m_Region != null && !m_Region.Contains( mob.Location ) )
                return false;

            for ( int i = 0; i < m_Creatures.Length; i++ )
            {
                Type creature = m_Creatures[i];

                if ( creature.IsAssignableFrom( mob.GetType() ) )
                    return true;
            }

            return false;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:18,代码来源:QuestObjectives.cs


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