Пример #1
0
        public override void OnAfterDuped(Item newItem)
        {
            FirstAidBelt belt = newItem as FirstAidBelt;

            if (belt != null)
            {
                belt.m_Attributes = new AosAttributes(newItem, m_Attributes);
            }

            base.OnAfterDuped(newItem);
        }
Пример #2
0
        public void EndHeal()
        {
            StopHeal();
            bool playSound   = true;
            bool checkSkills = false;

            SkillName primarySkill   = GetPrimarySkill(Healer, Patient);
            SkillName secondarySkill = GetSecondarySkill(Healer, Patient);

            BaseCreature petPatient = Patient as BaseCreature;
            int          patientNumber;
            int          healerNumber;

            if (!Healer.Alive)
            {
                healerNumber  = 500962; // You were unable to finish your work before you died.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!Healer.InRange(Patient, Bandage.Range))
            {
                healerNumber  = 500963; // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!Patient.Alive || (petPatient != null && petPatient.IsDeadPet))
            {
                double healing = Healer.Skills[primarySkill].Value;
                double anatomy = Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 68.0) / 50.0) - (Slips * 0.02);

                if (((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) ||
                    (Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == Healer) ||
                    (Engines.VvV.ViceVsVirtueSystem.Enabled && petPatient is Server.Engines.VvV.VvVMount && petPatient.ControlMaster == Healer))
                //TODO: Dbl check doesn't check for faction of the horse here?
                {
                    if (Patient.Map == null || !Patient.Map.CanFit(Patient.Location, 16, false, false))
                    {
                        healerNumber  = 501042; // Target can not be resurrected at that location.
                        patientNumber = 502391; // Thou can not be resurrected there!
                    }
                    else if (Patient.Region != null && Patient.Region.IsPartOf("Khaldun"))
                    {
                        healerNumber  = 1010395; // The veil of death in this area is too strong and resists thy efforts to restore life.
                        patientNumber = -1;
                    }
                    else
                    {
                        healerNumber  = 500965; // You are able to resurrect your patient.
                        patientNumber = -1;

                        Patient.PlaySound(0x214);
                        Patient.FixedEffect(0x376A, 10, 16);

                        if (petPatient != null && petPatient.IsDeadPet)
                        {
                            Mobile master = petPatient.ControlMaster;

                            if (master != null && Healer == master)
                            {
                                petPatient.ResurrectPet();

                                for (int i = 0; i < petPatient.Skills.Length; ++i)
                                {
                                    petPatient.Skills[i].Base -= 0.1;
                                }
                            }
                            else if (master != null && master.InRange(petPatient, 3))
                            {
                                healerNumber = 1049658; // The owner has been asked to sanctify the resurrection.

                                master.CloseGump(typeof(PetResurrectGump));
                                master.SendGump(new PetResurrectGump(Healer, petPatient));
                            }
                            else
                            {
                                bool found = false;

                                var friends = petPatient.Friends;

                                for (int i = 0; friends != null && i < friends.Count; ++i)
                                {
                                    Mobile friend = friends[i];

                                    if (friend.InRange(petPatient, 3))
                                    {
                                        healerNumber = 1049658; // The owner has been asked to sanctify the resurrection.

                                        friend.CloseGump(typeof(PetResurrectGump));
                                        friend.SendGump(new PetResurrectGump(Healer, petPatient));

                                        found = true;
                                        break;
                                    }
                                }

                                if (!found)
                                {
                                    healerNumber = 1049659; // Neither the owner or friends of the pet are nearby to sanctify the resurrection.
                                }
                            }
                        }
                        else
                        {
                            Patient.CloseGump(typeof(ResurrectGump));
                            Patient.SendGump(new ResurrectGump(Patient, Healer));
                        }
                    }
                }
                else
                {
                    if (petPatient != null && petPatient.IsDeadPet)
                    {
                        healerNumber = 503256; // You fail to resurrect the creature.
                    }
                    else
                    {
                        healerNumber = 500966; // You are unable to resurrect your patient.
                    }

                    patientNumber = -1;
                }
            }
            else if (Patient.Poisoned)
            {
                Healer.SendLocalizedMessage(500969); // You finish applying the bandages.

                double healing = Healer.Skills[primarySkill].Value;
                double anatomy = Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 30.0) / 50.0) - (Patient.Poison.RealLevel * 0.1) - (Slips * 0.02);

                if ((checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble())
                {
                    if (Patient.CurePoison(Healer))
                    {
                        healerNumber  = (Healer == Patient) ? -1 : 1010058; // You have cured the target of all poisons.
                        patientNumber = 1010059;                            // You have been cured of all poisons.
                    }
                    else
                    {
                        healerNumber  = -1;
                        patientNumber = -1;
                    }
                }
                else
                {
                    healerNumber  = 1010060; // You have failed to cure your target!
                    patientNumber = -1;
                }
            }
            else if (BleedAttack.IsBleeding(Patient))
            {
                healerNumber  = 1060088; // You bind the wound and stop the bleeding
                patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding!

                BleedAttack.EndBleed(Patient, false);
            }
            else if (MortalStrike.IsWounded(Patient))
            {
                healerNumber  = (Healer == Patient ? 1005000 : 1010398);
                patientNumber = -1;
                playSound     = false;
            }
            else if (Patient.Hits == Patient.HitsMax)
            {
                healerNumber  = 500967; // You heal what little damage your patient had.
                patientNumber = -1;
            }
            else
            {
                checkSkills   = true;
                patientNumber = -1;

                double healing = Healer.Skills[primarySkill].Value;
                double anatomy = Healer.Skills[secondarySkill].Value;

                FirstAidBelt belt = Healer.FindItemOnLayer(Layer.Waist) as FirstAidBelt;

                if (belt != null)
                {
                    HealingBonus += belt.HealingBonus;
                }

                Item item = Healer.FindItemOnLayer(Layer.TwoHanded);

                if (item is Asclepius || item is GargishAsclepius)
                {
                    HealingBonus += 15;
                }

                if (HealingBonus > 0)
                {
                    healing += HealingBonus;
                }

                double chance = ((healing + 10.0) / 100.0) - (Slips * 0.02);

                if (chance > Utility.RandomDouble())
                {
                    healerNumber = 500969; // You finish applying the bandages.

                    double min, max;

                    if (Core.AOS)
                    {
                        min = (anatomy / 8.0) + (healing / 5.0) + 4.0;
                        max = (anatomy / 6.0) + (healing / 2.5) + 4.0;
                    }
                    else
                    {
                        min = (anatomy / 5.0) + (healing / 5.0) + 3.0;
                        max = (anatomy / 5.0) + (healing / 2.0) + 10.0;
                    }

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

                    if (Patient.Body.IsMonster || Patient.Body.IsAnimal)
                    {
                        toHeal += Patient.HitsMax / 100;
                    }

                    if (Core.AOS)
                    {
                        toHeal -= toHeal * Slips * 0.35; // TODO: Verify algorithm
                    }
                    else
                    {
                        toHeal -= Slips * 4;
                    }

                    #region City Loyalty
                    if (Server.Engines.CityLoyalty.CityLoyaltySystem.HasTradeDeal(Healer, Engines.CityLoyalty.TradeDeal.GuildOfHealers))
                    {
                        toHeal += (int)Math.Ceiling(toHeal * 0.05);
                    }
                    #endregion

                    if (HealedPoisonOrBleed > 0)
                    {
                        toHeal /= HealedPoisonOrBleed;
                    }

                    if (SearingWounds.IsUnderEffects(Patient))
                    {
                        toHeal /= 2;
                        Patient.SendLocalizedMessage(1151178); // The cauterized wound resists some of your healing.
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968; // You apply the bandages, but they barely help.
                    }
                    else if (Patient != Healer && Patient is PlayerMobile && Healer is PlayerMobile)
                    {
                        SpiritualityVirtue.OnHeal(Healer, Math.Min((int)toHeal, Patient.HitsMax - Patient.Hits));
                    }

                    Patient.Heal((int)toHeal, Healer, false);
                }
                else
                {
                    healerNumber = 500968; // You apply the bandages, but they barely help.
                    playSound    = false;
                }
            }

            if (healerNumber != -1)
            {
                Healer.SendLocalizedMessage(healerNumber);
            }

            if (patientNumber != -1)
            {
                Patient.SendLocalizedMessage(patientNumber);
            }

            if (playSound)
            {
                Patient.PlaySound(0x57);
            }

            if (checkSkills)
            {
                Healer.CheckSkill(secondarySkill, 0.0, 120.0);
                Healer.CheckSkill(primarySkill, 0.0, 120.0);
            }

            if (Patient is PlayerMobile)
            {
                BuffInfo.RemoveBuff(Healer, BuffIcon.Healing);
            }
            else
            {
                BuffInfo.RemoveBuff(Healer, BuffIcon.Veterinary);
            }
        }