Example #1
0
        public override void Drink(Mobile from)
        {
            if (from.Mana < from.ManaMax)
            {
                if (MortalStrike.IsWounded(from))                                  // if (from.Poisoned || MortalStrike.IsWounded(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000); // You can not heal yourself in your current state.
                }
                else
                {
                    if (from.BeginAction(typeof(BaseHealPotion)))
                    {
                        DoMana(from);

                        BasePotion.PlayDrinkEffect(from);

                        this.Consume(); // this.Consume();

                        Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseManaLock), from);
                    }
                    else
                    {
                        from.SendMessage(0x22, "Voce nao pode usar outra potion em tao pouco tempo");
                        //from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235); // You must wait 10 seconds before using another healing potion.
                    }
                }
            }
            else
            {
                from.SendMessage(0x22, "Voce decide nao usar a potion, pois esta com Mana cheia");
                //from.SendLocalizedMessage( 1049547 ); // You decide against drinking this potion, as you are already at full health.
            }
        }
Example #2
0
        public override void Drink(Mobile from)
        {
            if (from.Hits < from.HitsMax)
            {
                if (from.Poisoned || MortalStrike.IsWounded(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000); // You can not heal yourself in your current state.
                }
                else
                {
                    if (from.BeginAction(typeof(BaseHealPotion)))
                    {
                        DoHeal(from);
                        PlayDrinkEffect(from);
                        Consume();

                        Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseHealLock), from);
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235); // You must wait 10 seconds before using another healing potion.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1049547); // You decide against drinking this potion, as you are already at full health.
            }
        }
        public override void Drink(Mobile from)
        {
            if (from.Mana < from.ManaMax)
            {
                if (from.Poisoned || MortalStrike.IsWounded(from))
                {
                    from.SendMessage("You cannot use this in your current state.");
                }
                else
                {
                    if (from.BeginAction(typeof(BaseManaPotion)))
                    {
                        DoMana(from);

                        BasePotion.PlayDrinkEffect(from);

                        this.Consume();

                        Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseManaLock), from);
                    }
                    else
                    {
                        from.SendMessage("You must wait to use another mana potion.");
                    }
                }
            }
            else
            {
                from.SendMessage("You are already at full mana.");
            }
        }
        }// A tasty bite of the enchanted apple lifts all curses from your soul.

        public override bool Eat(Mobile from)
        {
            if (!IsUnderInfluence(from, FoodID))
            {
                if (CoolingDown(from, FoodID))
                {
                    from.SendLocalizedMessage(1151180); // You must wait a while before eating another enchanted apple.
                }
                else
                {
                    from.PlaySound(0xF6);
                    from.PlaySound(0x1F7);
                    from.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    IEntity mfrom = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z - 10), from.Map);
                    IEntity mto   = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);
                    Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                    if (Core.SA)
                    {
                        int totalCurses = GetTotalCurses(from);

                        if (totalCurses > 2 && totalCurses > Utility.Random(10))
                        {
                            from.SendLocalizedMessage(1150174); // The apple was not strong enough to purify you.

                            Consume();

                            return(false);
                        }
                    }

                    EvilOmenSpell.TryEndEffect(from);
                    StrangleSpell.RemoveCurse(from);
                    CorpseSkinSpell.RemoveCurse(from);
                    WeakenSpell.RemoveEffects(from);
                    FeeblemindSpell.RemoveEffects(from);
                    ClumsySpell.RemoveEffects(from);
                    CurseSpell.RemoveEffect(from);
                    MortalStrike.EndWound(from);
                    BloodOathSpell.RemoveCurse(from);
                    MindRotSpell.ClearMindRotScalar(from);
                    SpellPlagueSpell.RemoveFromList(from);
                    SleepSpell.EndSleep(from);

                    BuffInfo.RemoveBuff(from, BuffIcon.MassCurse);

                    from.SendLocalizedMessage(EatMessage);

                    StartInfluence(from, FoodID, Duration, Cooldown);
                    Consume();

                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        public override void Drink(Mobile from)
        {
            if (from.Hits < from.HitsMax)
            {
                if (from.Poisoned || MortalStrike.IsWounded(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000); // You can not heal yourself in your current state.
                }
                else
                {
                    if (from.BeginAction(typeof(BaseHealPotion)))
                    {
                        //Plume : Addiction
                        if (from is PlayerMobile)
                        {
                            PlayerMobile drinker = from as PlayerMobile;

                            double Addiction = drinker.CalculateHealAddiction(this);

                            if (Addiction > 100)
                            {
                                drinker.SendMessage("Votre corps ne supporte plus ce traitement");
                                drinker.Poison = Poison.Lesser;
                            }
                            else
                            {
                                double HealScalar = Addiction / 100 * 0.95;
                                DoHeal(from, HealScalar);
                            }
                            drinker.IncAddiction(this);
                        }
                        else
                        {
                            DoHeal(from);
                        }

                        BasePotion.PlayDrinkEffect(from);

                        if (!Engines.ConPVP.DuelContext.IsFreeConsume(from))
                        {
                            this.Consume();
                        }

                        Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseHealLock), from);
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235); // You must wait 10 seconds before using another healing potion.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1049547); // You decide against drinking this potion, as you are already at full health.
            }
        }
Example #6
0
        public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
        {
            base.OnHit(attacker, defender, damageBonus);

            if (attacker != null && defender != null)
            {
                // No special effects 90% of the time for players
                if (attacker.Player && attacker.AccessLevel == AccessLevel.Player && Utility.RandomDouble() < 0.90)
                {
                    return;
                }

                // Always bleed.
                if (!BleedAttack.IsBleeding(defender))
                {
                    // Necromancers under Lich or Wraith Form are immune to Bleed Attacks.
                    TransformContext context = TransformationSpellHelper.GetContext(defender);

                    if ((context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell))) ||
                        (defender is BaseCreature && ((BaseCreature)defender).BleedImmune))
                    {
                        return;
                    }
                    else if (defender is PlayerMobile)
                    {
                        defender.LocalOverheadMessage(MessageType.Regular, 0x21, 1060757);                           // You are bleeding profusely
                        defender.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, defender.Name);         // ~1_NAME~ is bleeding profusely
                    }

                    defender.PlaySound(0x133);
                    defender.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist);

                    BleedAttack.BeginBleed(defender, attacker, true);
                }

                // 20% chance of Mortal Strike, costs 10 stam each use but cannot be used if you have < 80 stam.
                if (Utility.RandomDouble() > 0.80 && attacker.Stam > 79 && !MortalStrike.IsWounded(defender))
                {
                    MortalStrike.BeginWound(defender, TimeSpan.FromSeconds(6.0));

                    attacker.SendLocalizedMessage(1060086);                       // You deliver a mortal wound!
                    defender.SendLocalizedMessage(1060087);                       // You have been mortally wounded!

                    defender.PlaySound(0x1E1);
                    defender.FixedParticles(0x37B9, 244, 25, 9944, 31, 0, EffectLayer.Waist);

                    attacker.Stam -= 15;
                }
            }
        }
Example #7
0
        public static void RemoveCurses(Mobile m)
        {
            // play the sound
            m.PlaySound(0xF6);
            m.PlaySound(0x1F7);

            // do the effects
            m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

            IEntity from = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 10), m.Map);
            IEntity to   = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), m.Map);

            Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

            // remove stat mods
            StatMod mod;

            foreach (string statModName in StatModNames)
            {
                mod = m.GetStatMod(statModName);
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod(statModName);
                }
            }

            m.Paralyzed = false;

            EvilOmenSpell.CheckEffect(m);
            StrangleSpell.RemoveCurse(m);
            CorpseSkinSpell.RemoveCurse(m);
            CurseSpell.RemoveEffect(m);
            MortalStrike.EndWound(m);
            BloodOathSpell.EndEffect(m);
            SpellPlagueSpell.RemoveEffect(m);
            SleepSpell.RemoveEffect(m);
            MindRotSpell.ClearMindRotScalar(m);

            BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
            BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
            BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
            BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
            BuffInfo.RemoveBuff(m, BuffIcon.Curse);
            BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
            BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
            BuffInfo.RemoveBuff(m, BuffIcon.Sleep);
            BuffInfo.RemoveBuff(m, BuffIcon.MassSleep);
            BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
        }
Example #8
0
        public override bool CanDoEffects(Mobile m)
        {
            if (MortalStrike.IsWounded(m))
            {
                m.SendLocalizedMessage(1156869); // You may not use this with a mortal wound!
            }
            else if (m.Poison != null)
            {
                m.SendLocalizedMessage(1156868); // You may not use this while poisoned!
            }
            else if (Server.Spells.Bushido.Confidence.IsConfident(m))
            {
                m.SendLocalizedMessage(1156873); // You may not use this while under the effects of confidence!
            }

            return(base.CanDoEffects(m));
        }
Example #9
0
        public override void Drink(Mobile from)
        {
            if (from.Hits < from.HitsMax)
            {
                if (from.Poisoned || MortalStrike.IsWounded(from))
                {
                    from.LocalOverheadMessage(
                        MessageType.Regular,
                        0x22,
                        1005000
                        ); // You can not heal yourself in your current state.
                }
                else
                {
                    if (from.BeginAction <BaseHealPotion>())
                    {
                        DoHeal(from);

                        PlayDrinkEffect(from);

                        if (!DuelContext.IsFreeConsume(from))
                        {
                            Consume();
                        }

                        Timer.StartTimer(TimeSpan.FromSeconds(Delay), from.EndAction <BaseHealPotion>);
                    }
                    else
                    {
                        from.LocalOverheadMessage(
                            MessageType.Regular,
                            0x22,
                            500235
                            ); // You must wait 10 seconds before using another healing potion.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(
                    1049547
                    ); // You decide against drinking this potion, as you are already at full health.
            }
        }
Example #10
0
        public override bool Drink(Mobile from)
        {
            if (from.Hits < from.HitsMax)
            {
                if (from.Poisoned && !from.IsT2A || MortalStrike.IsWounded(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000);                     // You can not heal yourself in your current state.
                    return(false);
                }
                else
                {
                    if (from.BeginAction(typeof(BaseHealPotion)))
                    {
                        CustomRegion region1 = from.Region as CustomRegion;

                        DoHeal(from);

                        BasePotion.PlayDrinkEffect(from);

                        if (!Engines.ConPVP.DuelContext.IsFreeConsume(from) && (region1 == null || !region1.PlayingGame(from)))
                        {
                            this.Consume();
                        }

                        Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(Delay), new TimerStateCallback <Mobile>(ReleaseHealLock), from);
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235);                           // You must wait 10 seconds before using another healing potion.
                        return(false);
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1049547);                 // You decide against drinking this potion, as you are already at full health.
                return(false);
            }

            return(true);
        }
Example #11
0
        }// A tasty bite of the enchanted apple lifts all curses from your soul.
        public override bool Eat(Mobile from)
        {
            if (base.Eat(from))
            {
                from.PlaySound(0xF6);
                from.PlaySound(0x1F7);
                from.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                IEntity mfrom = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z - 10), from.Map);
                IEntity mto   = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);
                Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                from.RemoveStatMod("[Magic] Str Curse");
                from.RemoveStatMod("[Magic] Dex Curse");
                from.RemoveStatMod("[Magic] Int Curse");

                from.Asleep = false;

                EvilOmenSpell.TryEndEffect(from);
                StrangleSpell.RemoveCurse(from);
                CorpseSkinSpell.RemoveCurse(from);
                CurseSpell.RemoveEffect(from);
                MortalStrike.EndWound(from);
                BloodOathSpell.RemoveCurse(from);
                MindRotSpell.ClearMindRotScalar(from);
                SpellPlagueSpell.RemoveFromList(from);

                BuffInfo.RemoveBuff(from, BuffIcon.Clumsy);
                BuffInfo.RemoveBuff(from, BuffIcon.FeebleMind);
                BuffInfo.RemoveBuff(from, BuffIcon.Weaken);
                BuffInfo.RemoveBuff(from, BuffIcon.MassCurse);
                BuffInfo.RemoveBuff(from, BuffIcon.Curse);
                BuffInfo.RemoveBuff(from, BuffIcon.MortalStrike);
                BuffInfo.RemoveBuff(from, BuffIcon.Mindrot);
                BuffInfo.RemoveBuff(from, BuffIcon.CorpseSkin);

                return(true);
            }

            return(false);
        }
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentMove(attacker);

            attacker.SendLocalizedMessage(1060086);               // You deliver a mortal wound!
            defender.SendLocalizedMessage(1060087);               // You have been mortally wounded!

            defender.PlaySound(0x1E1);
            defender.FixedParticles(0x37B9, 244, 25, 9944, 31, 0, EffectLayer.Waist);

            // Do not reset timer if one is already in place.
            if (!MortalStrike.IsWounded(defender))
            {
                MortalStrike.BeginWound(defender, defender.Player ? PlayerDuration : NPCDuration);
            }
        }
Example #13
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)
            {
                m_Healer.SendAsciiMessage("You were unable to finish your work before you died.");
                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))
            {
                m_Healer.SendAsciiMessage("You did not stay close enough to heal your target.");
                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 Factions.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))
                    {
                        m_Healer.SendAsciiMessage("Target can not be resurrected at that location.");
                        m_Patient.SendAsciiMessage("Thou can not be resurrected there!");
                        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
                    {
                        m_Healer.SendAsciiMessage("You are able to resurrect your patient.");
                        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 && master.InRange(petPatient, 3))
                            {
                                m_Healer.SendAsciiMessage("You are able to resurrect the creature.");
                                healerNumber = 503255;                                 // You are able to resurrect the creature.

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

                                List <Mobile> friends = petPatient.Friends;

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

                                    if (friend.InRange(petPatient, 3))
                                    {
                                        m_Healer.SendAsciiMessage("You are able to resurrect the creature.");
                                        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)
                                {
                                    m_Healer.SendAsciiMessage("The pet's owner must be nearby to attempt resurrection.");
                                }
                                //healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection.
                            }
                        }
                        else
                        {
                            m_Patient.CantWalk = true;
                            m_Patient.CloseGump(typeof(ResurrectGump));

                            if (m_Patient is PlayerMobile && !((PlayerMobile)m_Patient).HasMenu)
                            {
                                ((PlayerMobile)m_Patient).HasMenu = true;
                                m_Patient.SendMenu(new ResurrectGump(m_Patient, m_Healer));
                            }
                            //m_Patient.SendGump( new ResurrectGump( m_Patient, m_Healer ) );
                        }
                    }
                }
                else
                {
                    if (petPatient != null && petPatient.IsDeadPet)
                    {
                        m_Healer.SendAsciiMessage("You fail to resurrect the creature.");
                        healerNumber = 503256; // You fail to resurrect the creature.
                    }
                    else
                    {
                        m_Healer.SendAsciiMessage("You are unable to resurrect your patient.");
                        healerNumber = 500966; // You are unable to resurrect your patient.
                    }

                    patientNumber = -1;
                }
            }

            /*else if ( m_Patient.Poisoned )
             * {
             * m_Healer.SendAsciiMessage("You finish applying the bandages.");
             *      //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.Level * 0.1) - (m_Slips * 0.02);
             *
             *      if ( (checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble() )
             *      {
             *              if ( m_Patient.CurePoison( m_Healer ) )
             *              {
             * m_Healer.SendAsciiMessage("You have cured the target of all poisons.");
             * m_Patient.SendAsciiMessage("You have been cured of all poisons.");
             *                      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
             *      {
             * m_Healer.SendAsciiMessage("You have failed to cure your target!");
             *              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 (MortalStrike.IsWounded(m_Patient))
            {
                healerNumber  = (m_Healer == m_Patient ? 1005000 : 1010398);
                patientNumber = -1;
                playSound     = false;
            }
            else
            {
                checkSkills = true;

                int    CurrHP = m_Patient.Hits;
                int    MaxHP  = m_Patient.Str;
                int    Damage = MaxHP - CurrHP;
                double toHeal = 1;

                if ((m_Healer.Skills[primarySkill].Value * 10) >= (Damage * 1000 / MaxHP))
                {
                    toHeal = (Damage * (50 + m_Healer.Skills[primarySkill].Value / 2)) / 100;
                }

                if (toHeal <= 1)
                {
                    m_Healer.SendAsciiMessage("You apply the bandages, but they barely help.");
                }
                else
                {
                    m_Healer.SendAsciiMessage("You apply the bandages.");
                }

                m_Patient.Heal((int)toHeal, m_Healer, false);
            }

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

            if (checkSkills)
            {
                m_Healer.CheckSkill(primarySkill, 0.0, 100.0);
            }
        }
Example #14
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (m_Talisman == null || m_Talisman.Deleted)
                {
                    return;
                }

                Mobile target = o as Mobile;

                if (from.Talisman != m_Talisman)
                {
                    from.SendLocalizedMessage(502641);                       // You must equip this item to use it.
                }
                else if (target == null)
                {
                    from.SendLocalizedMessage(1046439);                       // That is not a valid target.
                }
                else if (m_Talisman.ChargeTime > 0)
                {
                    from.SendLocalizedMessage(1074882, m_Talisman.ChargeTime.ToString());                       // You must wait ~1_val~ seconds for this to recharge.
                }
                else if (m_Talisman.Charges == 0 && m_Talisman.MaxCharges > 0)
                {
                    from.SendLocalizedMessage(1042544);                       // This item is out of charges.
                }
                else
                {
                    switch (m_Talisman.Removal)
                    {
                    case TalismanRemoval.Curse:
                        target.PlaySound(0xF6);
                        target.PlaySound(0x1F7);
                        target.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                        IEntity mfrom = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z - 10), from.Map);
                        IEntity mto   = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z + 50), from.Map);
                        Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                        StatMod mod;

                        mod = target.GetStatMod("[Magic] Str Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            target.RemoveStatMod("[Magic] Str Offset");
                        }

                        mod = target.GetStatMod("[Magic] Dex Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            target.RemoveStatMod("[Magic] Dex Offset");
                        }

                        mod = target.GetStatMod("[Magic] Int Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            target.RemoveStatMod("[Magic] Int Offset");
                        }

                        target.Paralyzed = false;

                        EvilOmenSpell.TryEndEffect(target);
                        StrangleSpell.RemoveCurse(target);
                        CorpseSkinSpell.RemoveCurse(target);
                        CurseSpell.RemoveEffect(target);

                        BuffInfo.RemoveBuff(target, BuffIcon.Clumsy);
                        BuffInfo.RemoveBuff(target, BuffIcon.FeebleMind);
                        BuffInfo.RemoveBuff(target, BuffIcon.Weaken);
                        BuffInfo.RemoveBuff(target, BuffIcon.MassCurse);

                        target.SendLocalizedMessage(1072408);                                   // Any curses on you have been lifted

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072409);                                       // Your targets curses have been lifted
                        }
                        break;

                    case TalismanRemoval.Damage:
                        target.PlaySound(0x201);
                        Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                        BleedAttack.EndBleed(target, true);
                        MortalStrike.EndWound(target);

                        BuffInfo.RemoveBuff(target, BuffIcon.Bleed);
                        BuffInfo.RemoveBuff(target, BuffIcon.MortalStrike);

                        target.SendLocalizedMessage(1072405);                                   // Your lasting damage effects have been removed!

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072406);                                       // Your Targets lasting damage effects have been removed!
                        }
                        break;

                    case TalismanRemoval.Ward:
                        target.PlaySound(0x201);
                        Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                        MagicReflectSpell.EndReflect(target);
                        ReactiveArmorSpell.EndArmor(target);
                        ProtectionSpell.EndProtection(target);

                        target.SendLocalizedMessage(1072402);                                   // Your wards have been removed!

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072403);                                       // Your target's wards have been removed!
                        }
                        break;

                    case TalismanRemoval.Wildfire:
                        // TODO
                        break;
                    }

                    m_Talisman.OnAfterUse(from);
                }
            }
Example #15
0
        public override void OnComponentUsed(AddonComponent ac, Mobile from)
        {
            if (from.Blessed)
            {
                from.SendMessage("You cannot drink from the pool while in this state.");
            }
            else if (!from.InRange(GetWorldLocation(), 3))
            {
                from.SendMessage("You will have to get closer to drink from the magical pool!");
            }
            else if (m_Uses > 0)
            {
                if (m_Pool == 1)                   // GAIN STATS
                {
                    if (from.StatCap > (from.RawStatTotal))
                    {
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        int water = Utility.RandomMinMax(1, 3);
                        int up    = 1;

                        int chance = Utility.RandomMinMax(1, 100);

                        if (chance >= 98)
                        {
                            up = AvailPoints(from, 5);
                        }
                        else if (chance >= 87)
                        {
                            up = AvailPoints(from, 4);
                        }
                        else if (chance >= 75)
                        {
                            up = AvailPoints(from, 3);
                        }
                        else if (chance >= 50)
                        {
                            up = AvailPoints(from, 2);
                        }

                        if (water == 1)
                        {
                            from.RawInt = from.RawInt + up; from.SendMessage("You drink from the pool and you feel much smarter!");
                        }
                        else if (water == 2)
                        {
                            from.RawStr = from.RawStr + up; from.SendMessage("You drink from the pool and you feel much stronger!");
                        }
                        else
                        {
                            from.RawDex = from.RawDex + up; from.SendMessage("You drink from the pool and you feel much quicker!");
                        }

                        this.m_Uses = 0;
                    }
                    else
                    {
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You drink from the pool and nothing happens!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 2)                   // CURE
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    if (from.Poisoned)
                    {
                        from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                        from.CurePoison(from);
                        from.SendMessage("You feel much better after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                    else
                    {
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You drink from the pool and nothing happens!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 3)                   // HEAL
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    if (from.Hits < from.HitsMax)
                    {
                        if (from.Poisoned || MortalStrike.IsWounded(from))
                        {
                            from.SendMessage("You drink from the pool and nothing happens!");
                            this.m_Uses = this.m_Uses - 1;
                        }
                        else
                        {
                            from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                            int min = 50;
                            int max = 75;
                            if (m_Bonus > 8)
                            {
                                min = 125; max = 175;
                            }
                            else if (m_Bonus > 5)
                            {
                                min = 75; max = 125;
                            }
                            from.Heal(Utility.RandomMinMax(min, max));
                            from.SendMessage("You drink from the pool and your wounds magically heal!");
                            this.m_Uses = this.m_Uses - 1;
                        }
                    }
                    else
                    {
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You drink from the pool and nothing happens!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 4)                   // WATER ELEMENTAL
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    try
                    {
                        Map          map = this.Map;
                        BaseCreature bc  = (BaseCreature)Activator.CreateInstance(typeof(WaterElemental));

                        Point3D spawnLoc = this.Location;

                        for (int i = 0; i < 10; i++)
                        {
                            int x = Location.X + Utility.Random(4);
                            int y = Location.Y + Utility.Random(4);
                            int z = Map.GetAverageZ(x, y);

                            if (Map.CanSpawnMobile(new Point2D(x, y), this.Z))
                            {
                                spawnLoc = new Point3D(x, y, this.Z);
                            }
                            else if (Map.CanSpawnMobile(new Point2D(x, y), z))
                            {
                                spawnLoc = new Point3D(x, y, z);
                            }
                        }

                        Timer.DelayCall(TimeSpan.FromSeconds(1), delegate()
                        {
                            bc.Home      = Location;
                            bc.RangeHome = 5;
                            bc.FightMode = FightMode.Closest;
                            bc.MoveToWorld(spawnLoc, map);
                            bc.ForceReacquire();
                        });
                    }
                    catch
                    {
                    }
                    from.SendMessage("A water elemental emerges from the pool!");
                    this.m_Uses = this.m_Uses - 1;
                }
                else if (m_Pool == 5)                   // GOLD TO LEAD
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    Container cont  = from.Backpack;
                    int       nDull = 0;

                    int m_gAmount = from.Backpack.GetAmount(typeof(Gold));
                    int m_cAmount = from.Backpack.GetAmount(typeof(DDCopper));
                    int m_sAmount = from.Backpack.GetAmount(typeof(DDSilver));
                    int m_xAmount = from.Backpack.GetAmount(typeof(DDXormite));

                    if (cont.ConsumeTotal(typeof(Gold), m_gAmount))
                    {
                        from.AddToBackpack(new LeadCoin(m_gAmount));
                        nDull = 1;
                    }
                    if (cont.ConsumeTotal(typeof(DDCopper), m_cAmount))
                    {
                        from.AddToBackpack(new LeadCoin(m_cAmount));
                        nDull = 1;
                    }
                    if (cont.ConsumeTotal(typeof(DDSilver), m_sAmount))
                    {
                        from.AddToBackpack(new LeadCoin(m_sAmount));
                        nDull = 1;
                    }
                    if (cont.ConsumeTotal(typeof(DDXormite), m_xAmount))
                    {
                        from.AddToBackpack(new LeadCoin(m_xAmount));
                        nDull = 1;
                    }
                    if (nDull > 0)
                    {
                        from.SendMessage("After drinking from the pool, you notice all of your coins has turned to lead!");
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);

                        LoggingFunctions.LogGenericQuest(from, "had all of their coins turn to lead after drinking from a strange pool");
                    }
                    else
                    {
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You drink from the pool and nothing happens!");
                    }
                    this.m_Uses = this.m_Uses - 1;
                }
                else if (m_Pool == 6)                   // EQUIPPED ITEM DISAPPEARS
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    this.m_Uses = this.m_Uses - 1;
                    int  mReturn = 0;
                    Item ILost   = HiddenTrap.GetMyItem(from);
                    if (ILost != null)
                    {
                        ILost.Delete(); mReturn = 1;
                    }
                    if (mReturn != 1)
                    {
                        from.SendMessage("After drinking from the pool, you notice one of your equipped items disappears!");
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);

                        LoggingFunctions.LogGenericQuest(from, "had an item vanish after drinking from a strange pool");
                    }
                }
                else if (m_Pool == 7)                   // LOSE A STAT POINT
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    this.m_Uses = this.m_Uses - 1;
                    int mCurse = 1;

                    if (m_Bonus > 8)
                    {
                        if (from.RawStr > 10)
                        {
                            from.RawStr = from.RawStr - 1; from.SendMessage("You feel weaker after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }
                    else if (m_Bonus > 5)
                    {
                        if (from.RawDex > 10)
                        {
                            from.RawDex = from.RawDex - 1; from.SendMessage("You feel sluggish after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }
                    else
                    {
                        if (from.RawInt > 10)
                        {
                            from.RawInt = from.RawInt - 1; from.SendMessage("Your mind is foggy after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }

                    if (mCurse == 1)
                    {
                        from.FixedParticles(0x3779, 1, 15, 9905, 32, 2, EffectLayer.Head);
                        from.FixedParticles(0x37B9, 1, 14, 9502, 32, 5, (EffectLayer)255);
                    }
                }
                else if (m_Pool == 8)                   // TREASURE CHEST
                {
                    from.PlaySound(0x364);
                    from.SendMessage("You pull a mystical chest out from the pool!");
                    this.m_Uses = 0;
                    LootChest MyChest = new LootChest(6);
                    MyChest.ItemID = Utility.RandomList(0x2823, 0x2824, 0x4FE6, 0x4FE7, 0x281F, 0x2820);
                    MyChest.Hue    = Utility.RandomList(0x961, 0x962, 0x963, 0x964, 0x965, 0x966, 0x967, 0x968, 0x969, 0x96A, 0x96B, 0x96C, 0x96D, 0x96E, 0x96F, 0x970, 0x971, 0x972, 0x973, 0x974, 0x975, 0x976, 0x977, 0x978, 0x979, 0x97A, 0x97B, 0x97C, 0x97D, 0x97E, 0x4AA);
                    Region reg = Region.Find(from.Location, from.Map);
                    MyChest.Name = "mystical chest from " + Server.Misc.Worlds.GetRegionName(from.Map, from.Location);
                    int xTraCash = Utility.RandomMinMax(5000, 8000);
                    ContainerFunctions.AddGoldToContainer(xTraCash, MyChest, 0, from);
                    int artychance = GetPlayerInfo.LuckyPlayerArtifacts(from.Luck) + 10;
                    if (Utility.RandomMinMax(0, 100) < artychance)
                    {
                        Item arty = ArtifactBuilder.CreateArtifact("random");
                        MyChest.DropItem(arty); BaseContainer.DropItemFix(arty, from, MyChest.ItemID, MyChest.GumpID);
                    }
                    from.AddToBackpack(MyChest);

                    LoggingFunctions.LogGenericQuest(from, "found a chest full of treasure in some strange pool");
                }
                else if (m_Pool == 9)                   // COPPER SILVER TO GOLD
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    Container cont   = from.Backpack;
                    int       nShine = 0;

                    int m_cAmount = from.Backpack.GetAmount(typeof(DDCopper));
                    int m_sAmount = from.Backpack.GetAmount(typeof(DDSilver));
                    int m_dAmount = from.Backpack.GetAmount(typeof(LeadCoin));

                    if (cont.ConsumeTotal(typeof(DDCopper), m_cAmount))
                    {
                        from.AddToBackpack(new Gold(m_cAmount));
                        nShine = 1;
                    }
                    if (cont.ConsumeTotal(typeof(DDSilver), m_sAmount))
                    {
                        from.AddToBackpack(new Gold(m_sAmount));
                        nShine = 1;
                    }
                    if (cont.ConsumeTotal(typeof(LeadCoin), m_dAmount))
                    {
                        from.AddToBackpack(new Gold(m_dAmount));
                        nShine = 1;
                    }
                    if (nShine > 0)
                    {
                        from.SendMessage("After drinking from the pool, you notice your meager coins turn to gold!");
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);

                        LoggingFunctions.LogGenericQuest(from, "had all of their meager coins turn to gold after drinking from a strange pool");
                    }
                    else
                    {
                        from.SendMessage("You drink from the pool and nothing happens!");
                    }
                    this.m_Uses = 0;
                }
                else                 // POISON
                {
                    if (from.Poisoned)
                    {
                        from.SendMessage("You are too sick to drink from this pool!");
                    }
                    else
                    {
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        if (m_Bonus > 9)
                        {
                            from.ApplyPoison(from, Poison.Deadly);
                        }
                        else if (m_Bonus > 7)
                        {
                            from.ApplyPoison(from, Poison.Greater);
                        }
                        else if (m_Bonus > 4)
                        {
                            from.ApplyPoison(from, Poison.Regular);
                        }
                        else
                        {
                            from.ApplyPoison(from, Poison.Lesser);
                        }
                        from.SendMessage("You feel more sick after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
            }
            else
            {
                from.SendMessage("The magic from the pool seems to be drained!");
            }
        }
Example #16
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (!(o is Mobile))
                {
                    from.SendLocalizedMessage(1046439);                       // That is not a valid target.
                    return;
                }

                Mobile target = (Mobile)o;

                switch (m_Talisman.Removal)
                {
                case TalismanRemoval.Curse:
                    target.PlaySound(0xF6);
                    target.PlaySound(0x1F7);
                    target.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    IEntity mfrom = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z - 10), from.Map);
                    IEntity mto   = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z + 50), from.Map);
                    Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                    StatMod mod;

                    mod = target.GetStatMod("[Magic] Str Offset");
                    if (mod != null && mod.Offset < 0)
                    {
                        target.RemoveStatMod("[Magic] Str Offset");
                    }

                    mod = target.GetStatMod("[Magic] Dex Offset");
                    if (mod != null && mod.Offset < 0)
                    {
                        target.RemoveStatMod("[Magic] Dex Offset");
                    }

                    mod = target.GetStatMod("[Magic] Int Offset");
                    if (mod != null && mod.Offset < 0)
                    {
                        target.RemoveStatMod("[Magic] Int Offset");
                    }

                    target.Paralyzed = false;

                    EvilOmenSpell.CheckEffect(target);
                    StrangleSpell.RemoveCurse(target);
                    CorpseSkinSpell.RemoveCurse(target);
                    CurseSpell.RemoveEffect(target);

                    BuffInfo.RemoveBuff(target, BuffIcon.Clumsy);
                    BuffInfo.RemoveBuff(target, BuffIcon.FeebleMind);
                    BuffInfo.RemoveBuff(target, BuffIcon.Weaken);
                    BuffInfo.RemoveBuff(target, BuffIcon.MassCurse);

                    if (target == from)
                    {
                        from.SendLocalizedMessage(1072408);                                   // Any curses on you have been lifted
                    }
                    else
                    {
                        from.SendLocalizedMessage(1072409);                                   // Your targets curses have been lifted
                        target.SendLocalizedMessage(1072408);                                 // Any curses on you have been lifted
                    }

                    break;

                case TalismanRemoval.Damage:
                    target.PlaySound(0x201);
                    Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                    BleedAttack.EndBleed(target, false);
                    MortalStrike.EndWound(target);

                    BuffInfo.RemoveBuff(target, BuffIcon.Bleed);
                    BuffInfo.RemoveBuff(target, BuffIcon.MortalStrike);

                    if (target == from)
                    {
                        from.SendLocalizedMessage(1072405);                                   // Your lasting damage effects have been removed!
                    }
                    else
                    {
                        from.SendLocalizedMessage(1072406);                                   // Your Targets lasting damage effects have been removed!
                        target.SendLocalizedMessage(1072405);                                 // Your lasting damage effects have been removed!
                    }

                    break;

                case TalismanRemoval.Ward:
                    target.PlaySound(0x201);
                    Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                    // Magic reflect
                    Hashtable m_Table = MagicReflectSpell.m_Table;

                    if (m_Table == null)
                    {
                        return;
                    }

                    ResistanceMod[] mods = (ResistanceMod[])m_Table[target];

                    m_Table.Remove(target);

                    if (mods != null)
                    {
                        for (int i = 0; i < mods.Length; ++i)
                        {
                            target.RemoveResistanceMod(mods[i]);
                        }
                    }

                    BuffInfo.RemoveBuff(target, BuffIcon.MagicReflection);


                    // Reactive armor
                    m_Table = ReactiveArmorSpell.m_Table;

                    if (m_Table == null)
                    {
                        return;
                    }

                    mods = (ResistanceMod[])m_Table[target];

                    if (mods != null)
                    {
                        m_Table.Remove(target);

                        for (int i = 0; i < mods.Length; ++i)
                        {
                            target.RemoveResistanceMod(mods[i]);
                        }
                    }

                    BuffInfo.RemoveBuff(target, BuffIcon.ReactiveArmor);


                    // Protection
                    m_Table = ProtectionSpell.m_Table;

                    if (m_Table == null)
                    {
                        return;
                    }

                    object[] pmods = (object[])m_Table[target];

                    if (mods != null)
                    {
                        m_Table.Remove(target);
                        ProtectionSpell.Registry.Remove(target);

                        target.RemoveResistanceMod((ResistanceMod)pmods[0]);
                        target.RemoveSkillMod((SkillMod)pmods[1]);
                    }

                    BuffInfo.RemoveBuff(target, BuffIcon.Protection);

                    if (target == from)
                    {
                        from.SendLocalizedMessage(1072402);                                   // Your wards have been removed!
                    }
                    else
                    {
                        from.SendLocalizedMessage(1072403);                                   // Your target's wards have been removed!
                        target.SendLocalizedMessage(1072402);                                 // Your wards have been removed!
                    }

                    break;
                }

                m_Talisman.ChargeTime = m_Talisman.MaxChargeTime;

                if (m_Talisman.Charges > 0)
                {
                    m_Talisman.Charges -= 1;
                }

                m_Talisman.StartTimer();
                m_Talisman.InvalidateProperties();
            }
        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;

                if (checkSkills = (healing >= 50.0 && anatomy >= 50.0))
                {
                    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);

                        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 (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);

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

                    double min, max;

                    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;
                    }

                    toHeal -= m_Slips * 4;

                    if (m_Patient.Poisoned)
                    {
                        toHeal /= 2;

                        double poisonCureChance = ((healing - 30.0) / 50.0) - (m_Patient.Poison.Level * 0.1) - (m_Slips * 0.02);

                        if (poisonCureChance > Utility.RandomDouble())
                        {
                            if (m_Patient.CurePoison(m_Healer))
                            {
                                m_Healer.SendMessage("You have cured the target of all poisons.");
                                m_Patient.SendMessage("You have been cured of all poisons.");
                            }
                        }
                        else
                        {
                            m_Healer.SendMessage("You have failed to cure your target.");
                        }
                    }

                    if (BleedAttack.IsBleeding(m_Patient))
                    {
                        toHeal /= 2;

                        m_Healer.SendMessage("You bind the wound and stop the bleeding.");
                        m_Patient.SendMessage("The bleeding wounds have healed, you are no longer bleeding!");

                        BleedAttack.EndBleed(m_Patient, false);
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    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);
            }
        }
Example #18
0
        public void EndHeal()
        {
            StopHeal();

            int healerNumber;
            int patientNumber;

            bool playSound = true;
            bool checkRes  = false;
            bool checkPois = false;

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

            var 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.GetRange(m_Healer.Expansion)))
            {
                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);

                //TODO: Dbl check doesn't check for faction of the horse here?
                if (((checkRes = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) ||
                    (m_Patient.EraSE && petPatient is FactionWarHorse && petPatient.ControlMaster == m_Healer))
                {
                    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();

                                foreach (Skill s in petPatient.Skills)
                                {
                                    double skillloss = s.Base * 0.01;
                                    s.Base -= skillloss;
                                }
                                Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient);
                            }
                            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));

                                Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient);
                            }
                            else
                            {
                                bool found = false;

                                List <Mobile> friends = petPatient.Friends;

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

                                    if (!friend.InRange(petPatient, 3))
                                    {
                                        continue;
                                    }

                                    healerNumber = 503255;                                     // You are able to resurrect the creature.

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

                                    found = true;
                                    Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient);
                                    break;
                                }

                                if (!found)
                                {
                                    healerNumber = 1049670;                                     // The pet's owner must be nearby to attempt resurrection.
                                }
                            }
                        }
                        else
                        {
                            m_Patient.CloseGump(typeof(ResurrectGump));

                            /*PlayerMobile pres = m_Patient as PlayerMobile;
                             *
                             * if (pres.MurderBounty > 0)
                             *      m_Patient.SendGump( new ResurrectGump( m_Patient, m_Healer, pres.MurderBounty ) );
                             * else*/
                            m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer));
                            Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient);
                        }
                    }
                }
                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.Level * 0.1) - (m_Slips * 0.02);

                if ((checkPois = (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 (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
            {
                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);

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

                    double min = (anatomy / 5.5) + (healing / 5.5) + 4.0;
                    double max = (anatomy / 5.0) + (healing / 2.5) + 10.0;

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

                    if ((m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal) && m_Patient.NetState == null)
                    // Alan Mod: player-controlled mobs heal like regular players
                    {
                        toHeal += m_Patient.HitsMax / 100;
                    }

                    toHeal -= m_Slips * 4;

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    var healfinal = (int)toHeal;

                    int healmessage = Math.Min(m_Patient.HitsMax - m_Patient.Hits, healfinal);

                    m_Patient.Heal(healfinal, m_Healer, false);

                    if (healmessage > 0)
                    {
                        m_Patient.PrivateOverheadMessage(
                            MessageType.Regular, 0x42, false, healmessage.ToString(CultureInfo.InvariantCulture), m_Patient.NetState);
                        if (m_Healer != m_Patient)
                        {
                            m_Patient.PrivateOverheadMessage(
                                MessageType.Regular, 0x42, false, healmessage.ToString(CultureInfo.InvariantCulture), m_Healer.NetState);
                        }
                    }
                }
                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);
            }

            double minSkill = 0.0;
            double maxSkill = 90.0;

            if (checkRes)
            {
                minSkill = 65.0;
                maxSkill = 120.0;
            }
            else if (checkPois)
            {
                minSkill = 45.0;
                maxSkill = 120.0;
            }

            m_Healer.CheckSkill(secondarySkill, minSkill, maxSkill);
            m_Healer.CheckSkill(primarySkill, minSkill, maxSkill);
        }
Example #19
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;

            //não pode estar montado
            if (m_Healer.Mounted)
            {
                m_Healer.SendMessage("Voce esta montando, e nao pode curar os ferimentos assim.");
            }
            else 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) && m_Patient.Alive) || (!m_Healer.InRange(m_Patient.Corpse, Bandage.Range) && !m_Patient.Alive))
            {
                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))
            {
                curarPacienteMorto(ref healerNumber, ref patientNumber, ref checkSkills, primarySkill, secondarySkill, petPatient);
            }
            else if (m_Patient.Poisoned)
            {
                curarPacienteEnvenenado(ref healerNumber, ref patientNumber, ref checkSkills, primarySkill, secondarySkill);
            }
            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 (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
            {
                curarPaciente(ref healerNumber, ref patientNumber, ref playSound, ref checkSkills, primarySkill, secondarySkill);
            }

            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);
            }
        }
Example #20
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 (Bandage.ProximityCheck(m_Healer, m_Patient, Core.AOS ? 2 : 1) == false)
            {
                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())
                {
                    if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, CanFitFlags.requireSurface))
                    {
                        healerNumber  = 501042;                        // Target can not be resurrected at that location.
                        patientNumber = 502391;                        // Thou can not be resurrected there!
                    }
                    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 && master.InRange(petPatient, 3))
                            {
                                healerNumber = 503255;                                 // You are able to resurrect the creature.
                                master.SendGump(new PetResurrectGump(m_Healer, petPatient));
                            }
                            else
                            {
                                healerNumber = 1049670;                                 // The pet's owner must be nearby to attempt resurrection.
                            }
                        }
                        else
                        {
                            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.Level * 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  = -1;
                patientNumber = 1060167;                 // The bleeding wounds have healed, you are no longer bleeding!

                BleedAttack.EndBleed(m_Patient, true);
            }
            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);

                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;
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    m_Patient.Heal((int)toHeal);
                }
                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, 100.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 100.0);
            }
        }
Example #21
0
        public void EndHeal(Bandage origin)
        {
            StopHeal();

            if (m_Healer is PlayerMobile)
            {
                ((PlayerMobile)m_Healer).WeaponTimerCheck();
            }

            int  healerNumber  = -1;
            int  patientNumber = -1;
            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.
            }
            else if (m_Healer.Paralyzed)
            {
                m_Healer.SendAsciiMessage("You were unable to finish your work before you got paralyzed");
                return;
            }
            else if (!m_Healer.InRange(m_Patient, Bandage.Range))
            {
                healerNumber = 500963;                 // You did not stay close enough to heal your target.
            }
            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.
                    }
                    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.
                    }
                    else
                    {
                        healerNumber = 500965;                         // You are able to resurrect your patient.

                        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;

                                List <Mobile> 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.
                    }
                }
            }
            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 - 40.0) / 50.0) - (m_Patient.Poison.Level * 0.11) - (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))
            {
                BleedAttack.EndBleed(m_Patient, false);
            }
            else if (MortalStrike.IsWounded(m_Patient))
            {
                healerNumber = (m_Healer == m_Patient ? 1005000 : 1010398);
            }
            else if (m_Patient.Hits == m_Patient.HitsMax)
            {
                healerNumber = 500967;                 // You heal what little damage your patient had.
            }
            else
            {
                checkSkills   = true;
                patientNumber = -1;
                Bandage bandage = null;

                if (origin.Parent == null && !origin.Deleted)
                {
                    origin.Consume(1);
                }
                else if ((bandage = m_Healer.Backpack.FindItemByType(typeof(Bandage), true) as Bandage) == null)
                {
                    m_Healer.SendAsciiMessage("You don't have any bandages.");
                    return;
                }
                else
                {
                    bandage.Consume(1);
                }

                double healing = m_Healer.Skills[primarySkill].Base;
                double anatomy = m_Healer.Skills[secondarySkill].Base;

                //Loki edit: Dexterity improves healing chance
                double chance = (healing / 100.0) * (0.91 + (((double)m_Healer.RawDex - 80.0) / 1000.0));

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

                    min = 0.04 * ((anatomy / 4.0) + (healing / 4.0));
                    max = ((anatomy / 4.0) + (healing / 4.0)) - 4;

                    //Loki edit: Bonus from dexterity
                    double dexbonus = ((double)m_Healer.RawDex - 80.0) / 10.0;
                    min += dexbonus;
                    max += dexbonus / 2;

                    if (max < 2)
                    {
                        max = 2;
                    }

                    double toHeal = Utility.RandomMinMax((int)min, (int)max);

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }
                    else if ((!origin.Deleted && (!origin.EventItem || (origin.EventItem && origin.EventItemConsume))) || (bandage != null && (!bandage.EventItem || (bandage.EventItem && bandage.EventItemConsume))))
                    {
                        Item item = new BloodyBandage();

                        if (origin.EventItem || (bandage != null && bandage.EventItem))
                        {
                            item.EventItem = true;
                            item.Hue       = origin.Hue;
                            item.Name      = "event Bloody bandage";
                        }

                        Mobile from = m_Healer;

                        if (from.AddToBackpack(item))
                        {
                            from.SendAsciiMessage("You put the {0} in your pack.", item.Name ?? CliLoc.LocToString(item.LabelNumber));
                        }
                        else //Taran: Bloody bandages stack on ground if the player is overweight
                        {
                            from.SendAsciiMessage("You are overweight and put the {0} on the ground.", item.Name ?? CliLoc.LocToString(item.LabelNumber));

                            IPooledEnumerable eable = from.Map.GetItemsInRange(from.Location, 0);

                            foreach (Item i in eable)
                            {
                                if (i is BloodyBandage)
                                {
                                    if (i.Serial != item.Serial)
                                    {
                                        i.Amount++;
                                        item.Delete();
                                    }

                                    break;
                                }
                            }

                            eable.Free();
                        }
                    }
                    else if (!origin.Deleted && (origin.EventItem && !origin.EventItemConsume))
                    {
                        Mobile from = m_Healer;

                        from.PlaySound(0x57);
                        from.SendAsciiMessage("You are able to re-use your bandage and put it in your pack.");
                    }

                    //m_Patient.Heal( (int)toHeal );
                    //Rev ~ 140 update
                    m_Patient.Heal((int)toHeal, m_Healer, false);
                }
                else
                {
                    healerNumber = 500968;                     // You apply the bandages, but they barely help.
                }
                m_Healer.CheckSkill(secondarySkill, 0.0, 120.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 120.0);
            }

            if (healerNumber != -1)
            {
                m_Healer.SendAsciiMessage(CliLoc.LocToString(healerNumber));
            }
            if (patientNumber != -1)
            {
                m_Patient.SendLocalizedMessage(patientNumber);
            }
            if (checkSkills)
            {
                m_Healer.CheckSkill(secondarySkill, 0.0, 100.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 100.0);
            }
        }
Example #22
0
        public void EndHeal()
        {
            StopHeal();

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

            if (Healer is Player)
            {
                ((Player)Healer).EoC++;
            }

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

            BaseCreature petPatient = m_Patient as BaseCreature;

            if (petPatient is BaseMount && ((BaseMount)petPatient).IsInjured)
            {
                if (Healer.Skills.Veterinary.Value < 100.0)
                {
                    Healer.SendMessage("You are not skilled enough to even attempt helping this animal..");
                    return;
                }

                else
                {
                    List <Item> healerItems  = Healer.Backpack.AcquireItems();
                    bool        hasSewingKit = false;

                    for (int i = 0; i < healerItems.Count || hasSewingKit; i++)
                    {
                        if (healerItems[i] is SewingKit)
                        {
                            hasSewingKit = true;
                        }
                    }

                    if (!hasSewingKit)
                    {
                        Healer.SendMessage("You require a sewing kit to mend the damage done to this creature.");
                    }

                    else
                    {
                        if (Utility.RandomDouble() < 0.1125)
                        {
                            petPatient.Kill();
                            Healer.SendMessage("Your efforts to assist the creature leads to its demise.");
                        }

                        else
                        {
                            ((BaseMount)petPatient).IsInjured = false;
                            Healer.SendMessage
                                ("You sucessfully mend the creature's injuries with bandages and thread.");
                        }
                    }
                }
            }

            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())
                {
                    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 && 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;

                                List <Mobile> 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.Level * 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, true);
            }
            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);

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

                    double toHeal = (((anatomy + healing) * 0.10) + Utility.RandomMinMax(0, 4));

                    if (m_Healer is Player)
                    {
                        Player player = m_Healer as Player;
                        Medic  med    = Perk.GetByType <Medic>(player);

                        if (med != null && med.IsDoctor())
                        {
                            toHeal = (toHeal * 1.5);
                        }
                    }

                    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;
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968; // You apply the bandages, but they barely help.
                    }

                    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, 100.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 100.0);
            }
        }
Example #23
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            attacker.PlaySound(0x5BC);                                                    // Bladeweave sound effect
            attacker.FixedParticles(0x376A, 1, 20, 0x7F5, 0x960, 0x3, EffectLayer.Waist); // TODO: Revisar efecto

            switch (Utility.RandomMinMax(1, 7))
            {
            case 1:
            {
                attacker.SendLocalizedMessage(1072841, "Paralyzing Blow");                                   // You weave your blade to execute a ~1_attack~.
                ParalyzingBlow at = new ParalyzingBlow();
                at.IsBladeweaveAttack = true;
                at.OnHit(attacker, defender, damage);
                break;
            }

            case 2:
            {
                attacker.SendLocalizedMessage(1072841, "Bleed Attack");                                   // You weave your blade to execute a ~1_attack~.
                BleedAttack at = new BleedAttack();
                at.IsBladeweaveAttack = true;
                at.OnHit(attacker, defender, damage);
                break;
            }

            case 3:
            {
                attacker.SendLocalizedMessage(1072841, "Double Strike");                                   // You weave your blade to execute a ~1_attack~.
                DoubleStrike at = new DoubleStrike();
                at.IsBladeweaveAttack = true;
                at.OnHit(attacker, defender, damage);
                break;
            }

            case 4:
            {
                attacker.SendLocalizedMessage(1072841, "Feint");                                   // You weave your blade to execute a ~1_attack~.
                Feint at = new Feint();
                at.IsBladeweaveAttack = true;
                at.OnHit(attacker, defender, damage);
                break;
            }

            case 5:
            {
                attacker.SendLocalizedMessage(1072841, "Mortal Strike");                                   // You weave your blade to execute a ~1_attack~.
                MortalStrike at = new MortalStrike();
                at.IsBladeweaveAttack = true;
                at.OnHit(attacker, defender, damage);
                break;
            }

            case 6:
            {
                attacker.SendLocalizedMessage(1072841, "block");                                   // You weave your blade to execute a ~1_attack~.
                Block at = new Block();
                at.IsBladeweaveAttack = true;
                at.OnHit(attacker, defender, damage);
                break;
            }

            case 7:
            {
                attacker.SendLocalizedMessage(1072841, "Crushing Blow");                                   // You weave your blade to execute a ~1_attack~.
                CrushingBlow at = new CrushingBlow();
                at.IsBladeweaveAttack = true;
                at.OnHit(attacker, defender, damage);
                break;
            }
            }
        }
Example #24
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);
            }
        }
Example #25
0
        public void EndHeal()
        {
            StopHeal();

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

            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, MedKit.Range))
            {
                healerNumber  = 500963;                // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!m_Patient.Alive)
            {
                m_Healer.SendMessage("They collapsed before you could finish your work.");
                playSound = false;
            }
            else if (MortalStrike.IsWounded(m_Patient) || m_Patient.Poisoned || BleedAttack.IsBleeding(m_Patient))
            {
                m_Healer.SendMessage("You're going to need to ask them to sit still!");
                playSound = false;
            }
            else
            {
                SkillName primarySkill   = SkillName.Healing;
                SkillName secondarySkill = SkillName.Anatomy;

                checkSkills = true;

                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);

                int amount = 0;

                if (anatomy == 100.0)
                {
                    amount = 5;
                }
                else if (anatomy >= 80.0)
                {
                    amount = 4;
                }
                else if (anatomy >= 60)
                {
                    amount = 3;
                }
                else if (anatomy >= 40)
                {
                    amount = 2;
                }
                else
                {
                    amount = 1;
                }

                if (chance > Utility.RandomDouble())
                {
                    ((PlayerMobile)m_Patient).InjuryPoints -= amount;

                    if (((PlayerMobile)m_Patient).InjuryPoints < 0)
                    {
                        ((PlayerMobile)m_Patient).InjuryPoints = 0;
                    }

                    m_Patient.SendMessage("They finish patching you up.");
                    m_Healer.SendMessage("You finish treating the patient.");
                }
                else
                {
                    m_Healer.SendMessage("You have a go at them, but seem to make things worse.");
                    ((PlayerMobile)m_Patient).InjuryPoints += 1;
                    playSound = false;
                }
            }

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

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

            if (playSound)
            {
                m_Patient.PlaySound(0x57);
            }
        }
Example #26
0
        public void Target(BaseTalisman talis, Mobile owner, Mobile m)
        {
            if (this.Parent == owner)
            {
                //Curse Removal
                if (talis.m_TalismanType == TalismanType.CurseRemoval)
                {
                    m.PlaySound(0xF6);
                    m.PlaySound(0x1F7);
                    m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    StatMod mod;

                    mod = m.GetStatMod("[Magic] Str Malus");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Str Malus");
                    }

                    mod = m.GetStatMod("[Magic] Dex Malus");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Dex Malus");
                    }

                    mod = m.GetStatMod("[Magic] Int Malus");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Int Malus");
                    }

                    m.Paralyzed = false;

                    EvilOmenSpell.CheckEffect(m);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);
                    CurseSpell.RemoveEffect(m);

                    BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
                    BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
                    BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
                    BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
                    BuffInfo.RemoveBuff(m, BuffIcon.Curse);
                    BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);

                    if (owner != m)
                    {
                        owner.SendLocalizedMessage(1072409);               // Your targets curses have been lifted
                    }
                    m.SendLocalizedMessage(1072408);                       // Any curses on you have been lifted
                }

                //Damage Removal
                if (talis.m_TalismanType == TalismanType.DamageRemoval)
                {
                    Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8);
                    Effects.PlaySound(m, m.Map, 0x201);
                    BleedAttack.EndBleed(m, false);
                    MortalStrike.EndWound(m);
                    m.CurePoison(m);

                    BuffInfo.RemoveBuff(m, BuffIcon.Bleed);
                    BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);

                    if (owner != m)
                    {
                        owner.SendLocalizedMessage(1072406);               // Your Targets lasting damage effects have been removed!
                    }
                    m.SendLocalizedMessage(1072405);                       // Your lasting damage effects have been removed!
                }

                //Ward Removal
                if (talis.m_TalismanType == TalismanType.WardRemoval)
                {
                    Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8);
                    Effects.PlaySound(m, m.Map, 0x201);

                    ProtectionSpell.RemoveWard(m);
                    ReactiveArmorSpell.RemoveWard(m);
                    MagicReflectSpell.RemoveWard(m);
                    TransformationSpell.RemoveContext(m, true);
                    ReaperFormSpell.RemoveEffects(m);
                    if (StoneFormSpell.UnderEffect(m))
                    {
                        StoneFormSpell.RemoveEffects(m);
                    }

                    if (owner != m)
                    {
                        owner.SendLocalizedMessage(1072403);               // Your target's wards have been removed!
                    }
                    m.SendLocalizedMessage(1072402);                       // Your wards have been removed!
                }

                //Wildfire Removal
                if (talis.m_TalismanType == TalismanType.WildfireRemoval)
                {
                    owner.SendLocalizedMessage(1042753, "Wildfire Removal");                       // ~1_SOMETHING~ has been temporarily disabled.
                }
                //CARGE TIMER
                ChargeTimeLeft = 1200;
                m_ChargeTimer  = new ChargeTimeLeftTimer(this);
                m_ChargeTimer.Start();
                m_ChargeTimeLeft3 = DateTime.Now;
            }
            else if (m_TalismanType != 0)
            {
                m.SendLocalizedMessage(502641);                   // You must equip this item to use it.
            }
        }
Example #27
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
            {
                return;
            }

            attacker.PlaySound( 0x5BC ); // Bladeweave sound effect
            attacker.FixedParticles( 0x376A, 1, 20, 0x7F5, 0x960, 0x3, EffectLayer.Waist ); // TODO: Revisar efecto

            switch ( Utility.RandomMinMax( 1, 7 ) )
            {
                case 1:
                    {
                        attacker.SendLocalizedMessage( 1072841, "Paralyzing Blow" ); // You weave your blade to execute a ~1_attack~.
                        ParalyzingBlow at = new ParalyzingBlow();
                        at.IsBladeweaveAttack = true;
                        at.OnHit( attacker, defender, damage );
                        break;
                    }
                case 2:
                    {
                        attacker.SendLocalizedMessage( 1072841, "Bleed Attack" ); // You weave your blade to execute a ~1_attack~.
                        BleedAttack at = new BleedAttack();
                        at.IsBladeweaveAttack = true;
                        at.OnHit( attacker, defender, damage );
                        break;
                    }
                case 3:
                    {
                        attacker.SendLocalizedMessage( 1072841, "Double Strike" ); // You weave your blade to execute a ~1_attack~.
                        DoubleStrike at = new DoubleStrike();
                        at.IsBladeweaveAttack = true;
                        at.OnHit( attacker, defender, damage );
                        break;
                    }
                case 4:
                    {
                        attacker.SendLocalizedMessage( 1072841, "Feint" ); // You weave your blade to execute a ~1_attack~.
                        Feint at = new Feint();
                        at.IsBladeweaveAttack = true;
                        at.OnHit( attacker, defender, damage );
                        break;
                    }
                case 5:
                    {
                        attacker.SendLocalizedMessage( 1072841, "Mortal Strike" ); // You weave your blade to execute a ~1_attack~.
                        MortalStrike at = new MortalStrike();
                        at.IsBladeweaveAttack = true;
                        at.OnHit( attacker, defender, damage );
                        break;
                    }
                case 6:
                    {
                        attacker.SendLocalizedMessage( 1072841, "block" ); // You weave your blade to execute a ~1_attack~.
                        Block at = new Block();
                        at.IsBladeweaveAttack = true;
                        at.OnHit( attacker, defender, damage );
                        break;
                    }
                case 7:
                    {
                        attacker.SendLocalizedMessage( 1072841, "Crushing Blow" ); // You weave your blade to execute a ~1_attack~.
                        CrushingBlow at = new CrushingBlow();
                        at.IsBladeweaveAttack = true;
                        at.OnHit( attacker, defender, damage );
                        break;
                    }
            }
        }
Example #28
0
        public static int GetCursePower(Mobile m)
        {
            int power = 0;

            // 1st circle debuffs
            foreach (string statModName in StatModNames)
            {
                if (m.GetStatMod(statModName) != null)
                {
                    power += 1;
                }
            }

            // 3rd circle debuffs
            if (EvilOmenSpell.UnderEffect(m))
            {
                power += 3;
            }

            if (BloodOathSpell.UnderEffect(m))
            {
                power += 3;
            }

            if (CorpseSkinSpell.UnderEffect(m))
            {
                power += 3;
            }

            if (MindRotSpell.HasMindRotScalar(m))
            {
                power += 3;
            }

            if (SleepSpell.IsSlept(m))
            {
                power += 3;
            }

            // 4th circle debuffs
            if (CurseSpell.UnderEffect(m))
            {
                power += 4;
            }

            // 6th circle debuffs
            if (StrangleSpell.UnderEffect(m))
            {
                power += 6;
            }

            // 7th circle debuffs
            if (SpellPlagueSpell.UnderEffect(m))
            {
                power += 7;
            }

            if (MortalStrike.IsWounded(m))
            {
                power += 7;
            }

            return(power);
        }
Example #29
0
        public void EndHeal()
        {
            m_Table.Remove(m_Healer);

            if (m_Timer != null)
            {
                m_Timer.Stop();
            }

            m_Timer = null;

            if (m_Bandage != null)
            {
                m_Bandage.OnHealFinished(this);
            }

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

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

            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 (m_Patient is BaseMount && m_Healer == (Mobile)petPatient.ControlMaster && (((BaseMount)m_Patient).ItemID == 16047 || ((BaseMount)m_Patient).ItemID == 16048 || ((BaseMount)m_Patient).ItemID == 16049 || ((BaseMount)m_Patient).ItemID == 16050))
                {
                    healerNumber  = 503255;                    // You are able to resurrect the creature.
                    patientNumber = -1;

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

                    petPatient.ControlMaster.CloseGump(typeof(PetResurrectGump));

                    if (petPatient.ControlMaster == m_Healer)
                    {
                        petPatient.ResurrectPet();

                        for (int i = 0; i < petPatient.Skills.Length; ++i)                           // Decrease all skills on pet.
                        {
                            petPatient.Skills[i].Base -= 0.1;
                        }
                    }
                    else
                    {
                        petPatient.ControlMaster.SendGump(new PetResurrectGump(m_Healer, petPatient));
                    }
                }
                else if ((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble())
                {
                    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.Name == "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 && master.InRange(petPatient, 3))
                            {
                                healerNumber = 503255;                                 // You are able to resurrect the creature.

                                master.CloseGump(typeof(PetResurrectGump));

                                if (master == m_Healer)
                                {
                                    petPatient.ResurrectPet();

                                    for (int i = 0; i < petPatient.Skills.Length; ++i)                                       // Decrease all skills on pet.
                                    {
                                        petPatient.Skills[i].Base -= 0.1;
                                    }
                                }
                                else
                                {
                                    master.SendGump(new PetResurrectGump(m_Healer, petPatient));
                                }
                            }
                            else
                            {
                                bool found = false;

                                List <Mobile> 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));

                                        if (friend == m_Healer)
                                        {
                                            petPatient.ResurrectPet();
                                        }
                                        else
                                        {
                                            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.Level * 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 (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);

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

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

                    double min, max;

                    if (m_Patient.IsPlayer)
                    {
                        min = (anatomy / 6.0) + (healing / 6.0) + 3.0;
                        max = (anatomy / 6.0) + (healing / 3.0) + 10.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;
                    }

                    toHeal -= toHeal * m_Slips * (0.35 + Math.Max(0, 140 - m_Healer.Dex) / 400.0);                         // TODO: Verify algorithm

                    if (m_AmountDivisor > 1)
                    {
                        toHeal /= m_AmountDivisor;
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    int healedPoints = (int)toHeal;

                    Server.Spells.Spellweaving.ArcaneEmpowermentSpell.ApplyHealBonus(m_Healer, ref healedPoints);

                    m_Patient.Heal(healedPoints, m_Healer, message: 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);
            }
        }
Example #30
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 Factions.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;

                                List <Mobile> 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.Level * 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 (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

                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;
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    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);
            }
        }
Example #31
0
        public override void OnComponentUsed(AddonComponent ac, Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 3))
            {
                from.SendMessage("You will have to get closer to drink from the magical pool!");
            }
            else if (m_Uses > 0)
            {
                if (m_Pool == 1)                   // STRENGTH
                {
                    if (Apply(from, StatType.Str, m_Bonus))
                    {
                        from.FixedEffect(0x375A, 10, 15);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You feel stronger after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 2)                   // INTELLECT
                {
                    if (Apply(from, StatType.Int, m_Bonus))
                    {
                        from.FixedEffect(0x375A, 10, 15);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You can think much more clearly after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 3)                   // DEXTERITY
                {
                    if (Apply(from, StatType.Dex, m_Bonus))
                    {
                        from.FixedEffect(0x375A, 10, 15);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You feel more nimble after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 4)                   // CURE
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    if (from.Poisoned)
                    {
                        from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                        from.CurePoison(from);
                        from.SendMessage("You feel much better after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                    else
                    {
                        from.SendMessage("You drink from the pool and nothing happens!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 5)                   // HEAL
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    if (from.Hits < from.HitsMax)
                    {
                        if (from.Poisoned || MortalStrike.IsWounded(from))
                        {
                            from.SendMessage("You drink from the pool and nothing happens!");
                            this.m_Uses = this.m_Uses - 1;
                        }
                        else
                        {
                            from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                            int min = 6;
                            int max = 10;
                            if (m_Bonus > 8)
                            {
                                min = 20; max = 30;
                            }
                            else if (m_Bonus > 5)
                            {
                                min = 13; max = 20;
                            }
                            from.Heal(Utility.RandomMinMax(min, max));
                            from.SendMessage("You drink from the pool and your wounds magically heal!");
                            this.m_Uses = this.m_Uses - 1;
                        }
                    }
                    else
                    {
                        from.SendMessage("You drink from the pool and nothing happens!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 6)                   // WATER ELEMENTAL
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    try
                    {
                        Map          map = this.Map;
                        BaseCreature bc  = (BaseCreature)Activator.CreateInstance(typeof(WaterElemental));

                        Point3D spawnLoc = this.Location;

                        for (int i = 0; i < 10; i++)
                        {
                            int x = Location.X + Utility.Random(4);
                            int y = Location.Y + Utility.Random(4);
                            int z = Map.GetAverageZ(x, y);

                            if (Map.CanSpawnMobile(new Point2D(x, y), this.Z))
                            {
                                spawnLoc = new Point3D(x, y, this.Z);
                            }
                            else if (Map.CanSpawnMobile(new Point2D(x, y), z))
                            {
                                spawnLoc = new Point3D(x, y, z);
                            }
                        }

                        Timer.DelayCall(TimeSpan.FromSeconds(1), delegate()
                        {
                            bc.Home      = Location;
                            bc.RangeHome = 5;
                            bc.FightMode = FightMode.Closest;
                            bc.MoveToWorld(spawnLoc, map);
                            bc.ForceReacquire();
                        });
                    }
                    catch
                    {
                    }
                    from.SendMessage("A water elemental emerges from the pool!");
                    this.m_Uses = this.m_Uses - 1;
                }
                else if (m_Pool == 7)                   // GOLD TO LEAD
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    Container cont     = from.Backpack;
                    Gold      m_Gold   = (Gold)from.Backpack.FindItemByType(typeof(Gold));
                    int       m_Amount = from.Backpack.GetAmount(typeof(Gold));

                    if (cont.ConsumeTotal(typeof(Gold), m_Amount))
                    {
                        from.AddToBackpack(new LeadCoin(m_Amount));
                        from.SendMessage("After drinking from the pool, you notice all of your gold has turned to lead!");
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
                    }
                    else
                    {
                        from.SendMessage("You drink from the pool and nothing happens!");
                    }
                    this.m_Uses = this.m_Uses - 1;
                }
                else if (m_Pool == 8)                   // EQUIPPED ITEM DISAPPEARS
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    this.m_Uses = this.m_Uses - 1;
                    int mReturn = 0;
                    if (from.FindItemOnLayer(Layer.OuterTorso) != null)
                    {
                        from.FindItemOnLayer(Layer.OuterTorso).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.OneHanded) != null)
                    {
                        from.FindItemOnLayer(Layer.OneHanded).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.TwoHanded) != null)
                    {
                        from.FindItemOnLayer(Layer.TwoHanded).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Bracelet) != null)
                    {
                        from.FindItemOnLayer(Layer.Bracelet).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Ring) != null)
                    {
                        from.FindItemOnLayer(Layer.Ring).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Helm) != null)
                    {
                        from.FindItemOnLayer(Layer.Helm).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Arms) != null)
                    {
                        from.FindItemOnLayer(Layer.Arms).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.OuterLegs) != null)
                    {
                        from.FindItemOnLayer(Layer.OuterLegs).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Neck) != null)
                    {
                        from.FindItemOnLayer(Layer.Neck).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Gloves) != null)
                    {
                        from.FindItemOnLayer(Layer.Gloves).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Talisman) != null)
                    {
                        from.FindItemOnLayer(Layer.Talisman).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Shoes) != null)
                    {
                        from.FindItemOnLayer(Layer.Shoes).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.Cloak) != null)
                    {
                        from.FindItemOnLayer(Layer.OneHanded).Delete();
                    }
                    else if (from.FindItemOnLayer(Layer.FirstValid) != null)
                    {
                        from.FindItemOnLayer(Layer.FirstValid).Delete();
                    }
                    else
                    {
                        mReturn = 1;
                        from.SendMessage("You drink from the pool and nothing happens!");
                    }
                    if (mReturn != 1)
                    {
                        from.SendMessage("After drinking from the pool, you notice one of your equipped items disappears!");
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
                    }
                }
                else if (m_Pool == 9)                   // LOSE A STAT POINT
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    this.m_Uses = this.m_Uses - 1;
                    int mCurse = 1;

                    if (m_Bonus > 8)
                    {
                        if (from.RawStr > 10)
                        {
                            from.RawStr = from.RawStr - 1; from.SendMessage("You lose a strength after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }
                    else if (m_Bonus > 5)
                    {
                        if (from.RawDex > 10)
                        {
                            from.RawDex = from.RawDex - 1; from.SendMessage("You lose a dexterity after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }
                    else
                    {
                        if (from.RawInt > 10)
                        {
                            from.RawInt = from.RawInt - 1; from.SendMessage("You lose an intelligence after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }

                    if (mCurse == 1)
                    {
                        from.FixedParticles(0x3779, 1, 15, 9905, 32, 2, EffectLayer.Head);
                        from.FixedParticles(0x37B9, 1, 14, 9502, 32, 5, (EffectLayer)255);
                    }
                }
                else if (m_Pool == 100)                   // TREASURE CHEST
                {
                    int tType  = 1;
                    int tChest = Utility.Random(100);
                    if (tChest > 95)
                    {
                        tType = 6;
                    }
                    else if (tChest > 85)
                    {
                        tType = 5;
                    }
                    else if (tChest > 70)
                    {
                        tType = 4;
                    }
                    else if (tChest > 50)
                    {
                        tType = 3;
                    }
                    else if (tChest > 25)
                    {
                        tType = 2;
                    }

                    from.PlaySound(0x364);
                    from.AddToBackpack(new PoolChest(tType));
                    from.SendMessage("You pull a mystical chest out from the pool!");
                    this.m_Uses = 0;
                }
                else                 // POISON
                {
                    if (from.Poisoned)
                    {
                        from.SendMessage("You are too sick to drink from this pool!");
                    }
                    else
                    {
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        if (m_Bonus > 9)
                        {
                            from.ApplyPoison(from, Poison.Deadly);
                        }
                        else if (m_Bonus > 7)
                        {
                            from.ApplyPoison(from, Poison.Greater);
                        }
                        else if (m_Bonus > 4)
                        {
                            from.ApplyPoison(from, Poison.Regular);
                        }
                        else
                        {
                            from.ApplyPoison(from, Poison.Lesser);
                        }
                        from.SendMessage("You feel more sick after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
            }
            else
            {
                from.SendMessage("The magic from the pool seems to be drained!");
            }
        }