Exemplo n.º 1
1
        public static BandageContext BeginHeal( Mobile healer, Mobile patient )
        {
            bool isDeadPet = ( patient is BaseCreature && ((BaseCreature)patient).IsDeadPet );

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

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

                //double seconds;
                double seconds = patient.Alive ? (patient.Poisoned ? 6.0 : 5.0) : 10.0;
                double resDelay = ( patient.Alive ? 0.0 : 5.0 );

                if ( onSelf )
                {
                    if (Core.AOS)
                        seconds = 5.0 + (0.5 * ((double)(120 - dex) / 10)); // TODO: Verify algorithm
                    else//was: seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
                    {
                        seconds *= 3;

                        if (healer.Skills[SkillName.Healing].Value > 90)
                            seconds -= 3.0 * ((healer.Skills[SkillName.Healing].Value - 90.0) / 10.0);
                    }
                }
                /*else
                {
                    if ( Core.AOS && GetPrimarySkill( patient ) == SkillName.Veterinary )
                    {
                        //if ( dex >= 40 )
                            seconds = 2.0;
                        //else
                        //	seconds = 3.0;
                    }
                    else
                    {
                        if ( dex >= 100 )
                            seconds = 3.0 + resDelay;
                        else if ( dex >= 40 )
                            seconds = 4.0 + resDelay;
                        else
                            seconds = 5.0 + resDelay;
                    }
                }*/

                // according to stratics:
                // dex | heal self | heal other | cure self | cure other
                // 100 |   11s     |   3s       |   13      |  4
                seconds *= 0.74 + ((double)(100 - dex) / 75) * 0.26;

                BandageContext context = GetContext( healer );

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

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

                m_Table[healer] = context;

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

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

            return null;
        }
Exemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (!(BandageContext.BeginHeal(from, mobile) == null || DuelContext.IsFreeConsume(from)))
                        {
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295); // You are too far away to do that.
                    }
                }
                else if (targeted is PlagueBeastInnard innard)
                {
                    if (innard.OnBandage(from))
                    {
                        m_Bandage.Consume();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                }
            }
Exemplo n.º 3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(this.m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted, this.m_Bandage is EnhancedBandage) != null)
                        {
                            this.m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295); // You are too far away to do that.
                    }
                }
                else if (targeted is PlagueBeastInnard)
                {
                    if (((PlagueBeastInnard)targeted).OnBandage(from))
                    {
                        this.m_Bandage.Consume();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                }
            }
Exemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    Mobile m = targeted as Mobile;

                    if (Bandage.ProximityCheck(from, m, Core.AOS ? 2 : 1) == false)
                    {
                        from.SendLocalizedMessage(501043);                         // Target is not close enough.
                    }
                    else if (from.InRange(m_Bandage.GetWorldLocation(), Core.AOS ? 2 : 1))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                         // You are too far away to do that.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                     // Bandages can not be used on that.
                }
            }
Exemplo n.º 5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, mobile, m_Bandage is EnhancedBandage) != null)
                        {
                            NegativeAttributes.OnCombatAction(from);
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295); // You are too far away to do that.
                    }
                }
                else if (targeted is PlagueBeastInnard innard)
                {
                    if (innard.OnBandage(from))
                    {
                        NegativeAttributes.OnCombatAction(from);
                        m_Bandage.Consume();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                }
            }
Exemplo n.º 6
0
        public static BandageContext GetContext(Mobile healer)
        {
            BandageContext bc = null;

            m_Table.TryGetValue(healer, out bc);
            return(bc);
        }
Exemplo n.º 7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                           // You are too far away to do that.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                       // Bandages can not be used on that.
                }
            }
Exemplo n.º 8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Core.AOS ? 2 : 1))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You are too far away to do that.");                           //
                    }
                }
                else
                {
                    from.SendAsciiMessage("Bandages can not be used on that.");                       //
                }
            }
Exemplo n.º 9
0
            public InternalTimer(BandageContext context, TimeSpan delay, Bandage origin) : base(delay)
            {
                m_Context = context;
                Priority  = TimerPriority.FiftyMS;
                m_Origin  = origin;

                //if (context.Healer != context.Patient)
                //    context.Patient.SendAsciiMessage(string.Format("{0} begins to heal you.", context.Healer.Name));
            }
Exemplo n.º 10
0
        //This method added for [bandself command to call.
        public static void BandSelfCommandCall(Mobile from, Item m_Bandage)
        {
            from.RevealingAction();

            if (BandageContext.BeginHeal(from, from) != null)
            {
                m_Bandage.Consume();
            }
        }
Exemplo n.º 11
0
            public InternalTimer(BandageContext context, TimeSpan delay)
                : base(TimeSpan.FromMilliseconds(250), TimeSpan.FromMilliseconds(250))
            {
                m_Context = context;
                Priority  = TimerPriority.FiftyMS;

                m_Begin   = Core.TickCount;
                m_Expires = Core.TickCount + (int)delay.TotalMilliseconds;
            }
Exemplo n.º 12
0
        // Scriptiz : ajout d'une méthode pour la commande .bandself
        public static void BandSelfCommandCall(Mobile from, Item m_Bandage)
        {
            from.RevealingAction();

            if (BandageContext.BeginHeal(from, from) != null && !Engines.ConPVP.DuelContext.IsFreeConsume(from))
            {
                m_Bandage.Consume();
            }
        }
Exemplo n.º 13
0
        public override void OnHealStarted(BandageContext context)
        {
            Mobile healer = context.Healer;

            if (m_CooldownTable.ContainsKey(healer))
            {
                m_CooldownTable[healer].Stop();
            }

            m_CooldownTable[healer] = Timer.DelayCall(Cooldown + context.Delay, new TimerCallback(delegate { m_CooldownTable.Remove(healer); }));
        }
Exemplo n.º 14
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    Mobile target = targeted as Mobile;

                    if (target.Hidden)
                    {
                        from.SendMessage("That cannot be seen.");
                        return;
                    }

                    else if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        PlayerMobile playerTarget = targeted as PlayerMobile;

                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            if (!Engines.ConPVP.DuelContext.IsFreeConsume(from))
                            {
                                m_Bandage.Consume();
                            }
                        }
                    }

                    else
                    {
                        from.SendLocalizedMessage(500295); // You are too far away to do that.
                    }
                }

                else if (targeted is PlagueBeastInnard)
                {
                    if (((PlagueBeastInnard)targeted).OnBandage(from))
                    {
                        m_Bandage.Consume();
                    }
                }

                else
                {
                    from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                }
            }
Exemplo n.º 15
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    if (!HasFreeHand(from))
                    {
                        from.SendMessage("Vous devez avoir les mains libres pour pouvoir soigner.");
                    }
                    else if (from.Mounted)
                    {
                        from.SendMessage("Vous ne pouvez soigner sur une monture.");
                    }
                    else if (targeted is PlayerMobile && ((PlayerMobile)targeted).MortEngine.RisqueDeMort)
                    {
                        from.SendMessage("Cette personne est trop affaiblie pour être soignée.");
                    }
                    else if (HasChestArmor((Mobile)targeted))
                    {
                        from.SendMessage("Vous ne pouvez soigner si la personne porte un plastron.");
                    }
                    else if (from.InRange(m_Bandage.GetWorldLocation(), 1))
                    {
                        BandageContext context = BandageContext.GetContext((Mobile)targeted);

                        if (context != null)
                        {
                            from.SendMessage("Vous devez attendre avant de soigner à nouveau cette personne.");
                        }
                        else if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295); // You are too far away to do that.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                }
            }
Exemplo n.º 16
0
        // This method added for [bandself command to call.
        public static void BandSelfCommandCall(Mobile from, Item m_Bandage)
        {
            if (from.Blessed)
            {
                from.SendMessage("You cannot use bandages while in this state.");
                return;
            }

            from.RevealingAction();

            if (BandageContext.BeginHeal(from, from) != null)
            {
                m_Bandage.Consume();
            }
            Server.Gumps.QuickBar.RefreshQuickBar(from);
        }
Exemplo n.º 17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is PlayerMobile && ((PlayerMobile)targeted).Undead)
                {
                    if (from == targeted)
                    {
                        from.SendMessage("You have no need for the healing techniques of mortals.");
                    }
                    else
                    {
                        from.SendLocalizedMessage(500970);                           // Bandages can not be used on that.
                    }
                    return;
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                           // You are too far away to do that.
                    }
                }
                else if (targeted is PlagueBeastInnard)
                {
                    if (((PlagueBeastInnard)targeted).OnBandage(from))
                    {
                        m_Bandage.Consume();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                       // Bandages can not be used on that.
                }
            }
Exemplo n.º 18
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            bool consume = true;

                            if (from.Player)
                            {
                                Medic med = Perk.GetByType <Medic>((Player)from);

                                if (med != null)
                                {
                                    consume = !med.TryRecoverBandage();
                                    from.SendMessage("You manage to salvage some of the bandage.");
                                }
                            }

                            if (consume)
                            {
                                m_Bandage.Consume();
                            }
                        }
                    }

                    else
                    {
                        from.SendLocalizedMessage(500295); // You are too far away to do that.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                }
            }
Exemplo n.º 19
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                //para tratar de um corpo caido
                if (targeted is Corpse)
                {
                    Corpse corpo = (Corpse)targeted;
                    if (corpo.Owner != null && corpo.Owner is Jogador)
                    {
                        targeted = corpo.Owner;
                    }
                    else
                    {
                        from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                    }
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_Bandage.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                           // You are too far away to do that.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                       // Bandages can not be used on that.
                }
            }
Exemplo n.º 20
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    Mobile targetedMobile = (Mobile)targeted;

                    if (from.InRange(m_Bandage.GetWorldLocation(), 3) && from.InRange(targetedMobile.Location, Bandage.Range))
                    {
                        if (from is PlayerMobile)
                        {
                            ((PlayerMobile)from).SpellCheck();
                        }

                        from.PlaySound(0x57);
                        //ClearHandsBandage(from);

                        BandageContext.BeginHeal(from, targetedMobile, m_Bandage);
                    }
                    else
                    {
                        from.SendAsciiMessage("You are too far away to do that.");
                    }
                }
                else if (targeted is PlagueBeastInnard)
                {
                    if (((PlagueBeastInnard)targeted).OnBandage(from))
                    {
                        m_Bandage.Consume();
                    }
                }
                else
                {
                    from.SendAsciiMessage("Bandages can not be used on that.");
                }
            }
Exemplo n.º 21
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            from.PublicOverheadMessage(MessageType.Regular, 0x22, true, "** Begins healing with bandages! **");
                            from.Freeze(TimeSpan.FromSeconds(1.5));
                            if (!Engines.ConPVP.DuelContext.IsFreeConsume(from))
                            {
                                m_Bandage.Consume();
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                           // You are too far away to do that.
                    }
                }
                else if (targeted is PlagueBeastInnard)
                {
                    if (((PlagueBeastInnard)targeted).OnBandage(from))
                    {
                        m_Bandage.Consume();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                       // Bandages can not be used on that.
                }
            }
Exemplo n.º 22
0
        public override void OnHealFinished(BandageContext context)
        {
            Mobile healer = context.Healer, patient = context.Patient;

            if (!healer.Alive || !patient.Alive)
            {
                return;
            }

            if (!patient.IsPlayer)
            {
                return;
            }

            if (!healer.InRange(patient, Bandage.Range))
            {
                return;
            }

            EnchantedApple.RemoveCurses(patient);

            // Any curses on you have been lifted
            patient.SendLocalizedMessage(1072408);
        }
Exemplo n.º 23
0
		public static BandageContext BeginHeal(Mobile healer, Mobile patient)
		{
			bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

				bool onSelf = (healer == patient);
				double poisonDelay = (patient.Poisoned ? ((100.0 - healer.Skills[SkillName.Poisoning].Value) / 40.0) : 0.0);
				int dex = healer.Dex;

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

				if (onSelf)
				{
					/*if (healer.EraAOS)
					{
						seconds = 5.0 + (0.5 * ((double)(120 - dex) / 10));
					}
					else
					{
						seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
					}*/

					seconds = 10.0 + ((100 - dex) / 18.75) + poisonDelay;
				}
				else
				{
					/*if (healer.EraAOS && GetPrimarySkill(patient) == SkillName.Veterinary)
					{
						seconds = 2.0;
					}
					else if (healer.EraAOS)
					{
						if (dex < 204)
						{
							seconds = 3.2 - (Math.Sin((double)dex / 130) * 2.5) + resDelay;
						}
						else
						{
							seconds = 0.7 + resDelay;
						}
					}
					else
					{
						if (dex >= 100)
						{
							seconds = 3.0 + resDelay;
						}
						else if (dex >= 40)
						{
							seconds = 4.0 + resDelay;
						}
						else
						{
							seconds = 5.0 + resDelay;
						}
					}*/

					seconds = 3.0 + ((100 - dex) / 37.5) + resDelay + poisonDelay;
				}

				BandageContext context = GetContext(healer);

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

				//seconds *= 1000;

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

				m_Table[healer] = context;

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

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

			return null;
		}
Exemplo n.º 24
0
 public virtual void OnHealFinished( BandageContext context )
 {
 }
Exemplo n.º 25
0
		public bool StartBandage()
		{
			m_Bandage = null;

			Container pack = m_Guard.Backpack;

			if (pack == null)
			{
				return false;
			}

			Item bandage = pack.FindItemByType(typeof(Bandage));

			if (bandage == null)
			{
				return false;
			}

			m_Bandage = BandageContext.BeginHeal(m_Guard, m_Guard, null);
			m_BandageStart = DateTime.UtcNow;
			return (m_Bandage != null);
		}
Exemplo n.º 26
0
        public static BandageContext BeginHeal(Mobile healer, Mobile patient)
        {
            //vira para quem vai curar
            SpellHelper.Turn(healer, patient);

            bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

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

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

                BandageContext context = GetContext(healer);

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

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

                m_Table[healer] = context;

                if (!onSelf)
                {
                    patient.SendLocalizedMessage(1008078, false, healer.Name);                       //  : Attempting to heal you.
                }
                //mensagens
                if (patient.Alive)
                {
                    healer.Emote("*{0} esta tratando os ferimentos de {1}*", healer.Name, patient.Name);
                    if (healer.Body.Type == BodyType.Human && !healer.Mounted)
                    {
                        healer.Animate(10, 5, 1, true, false, 0);
                        healer.PlaySound(72);
                    }
                }
                else
                {
                    healer.Emote("*{0} esta estancando os ferimentos de {1}*", healer.Name, patient.Name);
                    if (healer.Body.Type == BodyType.Human && !healer.Mounted)
                    {
                        healer.Animate(10, 5, 4, true, false, 0);
                        healer.PlaySound(72);
                    }
                }

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

            return(null);
        }
Exemplo n.º 27
0
			public InternalTimer(BandageContext context, TimeSpan delay)
				: base(delay)
			{
				m_Context = context;
				Priority = TimerPriority.FiftyMS;
			}
Exemplo n.º 28
0
        public static BandageContext BeginHeal( Mobile healer, Mobile patient )
        {
            //vira para quem vai curar
            SpellHelper.Turn(healer, patient);

            bool isDeadPet = ( patient is BaseCreature && ((BaseCreature)patient).IsDeadPet );

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

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

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

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

                BandageContext context = GetContext( healer );

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

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

                m_Table[healer] = context;

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

                //mensagens
                if (patient.Alive)
                {
                    healer.Emote("*{0} esta tratando os ferimentos de {1}*", healer.Name, patient.Name);
                    if ( healer.Body.Type == BodyType.Human && !healer.Mounted ) {
                        healer.Animate(10, 5, 1, true, false, 0 );
                        healer.PlaySound(72);
                    }
                }
                else
                {
                    healer.Emote("*{0} esta estancando os ferimentos de {1}*", healer.Name, patient.Name);
                    if (healer.Body.Type == BodyType.Human && !healer.Mounted) {
                        healer.Animate(10, 5, 4, true, false, 0);
                        healer.PlaySound(72);
                    }
                }

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

            return null;
        }
Exemplo n.º 29
0
        public static BandageContext BeginHeal( Mobile healer, Mobile patient )
        {
            bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

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

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

                if( healer.Player )
                {
                    Medic med = Perk.GetByType<Medic>((Player)healer);

                    if( med != null )
                        seconds -= med.GetHealTimeBonus(seconds);
                }

                BandageContext context = GetContext(healer);

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

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

                m_Table[healer] = context;

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

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

            return null;
        }
Exemplo n.º 30
0
			public InternalTimer( BandageContext context, TimeSpan delay, Bandage origin ) : base( delay )
			{
				m_Context = context;
				Priority = TimerPriority.FiftyMS;
				m_Origin = origin;

				//if (context.Healer != context.Patient)
				//    context.Patient.SendAsciiMessage(string.Format("{0} begins to heal you.", context.Healer.Name));
			}
Exemplo n.º 31
0
		public static BandageContext BeginHeal( Mobile healer, Mobile patient, Bandage origin )
		{
			bool isDeadPet = ( patient is BaseCreature && ( (BaseCreature)patient ).IsDeadPet );

			if( patient is Golem )
			{
				healer.SendLocalizedMessage( 500970 ); // Bandages cannot be used on that.
			}
			else if( patient is BaseCreature && ( (BaseCreature)patient ).IsAnimatedDead )
			{
				healer.SendLocalizedMessage( 500951 ); // You cannot heal that.
			}
			else if( !patient.Poisoned && patient.Hits >= patient.HitsMax && !BleedAttack.IsBleeding( patient ) && !isDeadPet )
			{
                healer.SendAsciiMessage("That being is not damaged!");
			}
			else if( !patient.Alive && ( patient.Map == null || !patient.Map.CanFit( patient.Location, 16, false, false ) ) )
			{
				healer.SendLocalizedMessage( 501042 ); // Target cannot be resurrected at that location.
			}
			else if( healer.CanBeBeneficial( patient, true, true ) )
			{
				//Maka
				if( healer is PlayerMobile )
					((PlayerMobile)healer).WeaponTimerCheck();

				healer.RevealingAction();

                if ( patient.Player)
				    healer.DoBeneficial( patient );

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

				//double seconds;
				double bandageDelay = ( patient.Alive ? 2.5 : 0.0 );
                /*
				if ( onSelf )
				{
				    if ( Core.AOS )
				        seconds = 5.0 + (0.5 * ((double)(120 - dex) / 10)); // TODO: Verify algorithm
				    else
				        seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
				}
				else
				{
				    if ( Core.AOS && GetPrimarySkill( patient ) == SkillName.Veterinary )
				    {
				        seconds = 2.0;
				    }
                					else if ( Core.AOS )
					{
						if (dex < 204)
						{		
							seconds = 3.2-(Math.Sin((double)dex/130)*2.5) + resDelay;
						}
						else
						{
							seconds = 0.7 + resDelay;
						}
					}
				    else
				    {
				        if ( dex >= 100 )
				            seconds = 3.0 + resDelay;
				        else if ( dex >= 40 )
				            seconds = 4.0 + resDelay;
				       else
				            seconds = 5.0 + resDelay;
				    }
				}
                */
				BandageContext context = GetContext( healer );

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

                //seconds *= 1000;
                //context = new BandageContext(healer, patient, TimeSpan.FromMilliseconds(seconds));

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

				m_Table[healer] = context;

				healer.SendAsciiMessage( string.Format( "You put the clean bandages on the wounded {0}.", patient.Name ) );
				return context;
			}

			return null;
		}
Exemplo n.º 32
0
        public bool StartBandage()
        {
            this.m_Bandage = null;

            Container pack = this.m_Guard.Backpack;

            if (pack == null)
                return false;

            Item bandage = pack.FindItemByType(typeof(Bandage));

            if (bandage == null)
                return false;

            this.m_Bandage = BandageContext.BeginHeal(this.m_Guard, this.m_Guard);
            this.m_BandageStart = DateTime.Now;
            return (this.m_Bandage != null);
        }
Exemplo n.º 33
0
        public static BandageContext BeginHeal( Mobile healer, Mobile patient, Bandage bandage )
        {
            bool isDeadPet = ( patient is BaseCreature && ( (BaseCreature) patient ).IsDeadPet );

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

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

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

                if ( onSelf )
                {
                    seconds = 5 + ( 0.5 * ( (double) ( 120 - dex ) / 10 ) ); // TODO: Verify algorithm
                }
                else
                {
                    if ( GetPrimarySkill( patient, healer ) == SkillName.Veterinary )
                        seconds = 2;
                    else
                        seconds = 4 - ( (double) ( dex / 60 ) ) + resDelay;
                }

                if ( seconds < 1 )
                    seconds = 1;

                if ( seconds > 8 )
                    seconds = 8;

                BandageContext context = GetContext( healer );

                if ( context != null )
                    context.RefreshTimer( TimeSpan.FromSeconds( seconds ) );
                else
                    m_Table[healer] = context = new BandageContext( healer, patient, TimeSpan.FromSeconds( seconds ), bandage );

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

                if ( healer.Client != null )
                    healer.Client.Send( new CooldownInfo( bandage, (int) seconds ) );

                BuffInfo.AddBuff( healer, new BuffInfo( BuffIcon.Healing, 1151311, 1151400, TimeSpan.FromSeconds( seconds ), healer, patient.Name ) );

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

            return null;
        }
Exemplo n.º 34
0
 public InternalTimer(BandageContext context, TimeSpan delay) : base(delay)
 {
     m_Context = context;
     Priority  = TimerPriority.FiftyMS;
 }
Exemplo n.º 35
0
 public virtual void OnHealStarted( BandageContext context )
 {
 }
Exemplo n.º 36
0
        public static BandageContext BeginHeal(Mobile healer, Mobile patient)
        {
            bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

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

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

                BandageContext context = GetContext(healer);

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

                if ((patient.LastHealTime + TimeSpan.FromMinutes(3.0)) < DateTime.Now)
                {
                    patient.LastHealTime = DateTime.Now;
                    context = new BandageContext(healer, patient, TimeSpan.FromSeconds(/*seconds*/ 0.0));
                }
                else
                {
                    healer.SendAsciiMessage("This being cannot be newly bandaged yet.");
                }

                m_Table[healer] = context;

                /*if ( !onSelf )
                 * patient.SendAsciiMessage(String.Format("{0} : Attempting to heal you.", healer.Name));*/
                //patient.SendLocalizedMessage( 1008078, false, healer.Name ); //  : Attempting to heal you.

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

            return(null);
        }
Exemplo n.º 37
0
		public bool StartBandage()
		{
			m_Bandage = null;

			Container pack = m_Guard.Backpack;

			if ( pack == null )
				return false;

			Item bandage = pack.FindItemByType( typeof( Bandage ) );

			if ( bandage == null )
				return false;

			//m_Bandage = BandageContext.BeginHeal( m_Guard, m_Guard ); //Iza - Guards didn't heal anyways...
			m_BandageStart = DateTime.Now;
			return ( m_Bandage != null );
		}
Exemplo n.º 38
0
        public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced)
        {
            bool isDeadPet = patient is BaseCreature && ((BaseCreature)patient).IsDeadPet;

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

                BandageContext context = GetContext(healer);

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

                var delay = GetDelay(healer, patient);

                if (patient is PlayerMobile)
                {
                    BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Healing, 1002082, 1151400, delay, healer, string.Format("{0}", patient.Name)));
                }
                else
                {
                    BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Veterinary, 1002167, 1151400, delay, healer, string.Format("{0}", patient.Name)));
                }

                context = new BandageContext(healer, patient, delay, enhanced);

                m_Table[healer] = context;

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

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

                if (healer.NetState != null && healer.NetState.IsEnhancedClient)
                {
                    healer.NetState.Send(new BandageTimerPacket((int)delay.TotalSeconds));
                }

                return(context);
            }

            return(null);
        }
Exemplo n.º 39
0
        public override void OnHealFinished( BandageContext context )
        {
            Mobile healer = context.Healer, patient = context.Patient;

            if ( !healer.Alive || !patient.Alive )
                return;

            if ( !patient.IsPlayer )
                return;

            if ( !healer.InRange( patient, Bandage.Range ) )
                return;

            EnchantedApple.RemoveCurses( patient );

            // Any curses on you have been lifted
            patient.SendLocalizedMessage( 1072408 );
        }
Exemplo n.º 40
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                var entity = targeted as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                    UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, m_Bandage))
                {
                    return;
                }

                if (targeted is BaseCreature &&
                    (((BaseCreature)targeted).Pseu_CanBeHealed == false || ((BaseCreature)targeted).ChampSpawn != null))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951);                     // You cannot heal that.
                }
                else if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), GetRange(from.Expansion)))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            var region1 = from.Region as CustomRegion;

                            if (!DuelContext.IsFreeConsume(from) && (region1 == null || !region1.PlayingGame(from)))
                            {
                                IUOFBattle battle = null;

                                if (from is PlayerMobile)
                                {
                                    battle = AutoPvP.FindBattleI <IUOFBattle>((PlayerMobile)from);
                                }

                                if (battle == null || !battle.NoConsume)
                                {
                                    m_Bandage.Consume();
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                         // You are too far away to do that.
                    }
                }
                else if (targeted is PlagueBeastInnard)
                {
                    if (((PlagueBeastInnard)targeted).OnBandage(from))
                    {
                        m_Bandage.Consume();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                     // Bandages can not be used on that.
                }
            }
Exemplo n.º 41
0
        public static BandageContext BeginHeal(Mobile healer, Mobile patient)
        {
            bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

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

                if (onSelf)
                {
                    //seconds = AOS.GeneralTimeScaling * (9.4 + (0.6 * ((double)(120 - dex) / 10)));
                    seconds = 10.0 + (100 - (healer.Skills[SkillName.Soins].Value)) / 10;
                }
                else
                {
                    /*if (dex > 150)
                     *  dex = 150;
                     *
                     * seconds = AOS.GeneralTimeScaling * (0.6 * ((double)(150 - dex) / 9));*/
                    seconds = 4.0 + (100 - (healer.Skills[SkillName.Soins].Value)) / 10;
                }

                BandageContext context = GetContext(healer);

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

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

                m_Table[healer] = context;

                if (!onSelf)
                {
                    patient.SendLocalizedMessage(1008078, false, healer.GetNameUsedBy(patient)); //  : Attempting to heal you.
                }
                healer.SendLocalizedMessage(500956);                                             // You begin applying the bandages.
                return(context);
            }

            return(null);
        }
Exemplo n.º 42
0
        public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced) // TODO: Implement Pub 71 healing changes
        {
            bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

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

                if (onSelf)
                {
                    if (Core.AOS)
                    {
                        seconds = Math.Min(8, Math.Ceiling(11.0 - healer.Dex / 20));
                        seconds = Math.Max(seconds, 4);
                    }
                    else
                    {
                        seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
                    }
                }
                else
                {
                    if (Core.AOS && GetPrimarySkill(patient) == SkillName.Veterinary)
                    {
                        seconds = 2.0;
                    }
                    else if (Core.AOS)
                    {
                        seconds = Math.Ceiling((double)4 - healer.Dex / 60);
                        seconds = Math.Max(seconds, 2);
                    }
                    else
                    {
                        if (dex >= 100)
                        {
                            seconds = 3.0 + resDelay;
                        }
                        else if (dex >= 40)
                        {
                            seconds = 4.0 + resDelay;
                        }
                        else
                        {
                            seconds = 5.0 + resDelay;
                        }
                    }
                }

                BandageContext context = GetContext(healer);

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

                if (patient is PlayerMobile)
                {
                    BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Healing, 1002082, 1151400, TimeSpan.FromSeconds(seconds), healer, String.Format("{0}", patient.Name)));
                }
                else
                {
                    BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Veterinary, 1002167, 1151400, TimeSpan.FromSeconds(seconds), healer, String.Format("{0}", patient.Name)));
                }

                seconds *= 1000;

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

                m_Table[healer] = context;

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

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

            return(null);
        }
Exemplo n.º 43
0
		public bool StartBandage(Mobile from, Mobile to)
		{
			if (BandageCount >= 1)
			{
				m_Bandage = null;
				m_Bandage = BandageContext.BeginHeal(from, to);
				m_BandageStart = DateTime.Now;
				if (m_Bandage != null)
				{	// alls well, consume the bandage!
					Bandage bandage = GetBandage();
					if (bandage != null)
						bandage.Consume();
					return true;
				}
			}
			return false;
		}
Exemplo n.º 44
0
		public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced)
		{
			bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

				if (onSelf)
				{
					if (Core.AOS)
					{
						//seconds = 5.0 + (0.5 * ((double)(120 - dex) / 10)); // TODO: Verify algorithm // Old
                        seconds = 5.0 + (0.5 * ((double)(90 - dex) / 10)); // New
                        if (seconds < 2.0)
                            seconds = 2.0;
                    }
					else
					{
						seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
					}
                }
                else
				{
					if (Core.AOS && GetPrimarySkill(patient) == SkillName.Veterinary)
					{
						seconds = 2.0;
					}
					else if (Core.AOS)
					{
						if (dex < 204)
						{
							seconds = 3.2 - (Math.Sin((double)dex / 130) * 2.5) + resDelay;
						}
						else
						{
							seconds = 0.7 + resDelay;
						}
					}
					else
					{
						if (dex >= 100)
						{
							seconds = 3.0 + resDelay;
						}
						else if (dex >= 40)
						{
							seconds = 4.0 + resDelay;
						}
						else
						{
							seconds = 5.0 + resDelay;
						}
					}
                }
                BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Healing, 1071289, 1002082, TimeSpan.FromSeconds(seconds), healer));
                if (healer != patient)
                    BuffInfo.AddBuff(patient, new BuffInfo(BuffIcon.Incognito, 1071289, 1002082, TimeSpan.FromSeconds(seconds), patient));
                // Healing = 1002082
                // BandageSelf = 1076227
                // * Bandages = 1078821
                // Bandage Self = 1114306
                // Bandage Selected Target = 1114307

                BandageContext context = GetContext(healer);

				if (context != null)
				{
					context.StopHeal();
				}
				seconds *= 1000;

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

				m_Table[healer] = context;

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

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

			return null;
		}
Exemplo n.º 45
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_Bandage.Consume();
                            Server.Gumps.QuickBar.RefreshQuickBar(from);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                           // You are too far away to do that.
                    }
                }
                else if (targeted is HenchmanFighterItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80)
                {
                    HenchmanFighterItem friend = (HenchmanFighterItem)targeted;

                    if (friend.HenchDead > 0)
                    {
                        friend.Name      = "fighter henchman";
                        friend.HenchDead = 0;
                        friend.InvalidateProperties();
                        m_Bandage.Consume();
                    }
                    else
                    {
                        from.SendMessage("They are not dead.");
                    }
                }
                else if (targeted is HenchmanWizardItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80)
                {
                    HenchmanWizardItem friend = (HenchmanWizardItem)targeted;

                    if (friend.HenchDead > 0)
                    {
                        friend.Name      = "wizard henchman";
                        friend.HenchDead = 0;
                        friend.InvalidateProperties();
                        m_Bandage.Consume();
                    }
                    else
                    {
                        from.SendMessage("They are not dead.");
                    }
                }
                else if (targeted is HenchmanArcherItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80)
                {
                    HenchmanArcherItem friend = (HenchmanArcherItem)targeted;

                    if (friend.HenchDead > 0)
                    {
                        friend.Name      = "archer henchman";
                        friend.HenchDead = 0;
                        friend.InvalidateProperties();
                        m_Bandage.Consume();
                    }
                    else
                    {
                        from.SendMessage("They are not dead.");
                    }
                }
                else if (targeted is HenchmanMonsterItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80)
                {
                    HenchmanMonsterItem friend = (HenchmanMonsterItem)targeted;

                    if (friend.HenchDead > 0)
                    {
                        friend.Name      = "creature henchman";
                        friend.HenchDead = 0;
                        friend.InvalidateProperties();
                        m_Bandage.Consume();
                    }
                    else
                    {
                        from.SendMessage("They are not dead.");
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                       // Bandages can not be used on that.
                }
            }
Exemplo n.º 46
0
		public static BandageContext BeginHeal( Mobile healer, Mobile patient )
		{
			bool isDeadPet = ( patient is BaseCreature && ((BaseCreature)patient).IsDeadPet );

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

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

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

				if ( onSelf )
				{
					seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
				}
				else
				{
					if ( dex >= 100 )
						seconds = 3.0 + resDelay;
					else if ( dex >= 40 )
						seconds = 4.0 + resDelay;
					else
						seconds = 5.0 + resDelay;
				}

				BandageContext context = GetContext( healer );

				if ( context != null )
					context.StopHeal();
				seconds *= 1000;
				
				context = new BandageContext( healer, patient, TimeSpan.FromMilliseconds( seconds ) );

				m_Table[healer] = context;

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

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

			return null;
		}
Exemplo n.º 47
0
        public override void OnHealStarted( BandageContext context )
        {
            Mobile healer = context.Healer;

            if ( m_CooldownTable.ContainsKey( healer ) )
                m_CooldownTable[healer].Stop();

            m_CooldownTable[healer] = Timer.DelayCall( Cooldown + context.Delay, new TimerCallback( delegate { m_CooldownTable.Remove( healer ); } ) );
        }
Exemplo n.º 48
0
        public static BandageContext BeginHeal( Mobile healer, Mobile patient )
        {
            bool isDeadPet = ( patient is BaseCreature && ((BaseCreature)patient).IsDeadPet );

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

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

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

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

                BandageContext context = GetContext( healer );

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

                if ((patient.LastHealTime + TimeSpan.FromMinutes(3.0)) < DateTime.Now)
                {
                    patient.LastHealTime = DateTime.Now;
                    context = new BandageContext(healer, patient, TimeSpan.FromSeconds( /*seconds*/ 0.0));
                }
                else
                    healer.SendAsciiMessage("This being cannot be newly bandaged yet.");

                m_Table[healer] = context;

                /*if ( !onSelf )
                    patient.SendAsciiMessage(String.Format("{0} : Attempting to heal you.", healer.Name));*/
                    //patient.SendLocalizedMessage( 1008078, false, healer.Name ); //  : Attempting to heal you.

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

            return null;
        }
Exemplo n.º 49
0
 public InternalTimer( BandageContext context, TimeSpan delay )
     : base(TimeSpan.FromSeconds( delay.TotalSeconds / 2 ), TimeSpan.FromSeconds( delay.TotalSeconds / 2 ))
 {
     m_Context = context;
     m_AttemptedMidlifeCure = false;
 }
Exemplo n.º 50
0
        public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced)
        {
            bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

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

                if (onSelf)
                {
                    if (Core.AOS)
                    {
                        seconds = 5.0 + (0.5 * ((double)(120 - dex) / 10));                         // TODO: Verify algorithm
                    }
                    else
                    {
                        seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
                    }
                }
                else
                {
                    if (Core.AOS && GetPrimarySkill(patient) == SkillName.Veterinary)
                    {
                        seconds = 2.0;
                    }
                    else if (Core.AOS)
                    {
                        if (dex < 204)
                        {
                            seconds = 3.2 - (Math.Sin((double)dex / 130) * 2.5) + resDelay;
                        }
                        else
                        {
                            seconds = 0.7 + resDelay;
                        }
                    }
                    else
                    {
                        if (dex >= 100)
                        {
                            seconds = 3.0 + resDelay;
                        }
                        else if (dex >= 40)
                        {
                            seconds = 4.0 + resDelay;
                        }
                        else
                        {
                            seconds = 5.0 + resDelay;
                        }
                    }
                }

                BandageContext context = GetContext(healer);

                if (context != null)
                {
                    context.StopHeal();
                }
                seconds *= 1000;

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

                m_Table[healer] = context;

                if (!onSelf)
                {
                    patient.SendLocalizedMessage(1008078, false, healer.Name); //  : Attempting to heal you.
                }
                healer.SendLocalizedMessage(500956);                           // You begin applying the bandages.
                return(context);
            }

            return(null);
        }
Exemplo n.º 51
0
		public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced) // TODO: Implement Pub 71 healing changes
		{
			bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

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

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

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

				if (onSelf)
				{
					if (Core.AOS)
					{
						seconds = Math.Ceiling((double)11 - healer.Dex / 20);
						seconds = Math.Max(seconds, 4);
					}
					else
					{
						seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
					}
				}
				else
				{
					if (Core.AOS && GetPrimarySkill(patient) == SkillName.Veterinary)
					{
						seconds = 2.0;
					}
					else if (Core.AOS)
					{
						seconds = Math.Ceiling((double)4 - healer.Dex / 60);
						seconds = Math.Max(seconds, 2);
					}
					else
					{
						if (dex >= 100)
						{
							seconds = 3.0 + resDelay;
						}
						else if (dex >= 40)
						{
							seconds = 4.0 + resDelay;
						}
						else
						{
							seconds = 5.0 + resDelay;
						}
					}
				}

				BandageContext context = GetContext(healer);

				if (context != null)
				{
					context.StopHeal();
				}
				seconds *= 1000;

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

				m_Table[healer] = context;

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

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

			return null;
		}