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

Heal() public method

public Heal ( Mobile patient ) : void
patient Mobile
return void
        public virtual void Heal( Mobile patient )
        {
            if ( !Alive || this.Map == Map.Internal || !CanBeBeneficial( patient, true, true ) || patient.Map != this.Map || !InRange( patient, HealEndRange ) )
            {
                StopHeal();
                return;
            }

            bool onSelf = ( patient == this );

            if ( !patient.Alive )
            {
            }
            else if ( patient.Poisoned )
            {
                int poisonLevel = patient.Poison.Level;

                double healing = Skills.Healing.Value;
                double anatomy = Skills.Anatomy.Value;
                double chance = ( healing - 30.0 ) / 50.0 - poisonLevel * 0.1;

                if ( ( healing >= 60.0 && anatomy >= 60.0 ) && chance > Utility.RandomDouble() )
                {
                    if ( patient.CurePoison( this ) )
                    {
                        patient.SendLocalizedMessage( 1010059 ); // You have been cured of all poisons.

                        CheckSkill( SkillName.Healing, 0.0, 60.0 + poisonLevel * 10.0 ); // TODO: Verify formula
                        CheckSkill( SkillName.Anatomy, 0.0, 100.0 );
                    }
                }
            }
            else if ( BleedAttack.IsBleeding( patient ) )
            {
                patient.SendLocalizedMessage( 1060167 ); // The bleeding wounds have healed, you are no longer bleeding!
                BleedAttack.EndBleed( patient, false );
            }
            else
            {
                double healing = Skills.Healing.Value;
                double anatomy = Skills.Anatomy.Value;
                double chance = ( healing + 10.0 ) / 100.0;

                if ( chance > Utility.RandomDouble() )
                {
                    double min, max;

                    min = ( anatomy / 10.0 ) + ( healing / 6.0 ) + 4.0;
                    max = ( anatomy / 8.0 ) + ( healing / 3.0 ) + 4.0;

                    if ( onSelf )
                        max += 10;

                    double toHeal = min + ( Utility.RandomDouble() * ( max - min ) );

                    toHeal *= HealScalar;

                    patient.Heal( (int)toHeal );

                    CheckSkill( SkillName.Healing, 0.0, 90.0 );
                    CheckSkill( SkillName.Anatomy, 0.0, 100.0 );
                }
            }

            HealEffect( patient );

            StopHeal();

            if ( ( onSelf && HealFully && Hits >= HealTrigger * HitsMax && Hits < HitsMax ) || ( !onSelf && HealOwnerFully && patient.Hits >= HealOwnerTrigger * patient.HitsMax && patient.Hits < patient.HitsMax ) )
                HealStart( patient );
        }

Usage Example

コード例 #1
0
        public static bool DoPotionHeal(BaseCreature creature)
        {
            creature.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5);
            creature.LastSwingTime     = DateTime.UtcNow + TimeSpan.FromSeconds(1.5);

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

            else
            {
                creature.Animate(11, 5, 1, true, false, 0);
            }

            //Percent Healing Amounts
            double MinHealingAmount = .15;
            double MaxHealingAmount = .25;

            double amountHealed = (double)creature.HitsMax * (MinHealingAmount + ((MaxHealingAmount - MinHealingAmount) * Utility.RandomDouble()));

            if (amountHealed > 50)
            {
                amountHealed = 50;
            }

            creature.Heal((int)amountHealed);
            creature.PlaySound(0x031);

            return(true);
        }
All Usage Examples Of Server.Mobiles.BaseCreature::Heal
BaseCreature