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


C# Mobile.AddStatMod方法代码示例

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


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

示例1: SetValue

		public static void SetValue( Mobile m, AosAttribute att, int value, string title )
		{
			if ( !EnhancementList.ContainsKey( m ) )
				AddMobile( m, title );

			if ( att == AosAttribute.BonusStr )
			{
				m.RemoveStatMod( "MagicalEnhancementStr" );
				m.AddStatMod( new StatMod( StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero ) );
			}
			else if ( att == AosAttribute.BonusDex )
			{
				m.RemoveStatMod( "MagicalEnhancementDex" );
				m.AddStatMod( new StatMod( StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero ) );
			}
			else if ( att == AosAttribute.BonusInt )
			{
				m.RemoveStatMod( "MagicalEnhancementInt" );
				m.AddStatMod( new StatMod( StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero ) );
			}

			if ( title != EnhancementList[m].Title )
				EnhancementList[m].Attributes[att] = value;
			else
				EnhancementList[m].Attributes[att] += value;
		}
开发者ID:suiy187,项目名称:runuocustom,代码行数:26,代码来源:Enhancement.cs

示例2: SetMods

		private void SetMods( Mobile wearer )
		{
			wearer.AddSkillMod( m_SkillMod0 );
			wearer.AddSkillMod( m_SkillMod1 );
			wearer.AddSkillMod( m_SkillMod2 );
			wearer.AddStatMod( m_StatMod0 );
			wearer.AddStatMod( m_StatMod1 );
		}
开发者ID:greeduomacro,项目名称:uodarktimes-1,代码行数:8,代码来源:ArcheryPvPRobe.cs

示例3: Use

		public override bool Use( Mobile from ) {
			if ( from.BeginAction( typeof( ClarityPotion ) ) ) {
				int amount = Utility.Dice( 3, 3, 3 );
				int time = Utility.RandomMinMax( 5, 30 );

				from.PlaySound( 0x2D6 );

				if ( from.Body.IsHuman ) {
					from.Animate( 34, 5, 1, true, false, 0 );
				}

				from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head );
				from.PlaySound( 0x1EB );

				StatMod mod = from.GetStatMod( "Concussion" );

				if ( mod != null ) {
					from.RemoveStatMod( "Concussion" );
					from.Mana -= mod.Offset;
				}

				from.PlaySound( 0x1EE );
				from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) );

				Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() {
					from.EndAction( typeof( ClarityPotion ) );
				} );

				return true;
			}

			return false;
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:33,代码来源:ClarityPotion.cs

示例4: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( nextabil <= DateTime.Now )
			{
				from.AddStatMod( new StatMod( StatType.Str, "Godlike Strength", 25, TimeSpan.FromMinutes( 2.0 ) ) );
				nextabil = DateTime.Now + TimeSpan.FromMinutes( 5.0 );
			}
		}
开发者ID:FreeReign,项目名称:realmofdarkness,代码行数:8,代码来源:BladeOfAres.cs

示例5: AddStatBonus

        public static bool AddStatBonus( Mobile caster, Mobile target, StatType type, int bonus, TimeSpan duration )
        {
            int offset = bonus;
            string name = String.Format( "[Magic] {0} Offset", type );

            StatMod mod = target.GetStatMod( name );

            if ( mod != null && mod.Offset < 0 )
            {
                target.AddStatMod( new StatMod( type, name, mod.Offset + offset, duration ) );
                return true;
            }
            else if ( mod == null || mod.Offset < offset )
            {
                target.AddStatMod( new StatMod( type, name, offset, duration ) );
                return true;
            }

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

示例6: Eat

		public override bool Eat( Mobile from )
		{
			if ( FillHunger( from, FillFactor ) )
			{
				string modName = Serial.ToString();
				
				from.AddStatMod( new StatMod( StatType.Str, modName + "Str", (int) ( from.RawStr * 0.08 ), TimeSpan.FromSeconds( 75 ) ) );
				
				from.PlaySound( 0x1EA );
				from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
				
				Consume();		
				
				return true;
			}
			
			return false;
		}
开发者ID:romeov007,项目名称:imagine-uo,代码行数:18,代码来源:FruitBowl.cs

示例7: Use

		public override bool Use( Mobile from ) {
			if ( from.GetStatMod( "blood-rose" ) == null ) {
				from.PlaySound( Utility.Random( 0x3A, 3 ) );

				if ( from.Body.IsHuman && !from.Mounted ) {
					from.Animate( 34, 5, 1, true, false, 0 );
				}

				int amount = Utility.Dice( 3, 3, 3 );
				int time = Utility.RandomMinMax( 5, 30 );

				from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );

				from.PlaySound( 0x1EE );
				from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );

				return true;
			} else {
				from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.

				return false;
			}
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:23,代码来源:BloodRose.cs

示例8: AddStatBonuses

		public static void AddStatBonuses( Mobile to, Item item, int str, int dex, int intel )
		{			
			if ( (str != 0 || dex != 0 || intel != 0) )
			{		
				string modName = item.Serial.ToString();

				if ( str != 0 )
					to.AddStatMod( new StatMod( StatType.Str, modName + "SetStr", str, TimeSpan.Zero ) );

				if ( dex != 0 )
					to.AddStatMod( new StatMod( StatType.Dex, modName + "SetDex", dex, TimeSpan.Zero ) );

				if ( intel != 0 )
					to.AddStatMod( new StatMod( StatType.Int, modName + "SetInt", intel, TimeSpan.Zero ) );
			}
			
			to.CheckStatTimers();
		}
开发者ID:PepeBiondi,项目名称:runsa,代码行数:18,代码来源:SetItem.cs

示例9: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if ( !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
            }
            else if ( from.GetStatMod( "RoseOfTrinsicPetal" ) != null )
            {
                from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
            }
            else
            {
                from.PlaySound( 0x1EE );
                from.AddStatMod( new StatMod( StatType.Str, "RoseOfTrinsicPetal", 5, TimeSpan.FromMinutes( 5.0 ) ) );

                Consume();
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:18,代码来源:RoseOfTrinsic.cs

示例10: OnGaveMeleeAttack

        public override void OnGaveMeleeAttack( Mobile defender )
        {
            base.OnGaveMeleeAttack( defender );

            if ( 0.1 > Utility.RandomDouble() )
            {
                defender.FixedParticles( 0x374A, 1, 17, 0x15B6, 0, 0, EffectLayer.Waist );
                defender.PlaySound( 0x233 );

                defender.Damage( 10, this );

                switch ( Utility.Random( 3 ) )
                {
                    case 0:
                        {
                            defender.SendLocalizedMessage( 1112391 ); // The creature's tail smashes into you!

                            break;
                        }
                    case 1:
                        {
                            defender.Freeze( TimeSpan.FromSeconds( 3.0 ) );

                            defender.SendLocalizedMessage( 1112554 ); // You're stunned as the creature's tail knocks the wind out of you.

                            break;
                        }
                    case 2:
                        {
                            defender.SendLocalizedMessage( 1112555 ); // You're left confused as the creature's tail catches you right in the face!
                            defender.PublicOverheadMessage( MessageType.Regular, 946, 502039 ); // *looks confused*

                            defender.AddStatMod( new StatMod( StatType.Dex, "Boura Dex Malus", -20, TimeSpan.FromSeconds( 5.0 ) ) );
                            defender.AddStatMod( new StatMod( StatType.Int, "Boura Int Malus", -20, TimeSpan.FromSeconds( 5.0 ) ) );

                            defender.FixedParticles( 0x37B9, 1, 10, 0x232A, 5, 0, EffectLayer.Head );
                            defender.PlaySound( 0xF9 );

                            break;
                        }
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:43,代码来源:HighPlainsBoura.cs

示例11: DoPrayerEffect

        public bool DoPrayerEffect(PlayerMobile from, Mobile target)
        {
            if (target == null || target.Deleted || !target.Alive || target.IsDeadBondedPet)
                return false;
            if (from == null || from.Deleted)
                return false;

            if (!String.IsNullOrEmpty(m_Message))
                target.SendMessage(m_Message);
            target.SendSound(SoundID);
            int offset = m_Intensity + PowerBonus(from);
            switch (m_Effect)
            {
                case PrayerEffect.Strength:
                    {
                        #region Strength

                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Str, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.Str, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Str, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;
                        #endregion
                    }
                case PrayerEffect.Dexterity:
                    {
                        #region Dexterity
                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Dex, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.Dex, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Dex, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;
                        #endregion
                    }
                case PrayerEffect.Intelligence:
                    {
                        #region Intelligence

                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Int, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.Int, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
//.........这里部分代码省略.........
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:CustomFaithSpell.cs

示例12: OnTargetAdded

        protected override void OnTargetAdded( Mobile m )
        {
            BuffInfo.AddBuff( m, this.BuffInfo );

            foreach ( AttributeMod mod in m_Mods )
            {
                m.AddAttributeMod( mod );
            }

            foreach ( StatMod mod in m_StatMods )
            {
                m.AddStatMod( mod );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:14,代码来源:AreaSpellsong.cs

示例13: StompAttack

        public void StompAttack( Mobile target )
        {
            if ( target.GetStatMod( "StompAttack" ) == null )
            {
                StatType type;

                switch( Utility.Random(3) )
                {
                    default:
                    case 0: type = StatType.Str; break;
                    case 1: type = StatType.Dex; break;
                    case 2: type = StatType.Int; break;
                }

                target.AddStatMod( new StatMod( type, "StompAttack", -( 10 + Utility.Random( 10 ) ), TimeSpan.FromSeconds( 60 + Utility.Random( 60 ) ) ) );
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:17,代码来源:ChaosDragoon.cs

示例14: OnHit

		public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
		{
			base.OnHit( attacker, defender, damageBonus );

			if ((attacker.Player || attacker.Body.IsHuman) && !attacker.IsT2A && Layer == Layer.TwoHanded
                && (attacker.Skills[SkillName.Anatomy].Value / 100.0 * SpecialMovesController._ConcussionPoleArmMaxChance) >= Utility.RandomDouble()
                && Engines.ConPVP.DuelContext.AllowSpecialAbility( attacker, "Concussion Blow", false ) )
			{
				StatMod mod = defender.GetStatMod( "Concussion" );

				if ( mod == null )
				{
					defender.SendLocalizedMessage( 1060165 ); // You have delivered a concussion!
					defender.AddStatMod( new StatMod( StatType.Int, "Concussion", -(defender.RawInt / 2), TimeSpan.FromSeconds( SpecialMovesController._ConcussionDurationSeconds ) ) );

					attacker.SendLocalizedMessage( 1060165 ); // You have delivered a concussion!
					attacker.PlaySound( 0x11C );
				}
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:20,代码来源:BasePoleArm.cs

示例15: OnGaveMeleeAttack

        public override void OnGaveMeleeAttack( Mobile defender )
        {
            base.OnGaveMeleeAttack( defender );

            if ( Utility.RandomBool() )
            {
                if ( Rotworm.IsDiseased( defender ) )
                {
                    // * The bloodworm is repulsed by your diseased blood. *
                    defender.SendLocalizedMessage( 1111668, "", 0x25 );
                }
                else
                {
                    // *The bloodworm drains some of your blood to replenish its health.*
                    defender.SendLocalizedMessage( 1111698, "", 0x25 );

                    Hits += ( defender.HitsMax - defender.Hits );
                }
            }

            if ( 0.1 > Utility.RandomDouble() && !IsAnemic( defender ) && !FontOfFortune.HasBlessing( defender, FontOfFortune.BlessingType.Protection ) )
            {
                defender.SendLocalizedMessage( 1111669 ); // The bloodworm's attack weakens you. You have become anemic.

                defender.AddStatMod( new StatMod( StatType.Str, "[Bloodworm] Str Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) );
                defender.AddStatMod( new StatMod( StatType.Dex, "[Bloodworm] Dex Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) );
                defender.AddStatMod( new StatMod( StatType.Int, "[Bloodworm] Int Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) );

                Effects.SendPacket( defender, defender.Map, new GraphicalEffect( EffectType.FixedFrom, defender.Serial, Serial.Zero, 0x375A, defender.Location, defender.Location, 9, 20, true, false ) );
                Effects.SendTargetParticles( defender, 0x373A, 1, 15, 0x26B9, EffectLayer.Head );
                Effects.SendLocationParticles( defender, 0x11A6, 9, 32, 0x253A );

                defender.PlaySound( 0x1ED );

                Timer.DelayCall( TimeSpan.FromSeconds( 15.0 ), new TimerCallback(
                    delegate
                    {
                        // You recover from your anemia.
                        defender.SendLocalizedMessage( 1111670 );

                        defender.RemoveStatMod( "[Bloodworm] Str Malus" );
                        defender.RemoveStatMod( "[Bloodworm] Dex Malus" );
                        defender.RemoveStatMod( "[Bloodworm] Int Malus" );
                    }
                ) );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:47,代码来源:Bloodworm.cs


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