Example #1
0
		public static void SetValue( Mobile m, AosAttribute att, int value, string title )
		{
			if ( !EnhancementList.ContainsKey( m ) )
				AddMobile( m, title );

			if ( att == AosAttribute.BonusStr )
			{
				m.RemoveStatMod( "MagicalEnhancementStr" );
				m.AddStatMod( new StatMod( StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero ) );
			}
			else if ( att == AosAttribute.BonusDex )
			{
				m.RemoveStatMod( "MagicalEnhancementDex" );
				m.AddStatMod( new StatMod( StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero ) );
			}
			else if ( att == AosAttribute.BonusInt )
			{
				m.RemoveStatMod( "MagicalEnhancementInt" );
				m.AddStatMod( new StatMod( StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero ) );
			}

			if ( title != EnhancementList[m].Title )
				EnhancementList[m].Attributes[att] = value;
			else
				EnhancementList[m].Attributes[att] += value;
		}
		private void SetMods( Mobile wearer )
		{
			wearer.AddSkillMod( m_SkillMod0 );
			wearer.AddSkillMod( m_SkillMod1 );
			wearer.AddSkillMod( m_SkillMod2 );
			wearer.AddStatMod( m_StatMod0 );
			wearer.AddStatMod( m_StatMod1 );
		}
Example #3
0
		public override bool Use( Mobile from ) {
			if ( from.BeginAction( typeof( ClarityPotion ) ) ) {
				int amount = Utility.Dice( 3, 3, 3 );
				int time = Utility.RandomMinMax( 5, 30 );

				from.PlaySound( 0x2D6 );

				if ( from.Body.IsHuman ) {
					from.Animate( 34, 5, 1, true, false, 0 );
				}

				from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head );
				from.PlaySound( 0x1EB );

				StatMod mod = from.GetStatMod( "Concussion" );

				if ( mod != null ) {
					from.RemoveStatMod( "Concussion" );
					from.Mana -= mod.Offset;
				}

				from.PlaySound( 0x1EE );
				from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) );

				Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() {
					from.EndAction( typeof( ClarityPotion ) );
				} );

				return true;
			}

			return false;
		}
Example #4
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( nextabil <= DateTime.Now )
			{
				from.AddStatMod( new StatMod( StatType.Str, "Godlike Strength", 25, TimeSpan.FromMinutes( 2.0 ) ) );
				nextabil = DateTime.Now + TimeSpan.FromMinutes( 5.0 );
			}
		}
Example #5
0
        public static bool AddStatBonus( Mobile caster, Mobile target, StatType type, int bonus, TimeSpan duration )
        {
            int offset = bonus;
            string name = String.Format( "[Magic] {0} Offset", type );

            StatMod mod = target.GetStatMod( name );

            if ( mod != null && mod.Offset < 0 )
            {
                target.AddStatMod( new StatMod( type, name, mod.Offset + offset, duration ) );
                return true;
            }
            else if ( mod == null || mod.Offset < offset )
            {
                target.AddStatMod( new StatMod( type, name, offset, duration ) );
                return true;
            }

            return false;
        }
Example #6
0
		public override bool Eat( Mobile from )
		{
			if ( FillHunger( from, FillFactor ) )
			{
				string modName = Serial.ToString();
				
				from.AddStatMod( new StatMod( StatType.Str, modName + "Str", (int) ( from.RawStr * 0.08 ), TimeSpan.FromSeconds( 75 ) ) );
				
				from.PlaySound( 0x1EA );
				from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
				
				Consume();		
				
				return true;
			}
			
			return false;
		}
Example #7
0
		public override bool Use( Mobile from ) {
			if ( from.GetStatMod( "blood-rose" ) == null ) {
				from.PlaySound( Utility.Random( 0x3A, 3 ) );

				if ( from.Body.IsHuman && !from.Mounted ) {
					from.Animate( 34, 5, 1, true, false, 0 );
				}

				int amount = Utility.Dice( 3, 3, 3 );
				int time = Utility.RandomMinMax( 5, 30 );

				from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );

				from.PlaySound( 0x1EE );
				from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );

				return true;
			} else {
				from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.

				return false;
			}
		}
Example #8
0
		public static void AddStatBonuses( Mobile to, Item item, int str, int dex, int intel )
		{			
			if ( (str != 0 || dex != 0 || intel != 0) )
			{		
				string modName = item.Serial.ToString();

				if ( str != 0 )
					to.AddStatMod( new StatMod( StatType.Str, modName + "SetStr", str, TimeSpan.Zero ) );

				if ( dex != 0 )
					to.AddStatMod( new StatMod( StatType.Dex, modName + "SetDex", dex, TimeSpan.Zero ) );

				if ( intel != 0 )
					to.AddStatMod( new StatMod( StatType.Int, modName + "SetInt", intel, TimeSpan.Zero ) );
			}
			
			to.CheckStatTimers();
		}
        public override void OnDoubleClick( Mobile from )
        {
            if ( !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
            }
            else if ( from.GetStatMod( "RoseOfTrinsicPetal" ) != null )
            {
                from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
            }
            else
            {
                from.PlaySound( 0x1EE );
                from.AddStatMod( new StatMod( StatType.Str, "RoseOfTrinsicPetal", 5, TimeSpan.FromMinutes( 5.0 ) ) );

                Consume();
            }
        }
Example #10
0
        public override void OnGaveMeleeAttack( Mobile defender )
        {
            base.OnGaveMeleeAttack( defender );

            if ( 0.1 > Utility.RandomDouble() )
            {
                defender.FixedParticles( 0x374A, 1, 17, 0x15B6, 0, 0, EffectLayer.Waist );
                defender.PlaySound( 0x233 );

                defender.Damage( 10, this );

                switch ( Utility.Random( 3 ) )
                {
                    case 0:
                        {
                            defender.SendLocalizedMessage( 1112391 ); // The creature's tail smashes into you!

                            break;
                        }
                    case 1:
                        {
                            defender.Freeze( TimeSpan.FromSeconds( 3.0 ) );

                            defender.SendLocalizedMessage( 1112554 ); // You're stunned as the creature's tail knocks the wind out of you.

                            break;
                        }
                    case 2:
                        {
                            defender.SendLocalizedMessage( 1112555 ); // You're left confused as the creature's tail catches you right in the face!
                            defender.PublicOverheadMessage( MessageType.Regular, 946, 502039 ); // *looks confused*

                            defender.AddStatMod( new StatMod( StatType.Dex, "Boura Dex Malus", -20, TimeSpan.FromSeconds( 5.0 ) ) );
                            defender.AddStatMod( new StatMod( StatType.Int, "Boura Int Malus", -20, TimeSpan.FromSeconds( 5.0 ) ) );

                            defender.FixedParticles( 0x37B9, 1, 10, 0x232A, 5, 0, EffectLayer.Head );
                            defender.PlaySound( 0xF9 );

                            break;
                        }
                }
            }
        }
        public bool DoPrayerEffect(PlayerMobile from, Mobile target)
        {
            if (target == null || target.Deleted || !target.Alive || target.IsDeadBondedPet)
                return false;
            if (from == null || from.Deleted)
                return false;

            if (!String.IsNullOrEmpty(m_Message))
                target.SendMessage(m_Message);
            target.SendSound(SoundID);
            int offset = m_Intensity + PowerBonus(from);
            switch (m_Effect)
            {
                case PrayerEffect.Strength:
                    {
                        #region Strength

                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Str, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.Str, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Str, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;
                        #endregion
                    }
                case PrayerEffect.Dexterity:
                    {
                        #region Dexterity
                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Dex, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.Dex, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Dex, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;
                        #endregion
                    }
                case PrayerEffect.Intelligence:
                    {
                        #region Intelligence

                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Int, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.Int, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.Int, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;

                        #endregion
                    }
                case PrayerEffect.RawHitPoints:
                    {
                        #region RawHits

                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.HitsMax, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.HitsMax, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.HitsMax, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;

                        #endregion
                    }
                case PrayerEffect.CurrentHitPoints:
                    {
                        target.Hits += offset;
                        return true;
                    }
                case PrayerEffect.RawStamina:
                    {
                        #region RawStam

                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.StamMax, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.StamMax, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.StamMax, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;

                        #endregion
                    }
                case PrayerEffect.CurrentStamina:
                    {
                        target.Stam += offset;
                        return true;
                    }
                case PrayerEffect.RawMana:
                    {
                        #region RawMana

                        string name = String.Format("[Prayer] {0} Offset", m_Effect);

                        StatMod mod = target.GetStatMod(name);

                        //one is negative and the other is positive, so adding up
                        if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.ManaMax, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //nothing to replace, just adding
                        else if (mod == null)
                        {
                            target.AddStatMod(new StatMod(StatType.ManaMax, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }
                        //replacing the current mod with a larger one
                        else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset)))
                        {
                            target.RemoveStatMod(name);
                            target.AddStatMod(new StatMod(StatType.ManaMax, name, offset, TimeSpan.FromSeconds(m_Duration)));
                            return true;
                        }

                        return false;

                        #endregion
                    }
                case PrayerEffect.CurrentMana:
                    {
                        target.Mana += offset;
                        return true;
                    }
                case PrayerEffect.BluntResistance:
                    {
                        ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Blunt, offset, m_Duration);
                        timer.Start();
                        return true;
                    }
                case PrayerEffect.PiercingResistance:
                    {
                        ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Piercing, offset, m_Duration);
                        timer.Start();
                        return true;
                    }
                case PrayerEffect.SlashingResistance:
                    {
                        ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Slashing, offset, m_Duration);
                        timer.Start();
                        return true;
                    }
                case PrayerEffect.ColdResistance:
                    {
                        ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Cold, offset, m_Duration);
                        timer.Start();
                        return true;
                    }
                case PrayerEffect.FireResistance:
                    {
                        ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Fire, offset, m_Duration);
                        timer.Start();
                        return true;
                    }
                case PrayerEffect.PoisonResistance:
                    {
                        ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Poison, offset, m_Duration);
                        timer.Start();
                        return true;
                    }
                case PrayerEffect.EnergyResistance:
                    {
                        ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Energy, offset, m_Duration);
                        timer.Start();
                        return true;
                    }
                case PrayerEffect.AttackChance:
                    {
                        XmlAosAttribute att = new XmlAosAttribute(AosAttribute.AttackChance, offset, m_Duration);
                        att.Name = String.Format("[Prayer] {0} Offset", m_Effect);
                        XmlAttach.AttachTo(target, att);
                        return true;
                    }
                case PrayerEffect.DefendChance:
                    {
                        XmlAosAttribute att = new XmlAosAttribute(AosAttribute.DefendChance, offset, m_Duration);
                        att.Name = String.Format("[Prayer] {0} Offset", m_Effect);
                        XmlAttach.AttachTo(target, att);
                        return true;
                    }
                default: return false;
            }
        }
Example #12
0
        protected override void OnTargetAdded( Mobile m )
        {
            BuffInfo.AddBuff( m, this.BuffInfo );

            foreach ( AttributeMod mod in m_Mods )
            {
                m.AddAttributeMod( mod );
            }

            foreach ( StatMod mod in m_StatMods )
            {
                m.AddStatMod( mod );
            }
        }
        public void StompAttack( Mobile target )
        {
            if ( target.GetStatMod( "StompAttack" ) == null )
            {
                StatType type;

                switch( Utility.Random(3) )
                {
                    default:
                    case 0: type = StatType.Str; break;
                    case 1: type = StatType.Dex; break;
                    case 2: type = StatType.Int; break;
                }

                target.AddStatMod( new StatMod( type, "StompAttack", -( 10 + Utility.Random( 10 ) ), TimeSpan.FromSeconds( 60 + Utility.Random( 60 ) ) ) );
            }
        }
Example #14
0
		public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
		{
			base.OnHit( attacker, defender, damageBonus );

			if ((attacker.Player || attacker.Body.IsHuman) && !attacker.IsT2A && Layer == Layer.TwoHanded
                && (attacker.Skills[SkillName.Anatomy].Value / 100.0 * SpecialMovesController._ConcussionPoleArmMaxChance) >= Utility.RandomDouble()
                && Engines.ConPVP.DuelContext.AllowSpecialAbility( attacker, "Concussion Blow", false ) )
			{
				StatMod mod = defender.GetStatMod( "Concussion" );

				if ( mod == null )
				{
					defender.SendLocalizedMessage( 1060165 ); // You have delivered a concussion!
					defender.AddStatMod( new StatMod( StatType.Int, "Concussion", -(defender.RawInt / 2), TimeSpan.FromSeconds( SpecialMovesController._ConcussionDurationSeconds ) ) );

					attacker.SendLocalizedMessage( 1060165 ); // You have delivered a concussion!
					attacker.PlaySound( 0x11C );
				}
			}
		}
Example #15
0
        public override void OnGaveMeleeAttack( Mobile defender )
        {
            base.OnGaveMeleeAttack( defender );

            if ( Utility.RandomBool() )
            {
                if ( Rotworm.IsDiseased( defender ) )
                {
                    // * The bloodworm is repulsed by your diseased blood. *
                    defender.SendLocalizedMessage( 1111668, "", 0x25 );
                }
                else
                {
                    // *The bloodworm drains some of your blood to replenish its health.*
                    defender.SendLocalizedMessage( 1111698, "", 0x25 );

                    Hits += ( defender.HitsMax - defender.Hits );
                }
            }

            if ( 0.1 > Utility.RandomDouble() && !IsAnemic( defender ) && !FontOfFortune.HasBlessing( defender, FontOfFortune.BlessingType.Protection ) )
            {
                defender.SendLocalizedMessage( 1111669 ); // The bloodworm's attack weakens you. You have become anemic.

                defender.AddStatMod( new StatMod( StatType.Str, "[Bloodworm] Str Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) );
                defender.AddStatMod( new StatMod( StatType.Dex, "[Bloodworm] Dex Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) );
                defender.AddStatMod( new StatMod( StatType.Int, "[Bloodworm] Int Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) );

                Effects.SendPacket( defender, defender.Map, new GraphicalEffect( EffectType.FixedFrom, defender.Serial, Serial.Zero, 0x375A, defender.Location, defender.Location, 9, 20, true, false ) );
                Effects.SendTargetParticles( defender, 0x373A, 1, 15, 0x26B9, EffectLayer.Head );
                Effects.SendLocationParticles( defender, 0x11A6, 9, 32, 0x253A );

                defender.PlaySound( 0x1ED );

                Timer.DelayCall( TimeSpan.FromSeconds( 15.0 ), new TimerCallback(
                    delegate
                    {
                        // You recover from your anemia.
                        defender.SendLocalizedMessage( 1111670 );

                        defender.RemoveStatMod( "[Bloodworm] Str Malus" );
                        defender.RemoveStatMod( "[Bloodworm] Dex Malus" );
                        defender.RemoveStatMod( "[Bloodworm] Int Malus" );
                    }
                ) );
            }
        }
Example #16
0
		public void AddStatBonuses( Mobile to )
		{
			int strBonus = BonusStr;
			int dexBonus = BonusDex;
			int intBonus = BonusInt;

			if ( strBonus != 0 || dexBonus != 0 || intBonus != 0 )
			{
				string modName = Owner.Serial.ToString();

				if ( strBonus != 0 )
					to.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

				if ( dexBonus != 0 )
					to.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

				if ( intBonus != 0 )
					to.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
			}

			to.CheckStatTimers();
		}
Example #17
0
        public static void LowerStat(Mobile target, int minloss, int maxloss, int mintime, int maxtime, int type)
        {
            if (target.GetStatMod("LowerStats") != null)
                return;

            var stattype = StatType.Str;
            var offset = Utility.Random(minloss, maxloss);

            if (type <= 0 || type >= 4)
                type = Utility.RandomMinMax(1, 3);

            switch (type)
            {
                case 1:
                    stattype = StatType.Str;
                    break;
                case 2:
                    stattype = StatType.Dex;
                    break;
                case 3:
                    stattype = StatType.Int;
                    break;
            }

            target.AddStatMod(new StatMod(stattype, "LowerStats", -offset,
                TimeSpan.FromSeconds(Utility.Random(mintime, maxtime))));
        }
Example #18
0
		public static void ApplySkillLoss( Mobile mob )
		{
			PlayerMobile Killer = mob as PlayerMobile;
			if ( mob.ShortTermMurders >= 5 && Killer.MurderBounty <= 0)
			{
				double loss = (100.0 - (19.0 + (mob.ShortTermMurders / 5.0))) / 100.0; // 20 to 30% loss

				if( loss < 0.75 )
					loss = 0.60;// changed to .80 from .95
				else if( loss > 0.95 )
					loss = 0.60; // changed to .80 from /95

				TimeSpan lossperiod = TimeSpan.FromMinutes( 240.0 );

				loss = 1.0 - loss;

				ClearSkillLoss( mob );

				SkillLossContext context = new SkillLossContext();
				m_SkillLoss[mob] = context;

				List<SkillMod> mods = context.m_SkillMods = new List<SkillMod>();

				for ( int i = 0; i < mob.Skills.Length; ++i )
				{
					Skill sk = mob.Skills[i];
					double baseValue = sk.Base;

					if ( baseValue > 0 )
					{
						SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * loss) );

						mods.Add( mod );
						mob.AddSkillMod( mod );
					}
				}

				mob.AddStatMod( new StatMod( StatType.Str, "Murder Penalty Str", -(int)(mob.RawStr * loss), lossperiod ) );
				mob.AddStatMod( new StatMod( StatType.Dex, "Murder Penalty Dex", -(int)(mob.RawDex * loss), lossperiod ) );
				mob.AddStatMod( new StatMod( StatType.Int, "Murder Penalty Int", -(int)(mob.RawInt * loss), lossperiod ) );

				context.m_Timer = Timer.DelayCall<Mobile>( lossperiod, new TimerStateCallback<Mobile>( ClearSkillLoss_Callback ), mob );
			}
			else  ///Removed short term statloss. 
			if ( mob.ShortTermMurders < 5 && Killer.MurderBounty > 0 )
			{
				double loss = (100.0 - (19.0 + (Killer.MurderBounty / 10000.0))) / 100.0; // 20 to 30% loss
				if( loss < 0.75 )
					loss = 0.60;// changed to .80 from .95
				else if( loss > 0.95 )
					loss = 0.60; // changed to .80 from /95
				mob.SendMessage( "Current MurderBounty: " + Killer.MurderBounty);
				double timeloss = (double)Killer.MurderBounty/33.3;
				TimeSpan lossperiod = TimeSpan.FromMinutes( timeloss );
				
				int m = (int)Math.Round( timeloss );
				mob.SendMessage( "You have entered a bounty statloss for: " + m + " minutes.");

				loss = 1.0 - loss;

				ClearSkillLoss( mob );

				SkillLossContext context = new SkillLossContext();
				m_SkillLoss[mob] = context;

				List<SkillMod> mods = context.m_SkillMods = new List<SkillMod>();

				for ( int i = 0; i < mob.Skills.Length; ++i )
				{
					Skill sk = mob.Skills[i];
					double baseValue = sk.Base;

					if ( baseValue > 0 )
					{
						SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * loss) );

						mods.Add( mod );
						mob.AddSkillMod( mod );
					}
				}

				mob.AddStatMod( new StatMod( StatType.Str, "Murder Penalty Str", -(int)(mob.RawStr * loss), lossperiod ) );
				mob.AddStatMod( new StatMod( StatType.Dex, "Murder Penalty Dex", -(int)(mob.RawDex * loss), lossperiod ) );
				mob.AddStatMod( new StatMod( StatType.Int, "Murder Penalty Int", -(int)(mob.RawInt * loss), lossperiod ) );

				context.m_Timer = Timer.DelayCall<Mobile>( lossperiod, new TimerStateCallback<Mobile>( ClearSkillLoss_Callback ), mob );
			}
			else if ( mob.ShortTermMurders >= 5 && Killer.MurderBounty > 0 )
			{
				double loss = (100.0 - (19.0 + (mob.ShortTermMurders / 5.0))) / 100.0; // 20 to 30% loss
				if( loss < 0.75 )
					loss = 0.60;// changed to .80 from .95
				else if( loss > 0.95 )
					loss = 0.60; // changed to .80 from /95
				mob.SendMessage( "Current MurderBounty: " + Killer.MurderBounty);
				double timeloss = (double)Killer.MurderBounty/33.3;
				TimeSpan lossperiod = TimeSpan.FromMinutes( timeloss + 240.0);
				
				Killer.MurderBounty = 0;
				
				int m = (int)Math.Round( timeloss + 240.0);
				mob.SendMessage( "You have entered statloss for: " + m + " minutes.");

				loss = 1.0 - loss;

				ClearSkillLoss( mob );

				SkillLossContext context = new SkillLossContext();
				m_SkillLoss[mob] = context;

				List<SkillMod> mods = context.m_SkillMods = new List<SkillMod>();

				for ( int i = 0; i < mob.Skills.Length; ++i )
				{
					Skill sk = mob.Skills[i];
					double baseValue = sk.Base;

					if ( baseValue > 0 )
					{
						SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * loss) );

						mods.Add( mod );
						mob.AddSkillMod( mod );
					}
				}

				mob.AddStatMod( new StatMod( StatType.Str, "Murder Penalty Str", -(int)(mob.RawStr * loss), lossperiod ) );
				mob.AddStatMod( new StatMod( StatType.Dex, "Murder Penalty Dex", -(int)(mob.RawDex * loss), lossperiod ) );
				mob.AddStatMod( new StatMod( StatType.Int, "Murder Penalty Int", -(int)(mob.RawInt * loss), lossperiod ) );

				context.m_Timer = Timer.DelayCall<Mobile>( lossperiod, new TimerStateCallback<Mobile>( ClearSkillLoss_Callback ), mob );
			}
		}
Example #19
0
        protected override void OnTargetAdded( Mobile m )
        {
            base.OnTargetAdded( m );

            foreach ( StatMod mod in m_StatMods )
                m.AddStatMod( mod );
        }
Example #20
0
		public bool AddStatBonus(Mobile target, int offset, StatType type, TimeSpan duration)
		{
			if (target == null)
				return false;

			string name = String.Format("[Magic] {0} Offset:item-{1}", type, this.Serial);
			string itemtypename = String.Format("[Magic] {0} Offset:item-", type);

			StatMod mod = target.GetStatMod( name );

			for (int i = 0; i < target.StatMods.Count; i++)
			{
				StatMod sm = target.StatMods[i] as StatMod;
				if (sm != null)
				{
					if (sm.Name.IndexOf(itemtypename) == 0)
					{
						//found this item statmod type already - don't apply
						return false;
					}
				}
			}

			// If they have a negative effect on them, replace the effect with
			// the negative effect plus the new positive effect
			if ( mod != null && mod.Offset < 0 )
			{
				target.AddStatMod( new StatMod( type, name, mod.Offset + offset, duration ) );
				return true;
			}
			// If they have no effect or the current effect is weaker than the new effect
			// Apply the new effect
			else if ( mod == null || mod.Offset < offset )
			{
				target.AddStatMod( new StatMod( type, name, offset, duration ) );
				return true;
			}
			// They already have an effect equal to or greater than the new effect
			// do nothing.
			return false;
		}
Example #21
0
		public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
		{
			base.OnHit( attacker, defender, damageBonus );

			if (!Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && attacker.Skills[SkillName.Anatomy].Value >= 80 && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() && Engines.ConPVP.DuelContext.AllowSpecialAbility(attacker, "Concussion Blow", false))
			{
				StatMod mod = defender.GetStatMod( "Concussion" );

				if ( mod == null )
				{
					defender.SendMessage( "You receive a concussion blow!" );
					defender.AddStatMod( new StatMod( StatType.Int, "Concussion", -(defender.RawInt / 2), TimeSpan.FromSeconds( 30.0 ) ) );

					attacker.SendMessage( "You deliver a concussion blow!" );
					attacker.PlaySound( 0x11C );
				}
			}
		}
Example #22
0
		public bool OnTarget( Mobile from, Item coin )
		{
			DefragTables();
			
			if(IsCoolingDown(from))
			{
                from.SendLocalizedMessage(1113368); // You already made a wish today. Try again tomorrow!
				return false;
			}
			
			if(.20 >= Utility.RandomDouble())
			{
				Item item = null;
				switch(Utility.Random(4))
				{
					case 0: item = new SolesOfProvidence(); break;
					case 1: item = new GemologistsSatchel(); break;
					case 2: item = new RelicFragment(5); break;
					case 3: item = new EnchantEssence(5); break;
				}
				
				if(from.Backpack == null || !from.Backpack.TryDropItem(from, item, false))
					item.MoveToWorld(from.Location, from.Map);
			}
			else
			{
				switch(Utility.Random(4))
				{
					case 0:
						from.AddStatMod(new StatMod(StatType.Str, "FoF_Str", 10, TimeSpan.FromMinutes(60)));
                        from.SendLocalizedMessage(1113373); // You suddenly feel stronger!
						break;
					case 1:
                        from.AddStatMod(new StatMod(StatType.Dex, "FoF_Dex", 10, TimeSpan.FromMinutes(60)));
                        from.SendLocalizedMessage(1113374); // You suddenly feel more agile!
						break;
					case 2:
                        from.AddStatMod(new StatMod(StatType.Int, "FoF_Int", 10, TimeSpan.FromMinutes(60)));
						from.SendLocalizedMessage(1113371); // You suddenly feel wiser!
						break;
					case 3:
                        m_LuckTable[from] = DateTime.UtcNow + TimeSpan.FromMinutes(60);
                        from.SendLocalizedMessage(1079551); // Your luck just improved!
						break;
				}

                from.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
			}

            from.PlaySound(0x22);

			m_RewardCooldown[from] = DateTime.UtcNow + TimeSpan.FromHours(24);

            if (coin.Amount <= 1)
                coin.Delete();
            else
			    coin.Amount--;

			return false;
		}
Example #23
0
            public override void Apply( Mobile m )
            {
                if ( m_HasBalm( m ) )
                {
                    BalmOrLotion.IncreaseDuration( m );
                    m.SendLocalizedMessage( 1113372 ); // The duration of your balm has been increased by an hour!
                }
                else
                {
                    base.Apply( m );

                    m.AddStatMod( new StatMod( m_Stat, "[FontOfFortune] Stat Offset", StatBoost, BlessingDuration ) );
                }
            }
Example #24
0
        public static void CalculatePenalty( Mobile m )
        {
            if( m is PlayerMobile && ( (PlayerMobile)m ).IsVampire )
                return;

            double percentagePenalty;
            int strOffset, dexOffset;
            if ( m.Thirst < 5 )
            {
                percentagePenalty = ((5-m.Thirst)*2)*0.01;
                strOffset = (int)(m.RawStr*percentagePenalty);
                dexOffset = (int)(m.RawDex*percentagePenalty);
                m.AddStatMod( new StatMod( StatType.Str, "[Dehydration] STR", -strOffset, TimeSpan.Zero ) );
                m.AddStatMod( new StatMod( StatType.Dex, "[Dehydration] DEX", -dexOffset, TimeSpan.Zero ) );
            }
            else
            {
                m.RemoveStatMod( "[Dehydration] STR" );
                m.RemoveStatMod( "[Dehydration] DEX" );
            }

            if ( m.Hunger < 5 )
            {
                percentagePenalty = ((5-m.Hunger)*2)*0.01;
                strOffset = (int)(m.RawStr*percentagePenalty);
                dexOffset = (int)(m.RawDex*percentagePenalty);
                m.AddStatMod( new StatMod( StatType.Str, "[Starvation] STR", -strOffset, TimeSpan.Zero ) );
                m.AddStatMod( new StatMod( StatType.Dex, "[Starvation] DEX", -dexOffset, TimeSpan.Zero ) );
            }
            else
            {
                m.RemoveStatMod( "[Starvation] STR" );
                m.RemoveStatMod( "[Starvation] DEX" );
            }
        }
		public override void OnHit( Mobile attacker, Mobile defender )
		{
			base.OnHit( attacker, defender );

			if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() )
			{
				StatMod mod = defender.GetStatMod( "Concussion" );

				if ( mod == null )
				{
					defender.SendMessage( "You receive a concussion blow!" );
					defender.AddStatMod( new StatMod( StatType.Int, "Concussion", -(defender.RawInt / 2), TimeSpan.FromSeconds( 30.0 ) ) );

					attacker.SendMessage( "You deliver a concussion blow!" );
					attacker.PlaySound( 0x308 );
				}
			}
		}
Example #26
0
		protected override bool OnActivate(Mobile m, Tuple<EquipmentSetPart, Item>[] equipped)
		{
			if (m == null || m.Deleted || equipped == null)
			{
				return false;
			}

			if (EquipmentSets.CMOptions.ModuleDebug)
			{
				EquipmentSets.CMOptions.ToConsole(
					"OnActivate: '{0}', '{1}', '{2}', '{3}', '{4}'",
					m,
					UID,
					_Stat,
					_Offset,
					_Duration.ToSimpleString());
			}

			m.AddStatMod(new StatMod(_Stat, UID, _Offset, _Duration));
			return true;
		}
Example #27
0
        public static void EnergyDrain(Mobile from, Mobile target, int amount, int duration, bool skills)
        {
            if (amount < 0)
                amount = 1;

            target.AddStatMod(new StatMod(StatType.Str, "Energy Drain Str: " + EnergyDrainCount, -amount,
                TimeSpan.FromMinutes(5)));
            target.AddStatMod(new StatMod(StatType.Dex, "Energy Drain Dex: " + EnergyDrainCount, -amount,
                TimeSpan.FromMinutes(5)));
            target.AddStatMod(new StatMod(StatType.Int, "Energy Drain Int: " + EnergyDrainCount, -amount,
                TimeSpan.FromMinutes(5)));

            if (skills)
                for (var i = 0; i < target.Skills.Length; ++i)
                    target.AddSkillMod(new TimedSkillMod((SkillName) i, true, -amount, TimeSpan.FromMinutes(duration)));

            if (from != null)
                from.Hits += 5*amount;

            EnergyDrainCount++;

            if (EnergyDrainCount > 65535)
                EnergyDrainCount = 0;
        }
Example #28
0
		public override void OnTrigger(object activator, Mobile m)
		{
			if(m == null || Word == null || (RequireIdentification && !m_Identified)) return;

			if(DateTime.Now < m_EndTime) return;

			string msgstr = "Activating the power of " + Word;

			// assign powers to certain words
			switch ( Word )
			{
				case "Shoda":
					m.AddStatMod( new StatMod( StatType.Int, "Shoda", 20, Duration ) );
					m.SendMessage("Your mind expands!");
					break;
				case "Malik":
					m.AddStatMod( new StatMod( StatType.Str, "Malik", 20, Duration ) );
					m.SendMessage("Your strength surges!");
					break;
				case "Lepto":
					m.AddStatMod( new StatMod( StatType.Dex, "Lepto", 20, Duration ) );
					m.SendMessage("You are more nimble!");
					break;
				case "Velas":
					Timer.DelayCall( TimeSpan.Zero, new TimerStateCallback( Hide_Callback ), new object[]{ m } );
					m.SendMessage("You disappear!");
					break;
				case "Tarda":
					m.AddSkillMod( new TimedSkillMod( SkillName.Tactics, true, 20, Duration ) );
					m.SendMessage("You are more skillful warrior!");
					break;
				case "Marda":
					m.AddSkillMod( new TimedSkillMod( SkillName.Magery, true, 20, Duration ) );
					m.SendMessage("You are more skillful mage!");
					break;
				case "Vas Malik":
					m.AddStatMod( new StatMod( StatType.Str, "Vas Malik", 40, Duration ) );
					m.SendMessage("You are exceptionally strong!");
					break;
				case "Nartor":
					BaseCreature b = new Drake();
					b.MoveToWorld(m.Location, m.Map);
					b.Owners.Add( m );
					b.SetControlMaster( m );
					if(b.Controlled)
						m.SendMessage("You master the beast!");
					break;
				case "Santor":
					b = new Horse();
					b.MoveToWorld(m.Location, m.Map);
					b.Owners.Add( m );
					b.SetControlMaster( m );
					if(b.Controlled)
						m.SendMessage("You master the beast!");
					break;
				default:
					m.SendMessage("There is no effect.");
					break;
			}
            
			// display activation effects
			Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
			Effects.PlaySound( m, m.Map, 0x201 );

			// display a message over the item it was attached to
			if(AttachedTo is Item )
			{
				((Item)AttachedTo).PublicOverheadMessage( MessageType.Regular, 0x3B2, true, msgstr );
			}
            
			Charges--;

			// remove the attachment after the charges run out
			if(Charges == 0)
			{
				Delete();
			} 
			else
			{
				m_EndTime = DateTime.Now + Refractory;
			}
		}
Example #29
0
		public virtual void AddStatBonuses( Mobile parent )
		{
			if ( parent == null )
				return;

			int strBonus = ComputeStatBonus( StatType.Str );
			int dexBonus = ComputeStatBonus( StatType.Dex );
			int intBonus = ComputeStatBonus( StatType.Int );

			if ( strBonus == 0 && dexBonus == 0 && intBonus == 0 )
				return;

			string modName = this.Serial.ToString();

			if ( strBonus != 0 )
				parent.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

			if ( dexBonus != 0 )
				parent.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

			if ( intBonus != 0 )
				parent.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
		}
Example #30
0
		public override void Damage( Mobile m )
		{
			base.Damage( m );
			
			if ( m.NetState != null )
			{
				m.FixedEffect( 0x374A, 1, 17 );
				m.PlaySound( 0x1E1 );
				m.LocalOverheadMessage( MessageType.Regular, 0x21, 1074165 ); // You feel dizzy from a lack of clear air
				
				int mod = (int) ( m.Str * 0.1 );
				
				if ( mod > 10 )
					mod = 10;
					
				m.AddStatMod( new StatMod( StatType.Str, "Poisoned Tree Str", mod * -1, TimeSpan.FromSeconds( 1 ) ) );
				
				mod = (int) ( m.Int * 0.1 );
				
				if ( mod > 10 )
					mod = 10;
					
				m.AddStatMod( new StatMod( StatType.Int, "Poisoned Tree Int", mod * -1, TimeSpan.FromSeconds( 1 ) ) );
			}
		}