Example #1
0
        public override bool CheckCast()
        {
            if (m_Table.ContainsKey(Caster))
            {
                Caster.SendLocalizedMessage(501775); // This spell is already in effect.
                return(false);
            }
            else if (!Caster.CanBeginAction(typeof(AttuneWeaponSpell)))
            {
                Caster.SendLocalizedMessage(1075124); // You must wait before casting that spell again.
                return(false);
            }
            else if (SpiritualityVirtue.IsEmbracee(Caster))
            {
                Caster.SendLocalizedMessage(1156040); // You may not cast Attunement whilst a Spirituality Shield is active!
                return(false);
            }

            return(base.CheckCast());
        }
Example #2
0
        public void EndHeal()
        {
            StopHeal();

            int  healerNumber = -1, patientNumber = -1;
            bool playSound   = true;
            bool checkSkills = false;

            SkillName primarySkill   = GetPrimarySkill(m_Patient);
            SkillName secondarySkill = GetSecondarySkill(m_Patient);

            BaseCreature petPatient = m_Patient as BaseCreature;

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

                if (((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) ||
                    (Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == m_Healer))
                //TODO: Dbl check doesn't check for faction of the horse here?
                {
                    if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_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 (m_Patient.Region != null && m_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;

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

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

                            if (master != null && m_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 = 503255; // You are able to resurrect the creature.

                                master.CloseGump(typeof(PetResurrectGump));
                                master.SendGump(new PetResurrectGump(m_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 = 503255; // You are able to resurrect the creature.

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

                                        found = true;
                                        break;
                                    }
                                }

                                if (!found)
                                {
                                    healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection.
                                }
                            }
                        }
                        else
                        {
                            m_Patient.CloseGump(typeof(ResurrectGump));
                            m_Patient.SendGump(new ResurrectGump(m_Patient, m_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 (m_Patient.Poisoned)
            {
                m_Healer.SendLocalizedMessage(500969); // You finish applying the bandages.

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

                if ((checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble())
                {
                    if (m_Patient.CurePoison(m_Healer))
                    {
                        healerNumber  = (m_Healer == m_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(m_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(m_Patient, false);
            }
            else if (SplinteringWeaponContext.IsBleeding(m_Patient))
            {
                healerNumber  = 1060088; // You bind the wound and stop the bleeding
                patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding!

                SplinteringWeaponContext.EndBleeding(m_Patient);
            }
            else if (MortalStrike.IsWounded(m_Patient))
            {
                healerNumber  = (m_Healer == m_Patient ? 1005000 : 1010398);
                patientNumber = -1;
                playSound     = false;
            }
            else if (m_Patient.Hits == m_Patient.HitsMax)
            {
                healerNumber  = 500967; // You heal what little damage your patient had.
                patientNumber = -1;
            }
            else
            {
                checkSkills   = true;
                patientNumber = -1;

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing + 10.0) / 100.0) - (m_Slips * 0.02);

                #region Heritage Items
                healing += EnhancedBandage.HealingBonus;
                #endregion

                #region Exodus Items
                Item item = m_Healer.FindItemOnLayer(Layer.TwoHanded);

                if (item is Asclepius || item is GargishAsclepius)
                {
                    healing += 15;
                }
                #endregion

                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 (m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal)
                    {
                        toHeal += m_Patient.HitsMax / 100;
                    }

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

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

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

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

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

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

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

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

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

            if (m_Patient is PlayerMobile)
            {
                BuffInfo.RemoveBuff(m_Healer, BuffIcon.Healing);
            }
            else
            {
                BuffInfo.RemoveBuff(m_Healer, BuffIcon.Veterinary);
            }
        }
Example #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (ResurrectMessage.SilverSapling == m_Msg && 1 == info.ButtonID)
            {
                PlayerMobile pm = from as PlayerMobile;
                if (null != pm && pm.Region.IsPartOf("Abyss"))
                {
                    pm.Location = pm.SSSeedLocation;
                    pm.Map      = pm.SSSeedMap;
                    if (null != pm.Corpse)
                    {
                        pm.Corpse.Location = pm.Location;
                        pm.Corpse.Map      = pm.Map;
                    }
                    pm.Resurrect();
                }
                return;
            }

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                 // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

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

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (m_Healer != from && m_Healer is PlayerMobile && from is PlayerMobile)
                {
                    SpiritualityVirtue.OnHeal(m_Healer, 50);
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (!Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; // 5 to 15% loss

                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }

                if (m_Callback != null)
                {
                    m_Callback(from);
                }
            }
        }