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


C# Mobile.DoHarmful方法代码示例

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


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

示例1: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to )
                source.DoHarmful( to );
            int chance = Utility.RandomMinMax( 1, 8 );
            string sundname = "";

            BaseArmor sundered = null;
            Layer layer = Layer.FirstValid;

            switch( chance )
            {
                case 1: layer = Layer.InnerTorso; sundname = "armour"; break;
                case 2: layer = Layer.InnerLegs; sundname = "leggings"; break;
                case 3: layer = Layer.TwoHanded; sundname = "shield"; break;
                case 4: layer = Layer.Neck; sundname = "gorget"; break;
                case 5: layer = Layer.Gloves; sundname = "gauntlets"; break;
                case 6: layer = Layer.Helm; sundname = "helm"; break;
                case 7: layer = Layer.Arms; sundname = "arm pads"; break;
                case 8: layer = Layer.OneHanded; sundname = "weapon"; break;
            }

            if( to.FindItemOnLayer( layer ) != null && to.FindItemOnLayer( layer ) is BaseArmor )
                sundered = to.FindItemOnLayer( layer ) as BaseArmor;

            if( sundered != null )
            {
                int amt = (int)(intensity * Divisor);
                if ( amt <= 0 )
                    amt = 0;

                sundered.HitPoints -= Utility.Random( amt ) + 1;

                if( sundered.HitPoints < 0 )
                {
                    sundered.MaxHitPoints += sundered.HitPoints;
                    sundered.HitPoints = 0;

                    if( sundered.MaxHitPoints < 0 )
                    {
                        sundered.Delete();
                        to.Emote( "*got {0} {1} destroyed by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
                    }
                }

                to.Emote( "*got {0} {1} damaged by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:48,代码来源:RustEffect.cs

示例2: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            bool curse = false;
            if ( intensity < 0 )
            {
                if ( source != to )
                    source.DoHarmful( to );

                curse = true;
                intensity*=-1;
            }

            int offset = (int)( intensity * Divisor );
            TimeSpan duration = TimeSpan.FromSeconds( (int)( ( Math.Abs( intensity ) * 15) * Divisor ) );
            if ( !Spells.SpellHelper.AddStatOffset( to, StatType.Dex, ( curse ? -1 : 1 ) * ( BasePotion.Scale( to, Math.Abs( offset ) ) ), duration ) )
                to.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:17,代码来源:DexterityEffect.cs

示例3: ComboAttack

        public void ComboAttack(Mobile attacker, Mobile defender, BaseWeapon weapon)
        {
            if (Level >= PerkLevel.Fifth)
            {
                if (weapon is Fists)
                {
                    int hitChance = (attacker.Dex / 8);
                    if (hitChance > Utility.RandomMinMax(0, 100))
                    {
                        int hits = Utility.RandomMinMax(1, 2);
                        int damage = Utility.RandomMinMax(1, 3) + (attacker.Str / 10);

                        for (int i = 1; i <= hits; i++)
                        {
                            attacker.DoHarmful(defender);
                            defender.Damage(damage);

                            int sound = Utility.RandomMinMax(1, 3);

                            switch (sound)
                            {
                                case 1:
                                    {
                                        attacker.PlaySound(0x13E);
                                        break;
                                    }
                                case 2:
                                    {
                                        attacker.PlaySound(0x145);
                                        break;
                                    }
                                case 3:
                                    {
                                        attacker.PlaySound(0x142);
                                        break;
                                    }
                            }
                        }

                        attacker.SendMessage("You strike your opponent multiple times in a combination-attack!");
                    }
                }
            }
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:44,代码来源:Pugilist.cs

示例4: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to && intensity < 0 )
                source.DoHarmful( to );

            if ( intensity > 0 )
            {
                if ( to.CanBeginAction( typeof( StaminaRegenerationEffect ) ) )
                {
                    to.BeginAction( typeof( StaminaRegenerationEffect ) );
                    Timer.DelayCall( TimeSpan.FromSeconds( 20 ), new TimerStateCallback( ReleaseStamRegenLock ), to ); // 20 sec delay
                }

                else
                    return;
            }

            BeginRegenerating( to, intensity, source );
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:19,代码来源:StaminaRegenerationEffect.cs

示例5: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( intensity > 0 )
            {
                if ( to.CanBeginAction( typeof( StaminaRestorationEffect ) ) && to.Stam < to.StamMax )
                {
                    to.Stam += BasePotion.Scale( to, (int)(intensity * Divisor) );
                    to.BeginAction( typeof( StaminaRestorationEffect ) );
                    Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerStateCallback( ReleaseStamLock ), to ); // 10 sec delay
                }
            }
            else
            {
                to.Stam -= BasePotion.Scale( to, (int)(-1 * intensity * Divisor) );

                if ( source != to ) // if it was thrown or something
                    source.DoHarmful( to );
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:19,代码来源:StaminaRestorationEffect.cs

示例6: OnHit

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

            ClearCurrentAbility( attacker );

            Map map = attacker.Map;

            if ( map != null )
            {
                defender.PlaySound( 0x5BF );

                ArrayList targets = new ArrayList();

                foreach ( Mobile m in defender.GetMobilesInRange( 5 ) )
                {
                    if ( SpellHelper.ValidIndirectTarget( attacker, m ) && attacker.CanBeHarmful( m, false ) && defender.InLOS( m ) && defender.CanSee( m ) )
                        targets.Add( m );
                }

                double dm;

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

                    if ( attacker.CanBeHarmful( m ) && attacker != m )
                    {
                        attacker.DoHarmful( m );

                        Effects.SendBoltEffect( m, false, 0 );

                        // TODO: Revisar formula del daño

                        dm = Utility.RandomMinMax( 25, 30 );

                        SpellHelper.Damage( TimeSpan.Zero, m, attacker, dm, 0, 0, 0, 0, 100 );
                    }
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:42,代码来源:LightningArrow.cs

示例7: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( intensity < 0 || to.Paralyzed )
                return;

            if ( source != to )
                source.DoHarmful( to );

            to.SendMessage( "You are rendered helpless by the substance." );
            if( to is PlayerMobile )
            {
                ( (PlayerMobile)to ).m_PetrifiedTimer = new GeneralizedParalyzeTimer( to, TimeSpan.FromMilliseconds( BasePotion.Scale( to, (int)( intensity * Divisor ) ) ) );
                ( (PlayerMobile)to ).m_PetrifiedTimer.Start();
            }

            else if( to is BaseCreature )
            {
                ( (BaseCreature)to ).m_PetrifiedTimer = new GeneralizedParalyzeTimer( to, TimeSpan.FromMilliseconds( BasePotion.Scale( to, (int)( intensity * Divisor ) ) ) );
                ( (BaseCreature)to ).m_PetrifiedTimer.Start();
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:21,代码来源:ParalysisEffect.cs

示例8: DismountAttack

        public static void DismountAttack( Mobile from, Mobile target )
        {
            target.Damage( 1, from );

            IMount mt = target.Mount;

            if ( mt != null )
            {
                mt.Rider = null;
            }

            if ( target.IsPlayer )
            {
                target.BeginAction( typeof( BaseMount ) );

                target.SendLocalizedMessage( 1040023 ); // You have been knocked off of your mount!

                target.EndAction( typeof( BaseMount ) );
            }

            from.DoHarmful( target );
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:22,代码来源:BaseAttackHelperSE.cs

示例9: LowerResistanceAttack

		public static void LowerResistanceAttack( Mobile from, ref ExpireTimer timer, TimeSpan duration, Mobile target, ResistanceMod[] mod, Hashtable hashtbl )
		{
			target.PlaySound( 0x1E9 );
			target.FixedParticles( 0x376A, 9, 32, 5008, EffectLayer.Waist );

			timer = new ExpireTimer( target, mod, duration, hashtbl );
			timer.Start();

			hashtbl[target] = timer;

			for (int i=0;i<mod.Length;i++)
				target.AddResistanceMod( mod[i] );		

			if ( hashtbl == m_RuneBeetleRMT )
				target.SendLocalizedMessage( 1070845 ); // The creature continues to corrupt your armor!

			if ( hashtbl == m_FanDancerRMT )
				target.SendLocalizedMessage( 1070835 ); // The creature surrounds you with fire, reducing your resistance to fire attacks.

			from.DoHarmful( target );

			return;
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:23,代码来源:BaseAttackHelperSE.cs

示例10: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to && intensity < 0 )
                source.DoHarmful( to );

            if ( intensity < 0 )
            {
                int amount = (int)(BasePotion.Scale( to, intensity*-1 ) * Divisor);
                if ( amount <= 0)
                    amount = 1;

                int tmp = to.Thirst - amount;
                if ( tmp < 0 )
                {
                    to.Thirst = 0;
                    tmp*=-1;
                    to.Hits-=(int)(tmp*1.5);
                    to.SendMessage( "You're dehydrated!" );
                }
                else
                    to.Thirst -= amount;
            }
            else if ( to.Thirst >= 20 )
                return;
            else
            {
                int amount = (int)(BasePotion.Scale( to, intensity ) * Divisor);
                if ( amount <= 0)
                    amount = 1;
                if ( to.Thirst + amount > 20 )
                    to.Thirst = 20;
                else
                    to.Thirst += amount;
            }

            FoodDecayTimer.CalculatePenalty( to );
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:37,代码来源:ThirstEffect.cs

示例11: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( intensity < 0 )
                return;
            if ( source != to )
                source.DoHarmful( to );

            // check if cant move already...
            if ( to.CantWalk )
                return;
            else
            {
                TimeSpan duration;
                int seconds = (int)( intensity * Divisor );

                if ( seconds < 1 )
                    seconds = 1;

                duration = TimeSpan.FromSeconds( seconds );
                to.CantWalk = true;
                Timer.DelayCall( duration, new TimerStateCallback( ReleaseMobile ), to );
                to.SendMessage( "Your feet have been glued to the ground!" );
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:24,代码来源:AdhesiveEffect.cs

示例12: Use


//.........这里部分代码省略.........
                return;
            }

            int sulfAsh = Core.AOS ? 4 : 15;
            from.Backpack.ConsumeUpTo( typeof( SulfurousAsh ), sulfAsh );

            from.PlaySound( 0x15F );
            Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0 ) );

            ArrayList targets = new ArrayList();
            bool playerVsPlayer = false;

            IPooledEnumerable eable = from.Map.GetMobilesInRange( new Point3D( loc ), 2 );

            foreach ( Mobile m in eable )
            {
                if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
                {
                    if ( Core.AOS && !from.InLOS( m ) )
                        continue;

                    targets.Add( m );

                    if ( m.Player )
                        playerVsPlayer = true;
                }
            }

            eable.Free();

            if ( targets.Count > 0 )
            {
                int prov = from.Skills[SkillName.Provocation].Fixed;
                int disc = from.Skills[SkillName.Discordance].Fixed;
                int peace = from.Skills[SkillName.Peacemaking].Fixed;

                int minDamage, maxDamage;

                if ( Core.AOS )
                {
                    int musicScaled = music + Math.Max( 0, music - 900 ) * 2;
                    int provScaled = prov + Math.Max( 0, prov - 900 ) * 2;
                    int discScaled = disc + Math.Max( 0, disc - 900 ) * 2;
                    int peaceScaled = peace + Math.Max( 0, peace - 900 ) * 2;

                    int weightAvg = ( musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled ) / 80;

                    int avgDamage;
                    if ( playerVsPlayer )
                        avgDamage = weightAvg / 3;
                    else
                        avgDamage = weightAvg / 2;

                    minDamage = ( avgDamage * 9 ) / 10;
                    maxDamage = ( avgDamage * 10 ) / 9;
                }
                else
                {
                    int total = prov + disc / 5 + peace / 5;

                    if ( playerVsPlayer )
                        total /= 3;

                    maxDamage = ( total * 2 ) / 30;
                    minDamage = ( maxDamage * 7 ) / 10;
                }

                double damage = Utility.RandomMinMax( minDamage, maxDamage );

                if ( Core.AOS && targets.Count > 1 )
                    damage = (damage * 2) / targets.Count;
                else if ( !Core.AOS )
                    damage /= targets.Count;

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

                    double toDeal = damage;

                    if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ) )
                    {
                        toDeal *= 0.5;
                        m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                    }

                    from.DoHarmful( m );
                    SpellHelper.Damage( TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0 );

                    Effects.SendTargetEffect( m, 0x3709, 10, 30 );
                }
            }

            double breakChance = Core.AOS ? 0.01 : 0.16;
            if ( Utility.RandomDouble() < breakChance )
            {
                from.SendLocalizedMessage( 1049619 ); // The fire horn crumbles in your hands.
                this.Delete();
            }
        }
开发者ID:Godkong,项目名称:Origins,代码行数:101,代码来源:FireHorn.cs

示例13: 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, 0x207 );
            Effects.SendLocationEffect( loc, map, 0x36BD, 20 );

            int alchemyBonus = 0;

            if ( direct )
                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 );

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

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

                    if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
                    {
                        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:Leodinas,项目名称:uolite,代码行数:83,代码来源:BaseExplosionPotion.cs

示例14: DoEffect

        public override bool DoEffect(Mobile from, Mobile target)
        {
            if ( from.CanSee( target ) && from.CanBeHarmful( target ) && from.InLOS( target ) && target.Alive )
            {
                from.DoHarmful( target );
                SpellHelper.Turn( from, target );

                SpellHelper.CheckReflect( 5, from, ref target );

                target.Paralyzed = false;

                if ( target.CheckSkill( SkillName.MagicResist, 10, 50 ) ) // check resisted easy
                {
                    target.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                }
                else
                {
                    if ( target.Spell is Spells.Spell )
                        ((Spells.Spell)target.Spell).OnCasterHurt( target.Mana );
                    target.Mana = 0;
                }

                target.FixedParticles( 0x374A, 10, 15, 5032, EffectLayer.Head );
                target.PlaySound( 0x1F8 );

                return true;
            }

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

示例15: OnTarget

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

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

					if ( !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 );

						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 ) );

						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:Godkong,项目名称:RunUO,代码行数:68,代码来源:Bola.cs


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