Server.Mobiles.BaseCreature.OnDamage C# (CSharp) Method

OnDamage() public method

public OnDamage ( int amount, Mobile from, bool willKill ) : void
amount int
from Mobile
willKill bool
return void
        public override void OnDamage( int amount, Mobile from, bool willKill )
        {
            if ( BardPacified && (HitsMax - Hits) * 0.001 > Utility.RandomDouble() )
                Unpacify();

            int disruptThreshold;
            //NPCs can use bandages too!
            if( !Core.AOS )
                disruptThreshold = 0;
            else if( from != null && from.Player )
                disruptThreshold = 18;
            else
                disruptThreshold = 25;

            if( amount > disruptThreshold )
            {
                BandageContext c = BandageContext.GetContext( this );

                if( c != null )
                    c.Slip();
            }

            if( Confidence.IsRegenerating( this ) )
                Confidence.StopRegenerating( this );

            WeightOverloading.FatigueOnDamage( this, amount );

            InhumanSpeech speechType = this.SpeechType;

            if ( speechType != null && !willKill )
                speechType.OnDamage( this, amount );

            if ( m_ReceivedHonorContext != null )
                m_ReceivedHonorContext.OnTargetDamaged( from, amount );

            if ( willKill && from is PlayerMobile )
                Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerCallback( ((PlayerMobile) from).RecoverAmmo ) );

            base.OnDamage( amount, from, willKill );
        }
BaseCreature