Example #1
0
        public override void OnDoubleClick( Mobile from )
        {
            if( from is PlayerMobile )
            {
                PlayerMobile pm = from as PlayerMobile;

                if( pm.HealingTimer != null )
                {
                    pm.SendMessage( "You are alreadying trying to heal someone." );
                    return;
                }
            }

            if ( from.InRange( GetWorldLocation(), Core.AOS ? 2 : 1 ) )
            {
                from.RevealingAction();

                CombatSystemAttachment csa = CombatSystemAttachment.GetCSA( from );
                csa.Interrupted( true );
                if ( from is PlayerMobile )
                    ((PlayerMobile)from).ClearHands( true );
                else
                    from.ClearHands();

                from.SendLocalizedMessage( 500948 ); // Who will you use the bandages on?

                from.Target = new InternalTarget( this );
            }
            else
            {
                from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
            }
        }
Example #2
0
        public BandageContext( Mobile healer, Mobile patient, TimeSpan delay )
        {
            m_Healer = healer;
            m_Patient = patient;

            if( healer is PlayerMobile )
            {
                PlayerMobile m = healer as PlayerMobile;
                m.HealingTimer = new InternalTimer( this, ( delay ) );
                CombatSystemAttachment csa = CombatSystemAttachment.GetCSA(healer);
                csa.Interrupted(true);
                ((PlayerMobile)m).ClearHands(true);
                m.HealingTimer.Start();
            }

            else
            {
                healer.ClearHands();
                m_Timer = new InternalTimer( this, delay );
                m_Timer.Start();
            }
        }
Example #3
0
        public static BandageContext BeginHeal( Mobile healer, Mobile patient )
        {
            bool isDeadPet = ( patient is BaseCreature && ((BaseCreature)patient).IsDeadPet );

            if ( patient is BaseCreature && ((BaseCreature)patient).IsAnimatedDead )
            {
                healer.SendLocalizedMessage( 500951 ); // You cannot heal that.
            }
            else if ( !patient.Poisoned && patient.Hits == patient.HitsMax && !BleedAttack.IsBleeding( patient ) && !isDeadPet )
            {
                healer.SendLocalizedMessage( 500955 ); // That being is not damaged!
            }
            else if ( !patient.Alive && (patient.Map == null || !patient.Map.CanFit( patient.Location, 16, false, false )) )
            {
                healer.SendLocalizedMessage( 501042 ); // Target cannot be resurrected at that location.
            }
            else if ( healer.CanBeBeneficial( patient, true, true ) )
            {
                healer.DoBeneficial( patient );

                bool onSelf = ( healer == patient );
                int dex = healer.Dex;

                double seconds;
                double resDelay = ( patient.Alive ? 0.0 : 5.0 );

                if ( onSelf )
                {
                    if ( Core.AOS )
                        seconds = 4.55 + (0.1 * ((double)(0 - dex) / 10)); // TODO: Verify algorithm
                    else
                        seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
                }
                else
                {
                    if ( Core.AOS && GetPrimarySkill( patient ) == SkillName.Veterinary )
                    {
                        //if ( dex >= 40 )
                            seconds = 2.0;
                        //else
                        //	seconds = 3.0;
                    }
                    else
                    {
                        if ( dex >= 100 )
                            seconds = 2.0 + resDelay;
                        else if ( dex >= 40 )
                            seconds = 3.0 + resDelay;
                        else
                            seconds = 4.0 + resDelay;
                    }
                }

                if( seconds < 2.0 )
                    seconds = 2.0;

                BandageContext context = GetContext( healer );

                if ( context != null )
                    context.StopHeal();

                CombatSystemAttachment csa = CombatSystemAttachment.GetCSA(healer);
                csa.Interrupted(true);
                if (healer is PlayerMobile)
                    ((PlayerMobile)healer).ClearHands(true);
                else
                    healer.ClearHands();

                context = new BandageContext( healer, patient, TimeSpan.FromSeconds( seconds ) );

                m_Table[healer] = context;

                if ( !onSelf )
                    patient.SendLocalizedMessage( 1008078, false, healer.Name ); //  : Attempting to heal you.

                healer.SendLocalizedMessage( 500956 ); // You begin applying the bandages.
                return context;
            }

            return null;
        }
Example #4
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Bandage.Deleted )
                    return;

                if( targeted == from && from is PlayerMobile && ((PlayerMobile)from).IsVampire )
                {
                    from.SendMessage( "You cannot heal yourself with bandages." );
                    return;
                }

                if ( targeted is Mobile )
                {
                    if( !((Mobile)targeted).Alive || (targeted is BaseCreature && ((BaseCreature)targeted).IsDeadPet) )
                        from.SendMessage( "You cannot do anything for them." );

                    else if ( from.InRange( m_Bandage.GetWorldLocation(), Core.AOS ? 2 : 1 ) )
                    {
                        if ( BandageContext.BeginHeal( from, (Mobile) targeted ) != null )
                        {
                            CombatSystemAttachment csa = CombatSystemAttachment.GetCSA( from );
                            csa.Interrupted( true );
                            if (from is PlayerMobile)
                                ((PlayerMobile)from).ClearHands(true);
                            else
                                from.ClearHands();
                            int amount = m_Bandage.Amount;

                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
                    }
                }
                else if ( targeted is MagicalFountain )
                {
                    if ( this != null )
                    {
                        int amount = m_Bandage.Amount;
                        if ( m_Bandage.Amount > 1 )
                        {
                            from.SendMessage("You enhance the bandages and drop them into your pack.");
                        }
                        else
                        {
                            from.SendMessage("You enhance the bandage and drop it into your pack.");
                        }
                        m_Bandage.Amount = 1;
                        m_Bandage.Consume();
                        from.AddToBackpack( new EnhancedBandage( amount ) );
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 500970 ); // Bandages can not be used on that.
                }
            }