Ejemplo n.º 1
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile) targeted, true ) )
                {
                    BaseCreature creature = (BaseCreature) targeted;

                    if ( !m_Instrument.IsChildOf( from.Backpack ) )
                    {
                        from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if ( creature.Controlled )
                    {
                        from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked.
                    }
                    else if ( creature.IsParagon && BaseInstrument.GetBaseDifficulty( creature ) >= 160.0 )
                    {
                        from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
                    }
                    else
                    {
                        from.RevealingAction();
                        m_Instrument.PlayInstrumentWell( from );
                        from.SendLocalizedMessage( 1008085 ); // You play your music and your target becomes angered.  Whom do you wish them to attack?
                        from.Target = new InternalSecondTarget( from, m_Instrument, creature );
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 501589 ); // You can't incite that!
                }
            }
Ejemplo n.º 2
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            m.Target = new InternalTarget();
            m.RevealingAction();

            m.SendLocalizedMessage( 500397 ); // To whom do you wish to grovel?

            return TimeSpan.FromHours( 6.0 );
        }
Ejemplo n.º 3
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            m.Target = new InternalTarget();
            m.RevealingAction();

            m.SendAsciiMessage("Select the map upon which to draw.");

            return TimeSpan.FromSeconds(10.0);
        }
Ejemplo n.º 4
0
        public static TimeSpan OnUse( Mobile m )
        {
            if ( !m.Hidden )
            {
                m.SendLocalizedMessage( 502725 ); // You must hide first
            }
            else if ( m.Skills[SkillName.Hiding].Base < 30.0 )
            {
                m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
                m.RevealingAction();
            }
            else if ( !m.CanBeginAction( typeof( Stealth ) ) )
            {
                m.SendLocalizedMessage( 1063086 ); // You cannot use this skill right now.
                m.RevealingAction();
            }
            else if ( m.Flying )
            {
                m.SendLocalizedMessage( 1113415 ); // You cannot use this ability while flying.
                m.RevealingAction();
            }
            else
            {
                int armorRating = GetArmorRating( m );

                if ( armorRating >= 42 ) // I have a hunch '42' was chosen cause someone's a fan of DNA
                {
                    m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
                    m.RevealingAction();
                }
                else if ( m.CheckSkill( SkillName.Stealth, -20.0 + ( armorRating * 2 ), 60.0 + ( armorRating * 2 ) ) )
                {
                    int steps = (int) ( m.Skills[SkillName.Stealth].Value / 5.0 );

                    if ( steps < 1 )
                        steps = 1;

                    m.AllowedStealthSteps = steps;
                    m.IsStealthing = true;

                    m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

                    return TimeSpan.FromSeconds( 10.0 );
                }
                else
                {
                    m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
                    m.RevealingAction();
                }
            }

            return TimeSpan.FromSeconds( 10.0 );
        }
Ejemplo n.º 5
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            m.Target = new InternalTarget();
            m.RevealingAction();

            if ( !m_DisableMessage )
                m.SendLocalizedMessage( 502789 ); // Tame which animal?

            return TimeSpan.FromHours( 6.0 );
        }
Ejemplo n.º 6
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            m.Target = new InternalTarget();
            m.RevealingAction();

            if (!m_DisableMessage)
                m.SendAsciiMessage("Tame which animal?");

            return TimeSpan.FromHours( 6.0 );
        }
		public override void Drink( Mobile from )
		{
			if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
			{
				from.SendLocalizedMessage( 1062725 ); // You can not use that potion while paralyzed.
				return;
			}

			int delay = GetDelay( from );

			if ( delay > 0 )
			{
				from.SendLocalizedMessage( 1072529, String.Format( "{0}\t{1}", delay, delay > 1 ? "seconds." : "second." ) ); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
				return;
			}

			ThrowTarget targ = from.Target as ThrowTarget;

			if ( targ != null && targ.Potion == this )
				return;

			from.RevealingAction();

			if ( !m_Users.Contains( from ) )
				m_Users.Add( from );

			from.Target = new ThrowTarget( this );
		}
Ejemplo n.º 8
0
 public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
 {
     from.RevealingAction();
     from.SendLocalizedMessage( 1049525 ); // Whom do you wish to calm?
     from.Target = new InternalTarget( from, instrument );
     from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.0 );
 }
Ejemplo n.º 9
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            Timer t = m_Table[m] as Timer;
            if ( t != null && t.Running )
                t.Stop();
            if ( m.CheckSkill( SkillName.SpiritSpeak, 0, 100 ) )
            {
                if ( t == null )
                    m_Table[m] = t = new SpiritSpeakTimer( m );

                double secs = m.Skills[SkillName.SpiritSpeak].Base / 50;
                secs *= 90;
                if ( secs < 10 )
                    secs = 10;

                t.Delay = TimeSpan.FromSeconds( secs );//15 seconds to 3 minutes
                t.Start();
                m.CanHearGhosts = true;

                m.PlaySound( 0x24A );
                m.SendLocalizedMessage( 502444 );//You contact the neitherworld.
            }
            else
            {
                m_Table.Remove( m );
                m.SendLocalizedMessage( 502443 );//You fail to contact the neitherworld.
                m.CanHearGhosts = false;
            }

            return TimeSpan.FromSeconds( 10.0 );
        }
Ejemplo n.º 10
0
		protected override void OnTarget( Mobile from, object o )
		{
			IPoint3D ip = o as IPoint3D;

			if ( ip != null )
			{
				if ( ip is Item )
					ip = ((Item)ip).GetWorldTop();

				Point3D p = new Point3D( ip );

				Region reg = Region.Find( new Point3D( p ), from.Map );

				if ( from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing( from, p ) )
					m_Deed.OnPlacement( from, p );
				else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
					from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
				else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) )
					from.SendLocalizedMessage( 1043287 ); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
				else
					from.SendLocalizedMessage( 501265 ); // Housing can not be created in this area.

                if (HouseSystemController._MaxPlaceDelay > 0)
                {
                    from.BeginAction(typeof(HouseDeed));
                    Timer.DelayCall<Mobile>(TimeSpan.FromSeconds(Utility.RandomMinMax(HouseSystemController._MinPlaceDelay, HouseSystemController._MaxPlaceDelay)), new TimerStateCallback<Mobile>(ReleasePlacementLock), from);
                }
                from.RevealingAction();
			}
		}
Ejemplo n.º 11
0
        public override void Drink( Mobile from )
        {
            if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
            {
                from.SendLocalizedMessage( 1062725 ); // You can not use a purple potion while paralyzed.
                return;
            }

            ThrowTarget targ = from.Target as ThrowTarget;
            this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.

            if ( targ != null && targ.Potion == this )
                return;

            from.RevealingAction();

            if ( m_Users == null )
                m_Users = new ArrayList();

            if ( !m_Users.Contains( from ) )
                m_Users.Add( from );

            from.Target = new ThrowTarget( this );

            if ( m_Timer == null )
            {
                from.SendLocalizedMessage( 500236 ); // You should throw it now!

                if( Core.ML )
                    m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.25 ), 5, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 3.6 seconds explosion delay
                else
                    m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 2.6 seconds explosion delay
            }
        }
Ejemplo n.º 12
0
        public static TimeSpan OnUse(Mobile m)
        {
            if (!m.Hidden)
            {
                m.SendLocalizedMessage(502725); // You must hide first
            }
            else if (m.Skills[SkillName.Hiding].Base < 80.0)
            {
                m.SendLocalizedMessage(502726); // You are not hidden well enough.  Become better at hiding.
            }
            else if (GetArmorOffset(m) >= 15)
            {
                m.SendLocalizedMessage(502727); // You could not hope to move quietly wearing this much armor.
            }
            else if (m.CheckSkill(SkillName.Stealth, 0.0, 100.0))
            {
                int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0));

                if (steps < 1)
                    steps = 1;

                m.AllowedStealthSteps = steps;

                m.SendLocalizedMessage(502730); // You begin to move quietly.

                return TimeSpan.FromSeconds(10.0);
            }
            else
            {
                m.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed.
                m.RevealingAction();
            }

            return TimeSpan.FromSeconds(10.0);
        }
Ejemplo n.º 13
0
        public override void Drink(Mobile from)
        {
            if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)))
            {
                from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed.
                return;
            }

            ThrowTarget targ = from.Target as ThrowTarget;

            if (targ != null && targ.Potion == this)
                return;

            from.RevealingAction();

            if (m_Users == null)
                m_Users = new ArrayList();

            if (!m_Users.Contains(from))
                m_Users.Add(from);

            from.Target = new ThrowTarget(this);

            if (m_Timer == null)
            {
                from.SendLocalizedMessage(500236); // You should throw it now!
                m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 });
            }
        }
Ejemplo n.º 14
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                int number = -1;

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

                    if ( targ.Player ) // We can't beg from players
                    {
                        from.SendAsciiMessage("Perhaps just asking would work better.");
                        number = 500398; // Perhaps just asking would work better.
                    }
                    else if ( !targ.Body.IsHuman ) // Make sure the NPC is human
                    {
                        from.SendAsciiMessage("There is little chance of getting money from that!");
                        number = 500399; // There is little chance of getting money from that!
                    }
                    else if ( !from.InRange( targ, 2 ) )
                    {
                        if (!targ.Female)
                        {
                            from.SendAsciiMessage("You are too far away to beg from him.");
                            number = 500401; // You are too far away to beg from him.
                        }
                        else
                            from.SendAsciiMessage("You are too far away to beg from her.");
                            //number = 500402; // You are too far away to beg from her.
                    }
                    else if ( from.Mounted ) // If we're on a mount, who would give us money?
                    {
                        from.SendAsciiMessage("They seem unwilling to give you any money.");
                        number = 500404; // They seem unwilling to give you any money.
                    }
                    else
                    {
                        // Face eachother
                        from.Direction = from.GetDirectionTo( targ );
                        targ.Direction = targ.GetDirectionTo( from );

                        from.Animate( 32, 5, 1, true, false, 0 ); // Bow

                        new InternalTimer( from, targ ).Start();

                        m_SetSkillTime = false;
                    }
                }
                else // Not a Mobile
                {
                    from.SendAsciiMessage("There is little chance of getting money from that!");
                    //number = 500399; // There is little chance of getting money from that!
                }

                number = -1;
                if ( number != -1 )
                    from.SendLocalizedMessage( number );
            }
Ejemplo n.º 15
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();

        }
Ejemplo n.º 16
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            new Engines.Craft.CartographySystem().Begin( m, null );

            return TimeSpan.FromSeconds( 10.0 );
        }
Ejemplo n.º 17
0
		public static TimeSpan OnUse( Mobile m )
		{
			m.Target = new ForensicTarget();
			m.RevealingAction();
			m.SendLocalizedMessage( 500906 ); // What would you like to evaluate?

			return TimeSpan.FromSeconds( 1.0 ); // default 1 second - 10 seconds is applied on valid target
		}
Ejemplo n.º 18
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            BaseInstrument.PickInstrument( m, new InstrumentPickedCallback( OnPickedInstrument ) );

            return TimeSpan.FromSeconds( 1.0 ); // Cannot use another skill for 1 second
        }
Ejemplo n.º 19
0
		public override void OnDoubleClick(Mobile from)
		{
				if (from == null)
					return;

				from.RevealingAction();
				from.BeginTarget(1, false, TargetFlags.None, new TargetCallback(ItemClaimer_OnTarget));
		}
Ejemplo n.º 20
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();

		}
Ejemplo n.º 21
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.Target = new ForensicTarget();
            m.RevealingAction();

            m.SendLocalizedMessage(500906); // What would you like to evaluate?

            return TimeSpan.FromSeconds(10.0);
        }
Ejemplo n.º 22
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.Target = new ForensicTarget();
            m.RevealingAction();

            m.SendLocalizedMessage( 501000 ); // Show me the crime.

            return TimeSpan.FromSeconds( 1.0 );
        }
      public override void Drink( Mobile from )
      {
         from.RevealingAction();

         from.SendLocalizedMessage( 500236 ); // You should throw it now!
         from.Target = new InternalTarget( this );

         new DelayTimer( from, this ).Start();
      }
Ejemplo n.º 24
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker )  )
                return;

            ClearCurrentAbility( attacker );

            Map map = attacker.Map;

            if ( map == null )
                return;

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if ( weapon == null )
                return;

            if ( !CheckMana( attacker, true ) )
                return;

            attacker.FixedEffect( 0x3728, 10, 15 );
            attacker.PlaySound( 0x2A1 );

            ArrayList list = new ArrayList();

            foreach ( Mobile m in attacker.GetMobilesInRange( 1 ) )
                list.Add( m );

            Party p = Party.Get( attacker );

            for ( int i = 0; i < list.Count; ++i )
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker &&
                    SpellHelper.ValidIndirectTarget(attacker, m) &&
                    attacker.CanBeHarmful(m, false) &&
                    (p == null || !p.Contains(m)))
                {
                    if ( m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee( m ) )
                        continue;

                    if ( !attacker.InRange( m, weapon.MaxRange ) )
                        continue;

                    if ( attacker.InLOS( m ) )
                    {
                        attacker.RevealingAction();

                        attacker.SendLocalizedMessage( 1060161 ); // The whirling attack strikes a target!
                        m.SendLocalizedMessage( 1060162 ); // You are struck by the whirling attack and take damage!

                        weapon.OnHit( attacker, m );
                    }
                }
            }
        }
Ejemplo n.º 25
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.Target = new ForensicTarget();
            m.RevealingAction();

            m.SendAsciiMessage( "What would you like to evaluate?" );

            return TimeSpan.FromSeconds( 1.0 );
        }
Ejemplo n.º 26
0
 public override void OnDoubleClick(Mobile from)
 {
     if (from.InRange(GetWorldLocation(), Range)) {
         from.RevealingAction();
         from.SendMessage("Who will you use the medkit on?");
         from.Target = new InternalTarget( this );
     } else {
         from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
     }
 }
Ejemplo n.º 27
0
        public static TimeSpan OnUse(Mobile m)
        {
            if (!(m is PlayerMobile))
                return TimeSpan.Zero;

            m.Target = new Stealing.StealingTarget((PlayerMobile)m);
            m.RevealingAction();
            m.SendLocalizedMessage(502698); // Which item do you want to steal?
            return TimeSpan.Zero;
        }
Ejemplo n.º 28
0
        public override void Drink( Mobile from )
        {
            ThrowTarget targ = from.Target as ThrowTarget;

            if ( targ != null && targ.Potion == this )
                return;

            from.RevealingAction();

            from.Target = new ThrowTarget( this );
        }
Ejemplo n.º 29
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				from.RevealingAction();

                IEntity entity = targeted as IEntity;
                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Begging, from.Skills[SkillName.Begging].Value))
                {
                    return;
                }

				int number = -1;

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

					if ( targ.Player ) // We can't beg from players
						number = 500398; // Perhaps just asking would work better.
					else if ( !targ.Body.IsHuman ) // Make sure the NPC is human
						number = 500399; // There is little chance of getting money from that!
					else if ( !from.InRange( targ, 2 ) )
					{
						if ( !(targ is IBegged) )
							number = 500403; // That's too far away.  You couldn't beg from it anyway.
						else if ( targ.Female )
							number = 500402; // You are too far away to beg from her.
						else
							number = 500401; // You are too far away to beg from him.
					}
					else if ( from.Mounted ) // If we're on a mount, who would give us money?
						number = 500404; // They seem unwilling to give you any money.
					else if ( targ is IBegged )
					{
						// Face eachother
						from.Direction = from.GetDirectionTo( targ );
						targ.Direction = targ.GetDirectionTo( from );

						from.Animate( 32, 5, 1, true, false, 0 ); // Bow

						new InternalTimer( from, (IBegged)targ ).Start();

						m_SetSkillTime = false;
					}
					else
						number = 500404; // They seem unwilling to give you any money.

				}
				else // Not a Mobile
					number = 500399; // There is little chance of getting money from that!

				if ( number != -1 )
					from.SendLocalizedMessage( number );
			}
Ejemplo n.º 30
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this, 1))
            {
                SendLocalizedMessageTo(from, 1076766); // That is too far away.
                return;
            }

            from.RevealingAction();

            if (0.025 > Utility.RandomDouble())
            {
                from.AddToBackpack(new RareSerpentEgg());
                from.SendLocalizedMessage(1112581); // You reach in and find a rare serpent egg!!
            }
            else
            {
                switch (Utility.Random(3))
                {
                    case 0:
                        {
                            from.SendLocalizedMessage(1112578); // You try to reach the eggs, but the hole is too deep.

                            break;
                        }
                    case 1:
                        {
                            from.SendLocalizedMessage(1112579); // You reach in but clumsily destroy the eggs inside the nest.
                            this.Collapse(from);

                            break;
                        }
                    case 2:
                        {
                            from.SendLocalizedMessage(1112580); // Beware! You've hatched the eggs!!
                            this.HatchEggs(from);

                            from.PrivateOverheadMessage(MessageType.Regular, 33, 1112940, from.NetState); // Your hand remains stuck!!!
                            from.Frozen = true;

                            Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(
                                delegate
                                {
                                    from.Frozen = false;
                                    from.PrivateOverheadMessage(MessageType.Regular, 65, 1112941, from.NetState); // You manage to free your hand!
                                }));

                            break;
                        }
                }
            }
        }
Ejemplo n.º 31
0
        //Aura Start
        public static void Aura(Mobile from, int min, int max, int type, int range, int poisons, string text)
        {
            ArrayList targets = new ArrayList();

            foreach (Mobile m in from.GetMobilesInRange(range))
            {
                if (m == from || m == null)
                {
                    continue;
                }

                if (from is BaseCreature && ((BaseCreature)from).Controlled)
                {
                    if (m is BaseCreature && !(((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned))
                    {
                        targets.Add(m);
                    }
                    else if (m.Player && m.AccessLevel == AccessLevel.Player && m.Alive && m.Kills >= 5)
                    {
                        targets.Add(m);
                    }
                }
                else
                {
                    if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned))
                    {
                        targets.Add(m);
                    }
                    else if (m.Player && m.AccessLevel == AccessLevel.Player && m.Alive)
                    {
                        targets.Add(m);
                    }
                }
            }

            for (int i = 0; i < targets.Count; ++i)
            {
                Mobile m = (Mobile)targets[i];
                m.RevealingAction();
                m.SendMessage(text);

                int auradamage = Utility.RandomMinMax(min, max);

                if (type == 1)
                {
                    AOS.Damage(m, from, auradamage, 0, 100, 0, 0, 0);
                }
                else if (type == 2)
                {
                    AOS.Damage(m, from, auradamage, 0, 0, 100, 0, 0);
                }
                else if (type == 3)
                {
                    AOS.Damage(m, from, auradamage, 0, 0, 0, 100, 0);
                    m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
                }
                else if (type == 4)
                {
                    AOS.Damage(m, from, auradamage, 0, 0, 0, 0, 100);
                }
                else
                {
                    AOS.Damage(m, from, auradamage, 100, 0, 0, 0, 0);
                }

                if (poisons == 1)
                {
                    m.ApplyPoison(from, Poison.Lesser);
                }
                else if (poisons == 2)
                {
                    m.ApplyPoison(from, Poison.Regular);
                }
                else if (poisons == 3)
                {
                    m.ApplyPoison(from, Poison.Greater);
                }
                else if (poisons == 4)
                {
                    m.ApplyPoison(from, Poison.Deadly);
                }
                else if (poisons == 5)
                {
                    m.ApplyPoison(from, Poison.Lethal);
                }
                else
                {
                };
            }
        }
Ejemplo n.º 32
0
        // Main Aura Method
        public static void Aura(Point3D location, Map map, Mobile from, int min, int max, ResistanceType type, int range, Poison poison, string text, bool scales, bool allownull, bool effects, int itemid, int hue)
        {
            if (from == null && !allownull)
            {
                return;
            }

            List <Mobile> targets = new List <Mobile>();

            foreach (Mobile m in Map.AllMaps[map.MapID].GetMobilesInRange(location, range))
            {
                if (CanTarget(from, m, true, false, allownull))
                {
                    targets.Add(m);
                }
            }

            if (effects && from != null)
            {
                from.Animate(12, 5, 1, true, false, 0);
            }

            for (int i = 0; i < targets.Count; i++)
            {
                Mobile m = (Mobile)targets[i];
                m.RevealingAction();

                if (text != "")
                {
                    m.SendMessage(text);
                }

                int auradamage = Utility.RandomMinMax(min, max);

                if (scales)
                {
                    auradamage = (int)((auradamage / GetDist(location, m.Location)) * range);
                }

                if (poison != null)
                {
                    m.ApplyPoison((from == null) ? m : from, poison);
                }

                if (effects)
                {
                    m.FixedParticles(itemid, 10, 15, 5030 /*what the hell does this number do?*/, hue, 0, EffectLayer.Waist);
                }

                switch (type)
                {
                case ResistanceType.Physical:
                    AOS.Damage(m, (from == null) ? m : from, auradamage, 100, 0, 0, 0, 0);
                    break;

                case ResistanceType.Fire:
                    AOS.Damage(m, (from == null) ? m : from, auradamage, 0, 100, 0, 0, 0);
                    break;

                case ResistanceType.Cold:
                    AOS.Damage(m, (from == null) ? m : from, auradamage, 0, 0, 100, 0, 0);
                    break;

                case ResistanceType.Poison:
                    AOS.Damage(m, (from == null) ? m : from, auradamage, 0, 0, 0, 100, 0);
                    break;

                case ResistanceType.Energy:
                    AOS.Damage(m, (from == null) ? m : from, auradamage, 0, 0, 0, 0, 100);
                    break;
                }
            }

            targets.Clear();
        }
Ejemplo n.º 33
0
        public static int Damage(bool directDamage, Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, int chao, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chao);

            switch (Utility.RandomMinMax(1, 5))
            {
            case 1: phys += chao; break;

            case 2: fire += chao; break;

            case 3: cold += chao; break;

            case 4: pois += chao; break;

            case 5: nrgy += chao; break;
            }

            chao = 0;

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (m_ArmorIgnore)
            {
                resPhys = fire = cold = pois = nrgy = 0;
                phys    = 100;
            }

            if (m_ArmorPierce)
            {
                double delta = 0.6;                 // is this correct?

                resPhys -= (int)(delta * resPhys);
            }

            int totalDamage;

            totalDamage  = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
            {
                totalDamage = 1;
            }

            int absorbed;

            #region Damage Eater
            int dmgEater = Math.Min((int)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.DamageEater), 18);

            int physEater = dmgEater;
            int fireEater = dmgEater;
            int coldEater = dmgEater;
            int poisEater = dmgEater;
            int nrgyEater = dmgEater;

            if (!m_ArmorIgnore)
            {
                physEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticEater), dmgEater), 30);
                fireEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireEater), dmgEater), 30);
                coldEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdEater), dmgEater), 30);
                poisEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonEater), dmgEater), 30);
                nrgyEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyEater), dmgEater), 30);
            }

            absorbed  = damage * phys * (100 - resPhys) * physEater;
            absorbed += damage * fire * (100 - resFire) * fireEater;
            absorbed += damage * cold * (100 - resCold) * coldEater;
            absorbed += damage * pois * (100 - resPois) * poisEater;
            absorbed += damage * nrgy * (100 - resNrgy) * nrgyEater;

            absorbed /= 1000000;

            if (m is PlayerMobile)
            {
                ((PlayerMobile)m).EatDamage(absorbed);
            }
            #endregion

            if (!m_ArmorIgnore)
            {
                #region Resonance
                if (m.Spell is Spell && m.Spell.IsCasting)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        double chance = 0.0;

                        switch (i)
                        {
                        case 0: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticResonance) / phys; break;

                        case 1: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireResonance) / fire; break;

                        case 2: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdResonance) / cold; break;

                        case 3: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonResonance) / pois; break;

                        case 4: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyResonance) / nrgy; break;
                        }

                        if (chance > Utility.RandomDouble())
                        {
                            ((Spell)m.Spell).Resonates = true;
                            break;
                        }
                    }
                }
                #endregion
            }

            #region Dragon Barding
            if ((from == null || !from.IsPlayer) && m.IsPlayer && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent = (pet.BardingExceptional ? 20 : 10);
                    absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;
                    if (!(pet is ParoxysmusSwampDragon))
                    {
                        pet.BardingHP -= absorbed;
                    }

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null)
            {
                int reflectPhys = m.GetMagicalAttribute(MagicalAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        int rpd_damage = Scale((damage * phys * (100 - from.PhysicalResistance)) / 10000, reflectPhys);
                        if (m is PlayerMobile && from is PlayerMobile && directDamage)
                        {
                            rpd_damage = Math.Min(rpd_damage, 35);
                        }
                        from.Damage(rpd_damage, m);
                    }
                }
            }

            if (from is BaseCreature)
            {
                Mobile master = ((BaseCreature)from).ControlMaster;

                if (master != null)
                {
                    master.RevealingAction();
                }

                #region Talismans
                BaseTalisman talis = BaseTalisman.GetTalisman(m);

                if (talis != null && talis.ProtectionTalis != NPC_Name.None && talis.ProtectionValue > 0)
                {
                    if (ProtectionKillerEntry.IsProtectionKiller(talis.ProtectionTalis, from))
                    {
                        totalDamage = totalDamage - ((totalDamage * talis.ProtectionValue) / 100);
                    }
                }
                #endregion
            }

            if (from != null)
            {
                Item cloak     = from.FindItemOnLayer(Layer.Cloak);
                Item twohanded = from.FindItemOnLayer(Layer.TwoHanded);

                if (directDamage && cloak is BaseQuiver && twohanded is BaseRanged)
                {
                    BaseQuiver quiver = cloak as BaseQuiver;
                    totalDamage += (int)(totalDamage * quiver.DamageModifier * 0.01);
                }
            }

            if (m is PlayerMobile && from is PlayerMobile && directDamage)
            {
                totalDamage = Math.Min(totalDamage, 35);
            }

            /* TODO: El efecto del Attunement debería ir despues de aplicar el Blood Oath.
             * Según parece, en OSI los Necro-Arcanists lo usan mucho en PvP, de manera que
             * el daño recibido se refleja al atacante por Blood Oath, pero luego es
             * absorbido por el Attunement en el defensor.
             */
            if (directDamage)
            {
                Spells.Spellweaving.AttunementSpell.TryAbsorb(m, ref totalDamage);
            }

            if (from != null)
            {
                SpellHelper.DoLeech(totalDamage, from, m);
            }

            m.Damage(totalDamage, from);

            return(totalDamage);
        }
Ejemplo n.º 34
0
            protected override void OnTick()
            {
                bool usingPetals = OrangePetals.UnderEffect(m_Mobile);

                if (Core.SA && usingPetals && m_Poison.RealLevel >= 3 && 0.25 > Utility.RandomDouble())
                {
                    OrangePetals.RemoveContext(m_Mobile);
                    usingPetals = false;

                    m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x3F, 1053093); // * The strength of the poison overcomes your resistance! *
                }

                if ((Core.AOS && m_Poison.RealLevel < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.RealLevel <= 3 && usingPetals) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, 1053092);                   // * You feel yourself resisting the effects of the poison *

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, 1114442, m_Mobile.Name); // * ~1_NAME~ seems resistant to the poison *

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    if (m_Mobile is PlayerMobile)
                    {
                        BuffInfo.RemoveBuff((PlayerMobile)m_Mobile, BuffIcon.Poison);
                    }

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    if (m_From is BaseCreature && ((BaseCreature)m_From).RecentSetControl && ((BaseCreature)m_From).GetMaster() == m_Mobile)
                    {
                        m_From = null;
                    }
                    else
                    {
                        m_From.DoHarmful(m_Mobile, true);
                    }
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                #region Mondain's Legacy
                if (Core.ML)
                {
                    if (m_From != null && m_Mobile != m_From && !m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 10 && m_Poison.m_Level <= 13) // darkglow
                    {
                        m_From.SendLocalizedMessage(1072850);                                                                                              // Darkglow poison increases your damage!
                        damage = (int)Math.Floor(damage * 1.1);
                    }

                    if (m_From != null && m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 14 && m_Poison.m_Level <= 18) // parasitic
                    {
                        int toHeal = Math.Min(m_From.HitsMax - m_From.Hits, damage);

                        if (toHeal > 0)
                        {
                            m_From.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
                            m_From.Heal(toHeal, m_Mobile, false);
                        }
                    }
                }
                #endregion

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if (damage > 0)
                {
                    m_Mobile.RevealingAction();
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Ejemplo n.º 35
0
            protected override void OnTick()
            {
                if (Core.AOS && m_Poison.Level < 4 &&
                    TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell)) ||
                    m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         $"* {m_Mobile.Name} seems resistant to the poison *");

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                From?.DoHarmful(m_Mobile, true);

                if (m_Mobile is IHonorTarget honorTarget)
                {
                    honorTarget.ReceivedHonorContext?.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, From, damage, 0, 0, 0, 100, 0);

                if (0.60 <= Utility.RandomDouble()
                    ) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                {
                    m_Mobile.RevealingAction();
                }

                if (m_Index % m_Poison.m_MessageInterval == 0)
                {
                    m_Mobile.OnPoisoned(From, m_Poison, m_Poison);
                }
            }