Example #1
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;
        }
Example #2
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;
		}
Example #3
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;
		}
			public static void CURE(
				TriggerObject trigObj, IPoint2D target, Mobile from, int range, bool playeronly, bool mobsonly)
			{
				if (target == null)
				{
					return;
				}

				// apply the damage to all mobs within range if range is > 0
				Map map = (target is IEntity) ? ((IEntity)target).Map : Map.Felucca;
				Mobile targetMob = target as Mobile;

				// if it's a death trigger, then don't do damage to trigObj.This (if you do, it results in an infinite loop!)
				Mobile dyingMob = (trigObj.TrigName == TriggerName.onDeath ? trigObj.This as Mobile : null);

				if (range >= 0)
				{
					var rangelist = map.GetMobilesInRange(new Point3D(target, 0), range);
					// don't do damage in a list like this--if mobs are killed it screws up the enumerator!
					// ... copy the list first
					var affected = new List<Mobile>();

					affected.AddRange(
						rangelist.OfType<Mobile>()
								 .Where(p => p.Alive && (p is PlayerMobile && !mobsonly) || (p is BaseCreature && !playeronly)));

					rangelist.Free();

					foreach (Mobile mob in affected.Where(mob => mob != dyingMob))
					{
						if (from != null)
						{
							if (from.CanBeBeneficial(mob))
							{
								from.DoBeneficial(mob);
								mob.CurePoison(from);
							}
						}
						else
						{
							mob.CurePoison(mob);
						}
					}
				} // range of -1 means hit only the target
				else if ((targetMob is PlayerMobile && !mobsonly) || (targetMob is BaseCreature && !playeronly))
				{
					if (targetMob.Alive && targetMob != dyingMob)
					{
						if (from != null)
						{
							if (from.CanBeBeneficial(targetMob))
							{
								from.DoBeneficial(targetMob);
								targetMob.CurePoison(from);
							}
						}
						else
						{
							targetMob.CurePoison(targetMob);
						}
					}
				}
			}
		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;
		}
Example #6
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;
		}
Example #7
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;
		}