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


C# Mobile.GetType方法代码示例

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


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

示例1: Target

		public void Target( Mobile m )
		{
			Type t = m.GetType();
			bool dispellable = false;

			if ( m is BaseCreature )
				dispellable = ((BaseCreature)m).Summoned;

			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( !dispellable )
			{
				Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

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

					m.Delete();
				}
			}

			FinishSequence();
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:35,代码来源:Dispel.cs

示例2: Target

        public void Target( Mobile m )
        {
            Type t = m.GetType();
            bool dispellable = false;

            if ( m is BaseCreature )
                dispellable = ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead;

            if ( !Caster.CanSee( m ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            else if ( !dispellable )
            {
                Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

                int diff;
                if ( m is Daemon )
                    diff = 95;
                else if ( m is EnergyVortex )
                    diff = 80;
                else if ( m is FireElemental || m is WaterElemental || m is AirElemental || m is EarthElemental )
                    diff = 75;
                else if ( m is BladeSpirit )
                    diff = 50;
                else
                    diff = 0;

                if ( Caster.Skills[SkillName.Magery].Value >= Utility.Random( 41 )-20+diff )
                {
                    Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
                    Effects.PlaySound( m, m.Map, 0x201 );

                    m.Delete();
                }
                else
                {
                    m.Animate( 14201, 10, 20, true, false, 0 );
                    Caster.SendAsciiMessage( "{0} resisted the attempt to dispell it!", m.Name );
                }
            }

            FinishSequence();
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:48,代码来源:Dispel.cs

示例3: Target

        public void Target( Mobile m )
        {
            Type t = m.GetType();
            bool dispellable = false;

            if ( m is BaseCreature )
                dispellable = ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead;

            if ( !Caster.CanSee( m ) )
            {
                Caster.SendAsciiMessage( "Target can not be seen." );
            }
            else if ( !dispellable )
            {
                Caster.SendAsciiMessage( "That cannot be dispelled." );
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

                BaseCreature bc = m as BaseCreature;

                double dispelChance = 0;

                if ( bc != null )
                    dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100;

                if ( dispelChance > Utility.RandomDouble() )
                {
                    Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
                    Effects.PlaySound( m, m.Map, 0x201 );

                    m.Delete();
                }
                else
                {
                    m.FixedEffect( 0x3779, 10, 20 );
                    Caster.SendAsciiMessage( "The creature resisted the attempt to dispel it!" );
                }
            }

            FinishSequence();
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:43,代码来源:Dispel.cs

示例4: GetRankFor

        public int GetRankFor(Mobile m)
        {
            Type[][] types = ChampionSpawnInfo.GetInfo(this.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:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:18,代码来源:ChampionSpawn.cs

示例5: OnHit

        public virtual void OnHit( Mobile attacker, Mobile defender )
        {
            PlaySwingAnimation( attacker );
            PlayHurtAnimation( defender );

            attacker.PlaySound( GetHitAttackSound( attacker, defender ) );
            defender.PlaySound( GetHitDefendSound( attacker, defender ) );

            int damage = ComputeDamage( attacker, defender );

            CheckSlayerResult cs = CheckSlayers( attacker, defender );

            if ( cs != CheckSlayerResult.None )
            {
                if ( cs == CheckSlayerResult.Slayer )
                    defender.FixedEffect( 0x37B9, 10, 5 );

                damage *= 2;
            }

            if ( !attacker.Player )
            {
                if ( defender is PlayerMobile )
                {
                    PlayerMobile pm = (PlayerMobile)defender;

                    if ( pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType() )
                        damage *= 2;
                }
            }
            else if ( !defender.Player )
            {
                if ( attacker is PlayerMobile )
                {
                    PlayerMobile pm = (PlayerMobile)attacker;

                    if ( pm.WaitingForEnemy )
                    {
                        pm.EnemyOfOneType = defender.GetType();
                        pm.WaitingForEnemy = false;
                    }

                    if ( pm.EnemyOfOneType == defender.GetType() )
                    {
                        defender.FixedEffect( 0x37B9, 10, 5, 1160, 0 );
                        damage += AOS.Scale( damage, 50 );
                    }
                }
            }

            int packInstinctBonus = GetPackInstinctBonus( attacker, defender );

            if ( packInstinctBonus != 0 )
                damage += AOS.Scale( damage, packInstinctBonus );

            if ( m_InDoubleStrike )
                damage -= AOS.Scale( damage, 10 ); // 10% loss when attacking with double-strike

            TransformContext context = TransformationSpell.GetContext( defender );

            if ( m_Slayer == SlayerName.Silver && context != null && context.Type != typeof( HorrificBeastSpell ) )
                damage += AOS.Scale( damage, 25 ); // Every necromancer transformation other than horrific beast take an additional 25% damage

            if ( attacker is BaseCreature )
                ((BaseCreature)attacker).AlterMeleeDamageTo( defender, ref damage );

            if ( defender is BaseCreature )
                ((BaseCreature)defender).AlterMeleeDamageFrom( attacker, ref damage );

            WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );

            damage = AbsorbDamage( attacker, defender, damage );

            if ( !Core.AOS && damage < 1 )
                damage = 1;
            else if ( Core.AOS && damage == 0 ) // parried
            {
                if ( a != null && a.Validate( attacker ) /*&& a.CheckMana( attacker, true )*/ ) // Parried special moves have no mana cost
                {
                    a = null;
                    WeaponAbility.ClearCurrentAbility( attacker );

                    attacker.SendAsciiMessage( "Your attack was parried!" );
                }
            }

            AddBlood( attacker, defender, damage );

            int phys, fire, cold, pois, nrgy;

            GetDamageTypes( attacker, out phys, out fire, out cold, out pois, out nrgy );

            if ( m_Consecrated )
            {
                phys = defender.PhysicalResistance;
                fire = defender.FireResistance;
                cold = defender.ColdResistance;
                pois = defender.PoisonResistance;
                nrgy = defender.EnergyResistance;

//.........这里部分代码省略.........
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:101,代码来源:BaseWeapon.cs

示例6: OnHit

		public virtual void OnHit(Mobile attacker, Mobile defender, double damageBonus)
		{
			if (MirrorImage.HasClone(defender) && (defender.Skills.Ninjitsu.Value / 150.0) > Utility.RandomDouble())
			{
				Clone bc;

				foreach (Mobile m in defender.GetMobilesInRange(4))
				{
					bc = m as Clone;

					if (bc != null && bc.Summoned && bc.SummonMaster == defender)
					{
						attacker.SendLocalizedMessage(1063141); // Your attack has been diverted to a nearby mirror image of your target!
						defender.SendLocalizedMessage(1063140); // You manage to divert the attack onto one of your nearby mirror images.

						/*
                        * TODO: What happens if the Clone parries a blow?
                        * And what about if the attacker is using Honorable Execution
                        * and kills it?
                        */

						defender = m;
						break;
					}
				}
			}

			PlaySwingAnimation(attacker);
			PlayHurtAnimation(defender);

			attacker.PlaySound(GetHitAttackSound(attacker, defender));
			defender.PlaySound(GetHitDefendSound(attacker, defender));

			int damage = ComputeDamage(attacker, defender);

			#region Damage Multipliers
			/*
            * The following damage bonuses multiply damage by a factor.
            * Capped at x3 (300%).
            */
			int percentageBonus = 0;

			WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker);
			SpecialMove move = SpecialMove.GetCurrentMove(attacker);

			if (a != null)
			{
				percentageBonus += (int)(a.DamageScalar * 100) - 100;
			}

			if (move != null)
			{
				percentageBonus += (int)(move.GetDamageScalar(attacker, defender) * 100) - 100;
			}

			percentageBonus += (int)(damageBonus * 100) - 100;

			CheckSlayerResult cs = CheckSlayers(attacker, defender);

			if (cs != CheckSlayerResult.None)
			{
				if (cs == CheckSlayerResult.Slayer)
				{
					defender.FixedEffect(0x37B9, 10, 5);
				}

				percentageBonus += 100;
			}

			if (!attacker.Player)
			{
				if (defender is PlayerMobile)
				{
					PlayerMobile pm = (PlayerMobile)defender;

					if (pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType())
					{
						percentageBonus += 100;
					}
				}
			}
			else if (!defender.Player)
			{
				if (attacker is PlayerMobile)
				{
					PlayerMobile pm = (PlayerMobile)attacker;

					if (pm.WaitingForEnemy)
					{
						pm.EnemyOfOneType = defender.GetType();
						pm.WaitingForEnemy = false;
					}

					if (pm.EnemyOfOneType == defender.GetType())
					{
						defender.FixedEffect(0x37B9, 10, 5, 1160, 0);

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

示例7: Slays

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

			return Types.Any(t1 => t1.IsAssignableFrom(t));
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:6,代码来源:SlayerEntry.cs

示例8: OnKill

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

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

            if (killed == null || killer == null || killer == killed)
                return;
		    
            // check for within guild kills and ignore them
            if (this.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;

            this.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;
        
//.........这里部分代码省略.........
开发者ID:jasegiffin,项目名称:JustUO,代码行数:101,代码来源:XmlMobFactions.cs

示例9: IsObjective

        public virtual bool IsObjective(Mobile mob)
        { 
            if (this.m_Creature == null)
                return false;
		
            if (this.m_Creature.IsAssignableFrom(mob.GetType()))
            {
                if (this.m_Region != null && !this.m_Region.Contains(mob.Location))
                    return false;
					
                return true;
            }
			
            return false;
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:15,代码来源:QuestObjectives.cs

示例10: CopyMobProperties

			private static void CopyMobProperties ( Mobile dest, Mobile src )
			{
				PropertyInfo[] props = src.GetType().GetProperties();

				for ( int i = 0; i < props.Length; i++ )
				{
					if ( props[i].CanRead && props[i].CanWrite )
						props[i].SetValue( dest, props[i].GetValue( src, null ), null );
				}
			}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:10,代码来源:dupemob.cs

示例11: 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:jasegiffin,项目名称:JustUO,代码行数:12,代码来源:XmlMobFactions.cs

示例12: GetPetKind

        public String GetPetKind(Mobile pet)
        {
            if (pet == null || pet.Deleted)
            {
                return "";
            }

            String petclass = pet.GetType().ToString();
            var rx = new Regex(@"^.*\.(?<pc>.*)$");
            Match m = rx.Match(petclass);

            return m.Groups["pc"].Value;
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:13,代码来源:ShowFollowers.cs

示例13: IgnoreYoungProtection

        public override bool IgnoreYoungProtection(Mobile from)
        {
            if (this.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:Crome696,项目名称:ServUO,代码行数:16,代码来源:Objectives.cs

示例14: Mutate

        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item == null)
                return null;

            if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                //Taran: Below we remove the items we don't want mobs to drop
                while (weapon is BaseKnife || weapon is Pickaxe || weapon is Hatchet || weapon is BaseStaff)
                {
                    weapon.Delete();
                    weapon = BaseWeapon.CreateRandomWeapon();
                }

                if (m_WeaponModifiers != null)
                    m_WeaponModifiers.Mutate(weapon);

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

                //if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100))
                //    weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType());

                weapon.Identified = true;
            }
            else if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                if (m_ArmorModifiers != null)
                    m_ArmorModifiers.Mutate(armor);

                armor.Identified = true;
            }
            else if (item is BaseInstrument)
            {
                SlayerName slayer = SlayerGroup.GetLootSlayerType(from.GetType());

                if (slayer == SlayerName.None)
                {
                    item.Delete();
                    return null;
                }

                BaseInstrument instr = (BaseInstrument)item;

                instr.Quality = InstrumentQuality.Regular;
                instr.Slayer = slayer;
            }

            return item;
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:54,代码来源:NewLootPackEntry.cs

示例15: Slays

        public static bool Slays(TalismanSlayerName name, Mobile m)
        {

            if (m.SpecialSlayerMechanics)
            {
                if (m.SlayerVulnerabilities.Contains(name.ToString()))
                    return true;
                else
                    return false;
                
            }

            if (!m_Table.ContainsKey(name))
                return false;

            Type[] types = m_Table[name];
			
            if (types == null || m == null)
                return false;

            Type type = m.GetType();

            for (int i = 0; i < types.Length; i++)
            {
                if (types[i].IsAssignableFrom(type))
                    return true;
            }

            return false;
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:30,代码来源:TalismanSlayer.cs


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