private static TimeSpan AutoRenewDelay = TimeSpan.FromDays( 15 ); // How many Earth Days are equivalent to One Year for characters?

        #endregion Fields

        #region Methods

        public static void ApplyAgeStatMod( Mobile from )
        {
            try
            {
                double age = double.Parse( ((Account)from.Account).GetTag( "Age of " + (from.RawName) ) );

                double strBonus, dexBonus, intBonus;

                if ( age < topStrAge )
                    strBonus = age / topStrAge * maxBonus;
                else
                    strBonus = (topStrAge / age * maxBonus) + (topStrAge / age * maxBonus - maxBonus);

                if ( age < topDexAge )
                    dexBonus = age / topDexAge * maxBonus;
                else
                    dexBonus = (topDexAge / age * maxBonus) + (topDexAge / age * maxBonus - maxBonus);

                if ( age < topIntAge )
                    intBonus = age / topIntAge * maxBonus ;
                else
                    intBonus = (topIntAge / age * maxBonus) + (topIntAge / age * maxBonus - maxBonus);

                from.AddStatMod( new StatMod( StatType.Str, "AgeModStr", (int)strBonus, TimeSpan.Zero ) );
                from.AddStatMod( new StatMod( StatType.Dex, "AgeModDex", (int)dexBonus, TimeSpan.Zero ) );
                from.AddStatMod( new StatMod( StatType.Int, "AgeModInt", (int)intBonus, TimeSpan.Zero ) );
            }
            catch
            {
                from.SendMessage( 33, "Your age is not defined as a number! Report it to a staff member urgently!" );
            }
        }
Example #2
0
        public static void ApplyBonus( Mobile m )
        {
            m.SendLocalizedMessage( 1072391 ); // The magic of your armor combines to assist you!

            Effects.PlaySound( m.Location, m.Map, 503 );
            m.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );

            List<object> mods = new List<object>();

            mods.Add( new AttributeMod( MagicalAttribute.BonusInt, 6 ) );
            mods.Add( new AttributeMod( MagicalAttribute.RegenMana, 2 ) );
            mods.Add( new AttributeMod( MagicalAttribute.DefendChance, 10 ) );
            mods.Add( new AttributeMod( MagicalAttribute.LowerManaCost, 5 ) );
            mods.Add( new AttributeMod( MagicalAttribute.LowerRegCost, 40 ) );
            mods.Add( new ResistanceMod( ResistanceType.Physical, 28 ) );
            mods.Add( new ResistanceMod( ResistanceType.Fire, 28 ) );
            mods.Add( new ResistanceMod( ResistanceType.Cold, 28 ) );
            mods.Add( new ResistanceMod( ResistanceType.Poison, 28 ) );
            mods.Add( new ResistanceMod( ResistanceType.Energy, 28 ) );

            ApplyMods( m, mods );

            m_Bonus[m] = mods;

            m.AddStatMod( new StatMod( StatType.Int, "SorcerersSetInt", 6, TimeSpan.Zero ) );

            m.FindItemOnLayer( Layer.InnerTorso ).InvalidateProperties();
            m.FindItemOnLayer( Layer.Pants ).InvalidateProperties();
            m.FindItemOnLayer( Layer.Arms ).InvalidateProperties();
            m.FindItemOnLayer( Layer.Gloves ).InvalidateProperties();
            m.FindItemOnLayer( Layer.Helm ).InvalidateProperties();
            m.FindItemOnLayer( Layer.Neck ).InvalidateProperties();
        }
Example #3
0
        public static void ApplyBonus( Mobile m )
        {
            ApplyBonus( m.FindItemOnLayer( Layer.Neck ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Helm ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Pants ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Arms ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Gloves ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.InnerTorso ) as BaseArmor );

            List<AttributeMod> mods = new List<AttributeMod>();

            mods.Add( new AttributeMod( MagicalAttribute.ReflectPhysical, 25 ) );
            mods.Add( new AttributeMod( MagicalAttribute.Luck, 100 ) );

            ApplyMods( m, mods );

            m_Bonus[m] = mods;

            m.AddStatMod( new StatMod( StatType.Str, "DarkwoodSetStr", 10, TimeSpan.Zero ) );

            m.SendLocalizedMessage( 1072391 ); // The magic of your armor combines to assist you!

            Effects.PlaySound( m.Location, m.Map, 503 );
            m.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
        }
		private void SetMods( Mobile wearer )
		{			
			wearer.AddSkillMod( m_SkillMod0 ); 
			wearer.AddSkillMod( m_SkillMod1 ); 
			wearer.AddSkillMod( m_SkillMod2 ); 
			wearer.AddStatMod( m_StatMod0 ); 
		}
        public override bool OnEquip( Mobile m ) 
		{ 
			string modName = this.Serial.ToString();
			m.AddStatMod( new StatMod( StatType.Int, modName + "Int", (int)(.5 * m.ManaMax ), TimeSpan.Zero ) );
			m.SendMessage( "You feel smarter now!" );
			return base.OnEquip( m );
		}
        public override void OnDoubleClick(Mobile from)
        {

            if (Parent != from)
            {
                from.SendMessage("The Sword must be eqquiped to use.");
            }
            else if (from.Title != "Merlin's Apprentance")
            {
                from.Title = "Merlin's Apprentance";

                from.BoltEffect(0);
                from.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);

                m_StatMod0 = new StatMod(StatType.Str, "MOD0", 10, TimeSpan.Zero);
                m_StatMod1 = new StatMod(StatType.Int, "MOD1", 10, TimeSpan.Zero);

                from.AddStatMod(m_StatMod0);
                from.AddStatMod(m_StatMod1);

                this.WeaponAttributes.HitLeechHits = 65;
                this.WeaponAttributes.HitLeechMana = 45;
                this.Attributes.WeaponSpeed = 30;
            }
            else
            {
                from.BoltEffect(0);
                from.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);

                from.Title = null;

                from.RemoveStatMod("MOD0");
                from.RemoveStatMod("MOD1");

                this.WeaponAttributes.HitLeechHits = 25;
                this.WeaponAttributes.HitLeechMana = 25;
                this.Attributes.WeaponSpeed = 15;
            }
        }
Example #7
0
        }// fruit bowl
        public override bool Eat(Mobile from)
        {
            if (FillHunger(from, this.FillFactor))
            {
                string modName = this.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);
				
                this.Consume();		
				
                return true;
            }
			
            return false;
        }
Example #8
0
        public static void ApplyBonus( Mobile m )
        {
            ApplyBonus( m.FindItemOnLayer( Layer.Gloves ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Pants ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Arms ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.InnerTorso ) as BaseArmor );

            // +10 dex (total)
            m.AddStatMod( new StatMod( StatType.Dex, "AssassinSetDex", 12, TimeSpan.Zero ) );

            // +30 stealth (total)
            SkillMod skillmod = new DefaultSkillMod( SkillName.Stealth, true, 30.0 );
            skillmod.ObeyCap = true;
            m_Table.Add( m, skillmod );
            m.AddSkillMod( skillmod );

            m.SendLocalizedMessage( 1072391 ); // The magic of your armor combines to assist you!

            Effects.PlaySound( m.Location, m.Map, 503 );
            m.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
        }
Example #9
0
        public static void ApplyBonus( Mobile m )
        {
            ApplyBonus( m.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon );
            ApplyBonus( m.FindItemOnLayer( Layer.TwoHanded ) as BaseShield );

            List<AttributeMod> mods = new List<AttributeMod>();

            mods.Add( new AttributeMod( MagicalAttribute.WeaponSpeed, 35 ) );
            mods.Add( new AttributeMod( MagicalAttribute.DefendChance, 10 ) );

            ApplyMods( m, mods );

            m_Bonus[m] = mods;

            // +10 str (total)
            m.AddStatMod( new StatMod( StatType.Str, "JuggernautSetStr", 10, TimeSpan.Zero ) );

            m.SendLocalizedMessage( 1072391 ); // The magic of your armor combines to assist you!

            Effects.PlaySound( m.Location, m.Map, 503 );
            m.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
        }
Example #10
0
        public static void ApplyBonus( Mobile m )
        {
            ApplyBonus( m.FindItemOnLayer( Layer.Cloak ) as Feathernock );
            ApplyBonus( m.FindItemOnLayer( Layer.TwoHanded ) as Swiftflight );

            List<AttributeMod> mods = new List<AttributeMod>();

            mods.Add( new AttributeMod( MagicalAttribute.WeaponSpeed, 30 ) );
            mods.Add( new AttributeMod( MagicalAttribute.AttackChance, 15 ) );

            ApplyMods( m, mods );

            m_Bonus[m] = mods;

            // +8 dex (total)
            m.AddStatMod( new StatMod( StatType.Dex, "MarksmanSetStr", 8, TimeSpan.Zero ) );

            m.SendLocalizedMessage( 1072391 ); // The magic of your armor combines to assist you!

            Effects.PlaySound( m.Location, m.Map, 503 );
            m.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
        }
Example #11
0
        public static void ApplyBonus( Mobile m )
        {
            ApplyBonus( m.FindItemOnLayer( Layer.Gloves ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Pants ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Arms ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.InnerTorso ) as BaseArmor );

            List<AttributeMod> mods = new List<AttributeMod>();

            mods.Add( new AttributeMod( MagicalAttribute.SpellDamage, 15 ) );

            ApplyMods( m, mods );

            m_Bonus[m] = mods;

            // +10 int (total)
            m.AddStatMod( new StatMod( StatType.Int, "LeafweaveSetInt", 10, TimeSpan.Zero ) );

            m.SendLocalizedMessage( 1072391 ); // The magic of your armor combines to assist you!

            Effects.PlaySound( m.Location, m.Map, 503 );
            m.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
        }
Example #12
0
		public override void OnTarget( Mobile target )
		{
			if ( CheckHSequence( target ) )
			{
				if ( target.GetStatMod( "MindBlast" ) == null )
				{
					int offset = (int)(target.Skills[SkillName.Magery].Value / 2);
					offset += (int)(target.Skills[SkillName.Necromancy].Value / 2);
					offset += (int)(target.Skills[SkillName.EvalInt].Value / 4);
					offset += (int)(target.Skills[SkillName.SpiritSpeak].Value / 4);

					if ( target is PlayerMobile )
						offset /= 2;

					offset -= ((int)ScaleBySkill( target, SkillName.MagicResist )) -5;

					if ( offset < 15 )
						offset = 15;

					int duration = (int)(Caster.Skills[CastSkill].Value * 2);

					target.AddStatMod( new StatMod( StatType.Int, "MindBlast", -offset, TimeSpan.FromSeconds( duration ) ) );
					target.AddSkillMod( new TimedSkillMod( SkillName.Meditation, true, -offset, TimeSpan.FromSeconds( duration ) ) );
					target.AddSkillMod( new TimedSkillMod( SkillName.Focus, true, -offset, TimeSpan.FromSeconds( duration ) ) );

					target.SendMessage("Your mind has been blown!");

					SpellHelper.Damage( this, target, offset * 2, 0, 0, 100, 0, 0 );
				}

				target.FixedParticles( 0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head );
				target.PlaySound( 0x213 );
				BlueMageControl.CheckKnown( target, this, CanTeach( target ) );
			}

			FinishSequence();
		}
Example #13
0
 public override void AddBuff(Mobile m, TimeSpan duration)
 {
     m.AddStatMod(new StatMod(StatType.Str, "[BalmOrLotion] Str Offset", 10, duration));
 }
Example #14
0
        public override void OnCast()
        {
            Mobile caster = this.Caster;

            if (caster.Mounted)
            {
                caster.SendLocalizedMessage(1042561);                   // Please dismount first.
            }
            else if (!caster.CanBeginAction(typeof(IncognitoSpell)))
            {
                caster.SendMessage("Vous ne pouvez faire ce sort en étant sous l'effet de l'incognito.");
            }
            else if (!caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                caster.SendMessage("Vous ne pouvez faire ce sort en étant transformé.");
            }

            /*else if (!caster.CanBeginAction(typeof(ChauveSouris)))
             * {
             *  caster.SendMessage("Vous ne pouvez vous transformer en étant sous la forme d'une chauve-souris.");
             * }
             * else if (caster is PlayerMobile && ((PlayerMobile)caster).Disguised)
             * {
             *  caster.SendMessage("Vous ne pouvez faire ce sort en étant déguisé.");
             * }*/
            else if (CheckSequence())
            {
                TransformContext context = GetContext(caster);
                Type             ourType = this.GetType();

                bool wasTransformed = (context != null);
                bool ourTransform   = (wasTransformed && context.Type == ourType);

                if (wasTransformed)
                {
                    RemoveContext(caster, context, ourTransform);

                    if (ourTransform)
                    {
                        caster.PlaySound(0xFA);
                        Effects.SendTargetParticles(Caster, 0x3728, 1, 13, 5042, EffectLayer.Waist);
                    }
                }

                if (!ourTransform)
                {
                    ArrayList mods = new ArrayList();

                    if (StrOffset != 0)
                    {
                        mods.Add(new StatMod(StatType.Str, "TransformationSpell", StrOffset, TimeSpan.FromDays(90.0)));
                    }

                    if (DexOffset != 0)
                    {
                        mods.Add(new StatMod(StatType.Dex, "TransformationSpell", DexOffset, TimeSpan.FromDays(90.0)));
                    }

                    if (IntOffset != 0)
                    {
                        mods.Add(new StatMod(StatType.Int, "TransformationSpell", IntOffset, TimeSpan.FromDays(90.0)));
                    }

                    if (!((Body)this.Body).IsHuman)
                    {
                        Mobiles.IMount mt = Caster.Mount;

                        if (mt != null)
                        {
                            mt.Rider = null;
                        }
                    }

                    caster.BodyMod = this.Body;
                    caster.HueMod  = this.Hue;

                    for (int i = 0; i < mods.Count; ++i)
                    {
                        caster.AddStatMod((StatMod)mods[i]);
                    }

                    PlayEffect(caster);

                    Timer timer = new TransformTimer(caster, this);
                    timer.Start();

                    AddContext(caster, new TransformContext(timer, mods, ourType));
                }
            }

            FinishSequence();
        }
        public static bool AddStatCurse(Mobile caster, Mobile target, StatType type, int curse, TimeSpan duration)
        {
            int offset = curse;
            string name = String.Format("[Magic] {0} Curse", type);

            StatMod mod = target.GetStatMod(name);
			if (mod != null)
				offset = Math.Max(mod.Offset, offset);
			offset *= -1;

            target.AddStatMod(new StatMod(type, name, offset, duration));
			Timer.DelayCall(duration, RemoveStatOffsetCallback, target);
			return true;
        }
Example #16
0
        public static void ApplyHungerStatMod(Mobile m)
        {
            if (m is PlayerMobile && m.AccessLevel == AccessLevel.Player)
            {
                m.CloseGump(typeof(HungerGump));
                m.SendGump(new HungerGump(m));
            }

            int HungerModStr = 0;

            if (m.Hunger == 0)
                HungerModStr = 0;
            else if (m.Hunger < 4)
                HungerModStr = 1;
            else if (m.Hunger < 8)
                HungerModStr = 2;
            else if (m.Hunger < 12)
                HungerModStr = 3;
            else if (m.Hunger < 16)
                HungerModStr = 4;
            else if (m.Hunger <= 20)
                HungerModStr = 5;

            m.AddStatMod(new StatMod(StatType.Str, "HungerModStr", HungerModStr, TimeSpan.Zero));
        }
Example #17
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
                m_PlayerConstructed = reader.ReadBool();
                m_LowerStatReq      = reader.ReadInt();
                goto case 3;

            case 3:
                m_UsesRemaining     = reader.ReadInt();
                m_ShowUsesRemaining = reader.ReadBool();
                goto case 2;

            case 2:
                m_OriginalHue = reader.ReadInt();
                int idx = reader.ReadInt();
                m_BaitType     = FishInfo.GetTypeFromIndex(idx);
                m_HookType     = (HookType)reader.ReadInt();
                m_HookUses     = reader.ReadInt();
                m_BaitUses     = reader.ReadInt();
                m_EnhancedBait = reader.ReadBool();

                SaveFlag flags = (SaveFlag)reader.ReadInt();

                if (GetSaveFlag(flags, SaveFlag.xAttributes))
                {
                    m_AosAttributes = new AosAttributes(this, reader);
                }
                else
                {
                    m_AosAttributes = new AosAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                }
                else
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this);
                }
                break;

            case 1:
                m_AosAttributes   = new AosAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
                break;
            }

            if (Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
            }

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }

            if (m_BaitType != null && m_BaitUses <= 0)
            {
                BaitType = null;
            }

            if (m_HookType != HookType.None && m_HookUses <= 0)
            {
                HookType = HookType.None;
            }

            if (version < 3 && m_Crafter != null)
            {
                m_PlayerConstructed = true;

                if (m_Resource == CraftResource.None)
                {
                    Resource = CraftResource.RegularWood;
                }
                else
                {
                    DistributeMaterialBonus();
                }
            }
        }
		public virtual void DoCurse(Mobile attacker, Mobile defender)
		{
			attacker.SendLocalizedMessage(1113717); // You have hit your target with a curse effect.
			defender.SendLocalizedMessage(1113718); // You have been hit with a curse effect.
			defender.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
			defender.PlaySound(0x1EA);
			defender.AddStatMod(
				new StatMod(StatType.Str, String.Format("[Magic] {0} Curse", StatType.Str), -10, TimeSpan.FromSeconds(30)));
			defender.AddStatMod(
				new StatMod(StatType.Dex, String.Format("[Magic] {0} Curse", StatType.Dex), -10, TimeSpan.FromSeconds(30)));
			defender.AddStatMod(
				new StatMod(StatType.Int, String.Format("[Magic] {0} Curse", StatType.Int), -10, TimeSpan.FromSeconds(30)));

			int percentage = -10; //(int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
			string args = String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", percentage, percentage, percentage, 10, 10, 10, 10);

			BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.Curse, 1075835, 1075836, TimeSpan.FromSeconds(30), defender, args));
		}
Example #19
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!this.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)));

                this.Consume();
            }
        }
 private void SetMods(Mobile m)
 {
     m.AddStatMod(m_StatMod0);
 }
Example #21
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_ReplenishesCharges = reader.ReadBool();
            if (m_ReplenishesCharges)
            {
                m_LastReplenished = reader.ReadDateTime();
            }

            m_Crafter = reader.ReadMobile();

            m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
            m_Slayer  = (SlayerName)reader.ReadEncodedInt();
            m_Slayer2 = (SlayerName)reader.ReadEncodedInt();

            UsesRemaining = reader.ReadEncodedInt();

            m_WellSound  = reader.ReadEncodedInt();
            m_BadlySound = reader.ReadEncodedInt();

            m_MaxHitPoints = reader.ReadEncodedInt();
            m_HitPoints    = reader.ReadEncodedInt();

            m_Resource = (CraftResource)reader.ReadEncodedInt();

            m_AosAttributes   = new AosAttributes(this, reader);
            m_AosResistances  = new AosElementAttributes(this, reader);
            m_AosSkillBonuses = new AosSkillBonuses(this, reader);

            CheckReplenishUses();

            if (Core.AOS && Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
            }

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }
        }
Example #22
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Parent != from)
            {
                if (this.ItemID == 7107)
                {
                    this.ItemID = 7108;
                }
                else if (this.ItemID == 7108)
                {
                    this.ItemID = 7107;
                }
            }
            else if (from.Title != "Gaurdian of the Ages")
            {
                if (ItemID == 7107)
                {
                    if (from.Karma <= 0)
                    {
                        from.Title   = "Gaurdian of the Ages";
                        from.BodyMod = 753;
                        from.HueMod  = 1109;

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

                        m_StatMod5 = new StatMod(StatType.Str, "MOD5", 10, TimeSpan.Zero);

                        from.AddStatMod(m_StatMod5);

                        this.Attributes.WeaponDamage    = 15;
                        this.Attributes.ReflectPhysical = 15;
                        this.Attributes.DefendChance    = 25;
                        this.Attributes.WeaponSpeed     = 5;
                        this.Attributes.SpellChanneling = 1;
                        this.Attributes.SpellDamage     = 10;
                        this.Attributes.NightSight      = 1;
                    }
                    else
                    {
                        from.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);

                        m_StatMod5 = new StatMod(StatType.Str, "MOD5", 10, TimeSpan.Zero);

                        from.AddStatMod(m_StatMod5);

                        this.Attributes.WeaponDamage    = 15;
                        this.Attributes.ReflectPhysical = 15;
                        this.Attributes.DefendChance    = 25;
                        this.Attributes.WeaponSpeed     = 5;
                        this.Attributes.SpellChanneling = 1;
                        this.Attributes.SpellDamage     = 10;
                        this.Attributes.NightSight      = 1;
                    }
                }
                else if (ItemID == 7108)
                {
                    if (from.Karma >= 0)
                    {
                        from.Title   = "Gaurdian of the Ages";
                        from.BodyMod = 752;
                        from.HueMod  = 1157;

                        from.FixedParticles(0x373A, 1, 17, 1108, 7, 9914, 0);
                        from.FixedParticles(0x376A, 1, 22, 67, 7, 9502, 0);

                        m_StatMod5 = new StatMod(StatType.Str, "MOD5", 10, TimeSpan.Zero);

                        from.AddStatMod(m_StatMod5);

                        this.Attributes.WeaponDamage    = 15;
                        this.Attributes.ReflectPhysical = 15;
                        this.Attributes.DefendChance    = 25;
                        this.Attributes.WeaponSpeed     = 5;
                        this.Attributes.SpellChanneling = 1;
                        this.Attributes.SpellDamage     = 10;
                        this.Attributes.NightSight      = 1;
                    }
                    else
                    {
                        from.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);

                        m_StatMod5 = new StatMod(StatType.Str, "MOD5", 10, TimeSpan.Zero);

                        from.AddStatMod(m_StatMod5);

                        this.Attributes.WeaponDamage    = 15;
                        this.Attributes.ReflectPhysical = 15;
                        this.Attributes.DefendChance    = 25;
                        this.Attributes.WeaponSpeed     = 5;
                        this.Attributes.SpellChanneling = 1;
                        this.Attributes.SpellDamage     = 10;
                        this.Attributes.NightSight      = 1;
                    }
                }
            }
            else
            {
                from.BoltEffect(0);
                from.FixedParticles(0x376A, 1, 29, 0x47D, 2, 9962, 0);

                from.HueMod  = -1;
                from.Title   = null;
                from.BodyMod = 0x0;

                from.RemoveStatMod("MOD5");

                this.Attributes.WeaponDamage    = 5;
                this.Attributes.ReflectPhysical = 5;
                this.Attributes.DefendChance    = 15;
                this.Attributes.WeaponSpeed     = 0;
                this.Attributes.SpellChanneling = 1;
                this.Attributes.SpellDamage     = 5;
                this.Attributes.NightSight      = 1;
            }
        }
Example #23
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 8:
            {
                m_Exceptional       = reader.ReadBool();
                m_PlayerConstructed = reader.ReadBool();
                m_Crafter           = reader.ReadMobile();

                goto case 7;
            }

            case 7:
            {
                m_AbsorptionAttributes = new AbsorptionAttributes(this, reader);

                m_TimesImbued = reader.ReadEncodedInt();

                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                m_MagicalAttributes = new MagicalAttributes(this, reader);
                m_AosResistances    = new ElementAttributes(this, reader);
                m_SkillBonuses      = new SkillBonuses(this, reader);

                if (Parent is Mobile)
                {
                    m_SkillBonuses.AddTo((Mobile)Parent);
                }

                break;
            }
            }

            int strBonus = m_MagicalAttributes.BonusStr;
            int dexBonus = m_MagicalAttributes.BonusDex;
            int intBonus = m_MagicalAttributes.BonusInt;

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }
        }
Example #24
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 7:
            case 6:
            case 5:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                if (GetSaveFlag(flags, SaveFlag.Identified))
                {
                    m_Identified = version >= 7 || reader.ReadBool();
                }

                if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
                {
                    m_MaxHitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.HitPoints))
                {
                    m_HitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Crafter))
                {
                    m_Crafter = reader.ReadMobile();
                }

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (ArmorQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = ArmorQuality.Regular;
                }

                if (version == 5 && m_Quality == ArmorQuality.Low)
                {
                    m_Quality = ArmorQuality.Regular;
                }

                if (GetSaveFlag(flags, SaveFlag.Durability))
                {
                    m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();

                    if (m_Durability > ArmorDurabilityLevel.Indestructible)
                    {
                        m_Durability = ArmorDurabilityLevel.Durable;
                    }
                }

                if (GetSaveFlag(flags, SaveFlag.Protection))
                {
                    m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

                    if (m_Protection > ArmorProtectionLevel.Invulnerability)
                    {
                        m_Protection = ArmorProtectionLevel.Defense;
                    }
                }

                if (GetSaveFlag(flags, SaveFlag.Resource))
                {
                    m_Resource = (CraftResource)reader.ReadEncodedInt();
                }
                else
                {
                    m_Resource = DefaultResource;
                }

                if (m_Resource == CraftResource.None)
                {
                    m_Resource = DefaultResource;
                }

                if (GetSaveFlag(flags, SaveFlag.BaseArmor))
                {
                    m_ArmorBase = reader.ReadEncodedInt();
                }
                else
                {
                    m_ArmorBase = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrBonus))
                {
                    m_StrBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexBonus))
                {
                    m_DexBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntBonus))
                {
                    m_IntBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrReq))
                {
                    m_StrReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexReq))
                {
                    m_DexReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntReq))
                {
                    m_IntReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.MedAllowance))
                {
                    m_Meditate = (AMA)reader.ReadEncodedInt();
                }
                else
                {
                    m_Meditate = (AMA)(-1);
                }

                if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
                {
                    m_PlayerConstructed = true;
                }

                break;
            }

            case 4:
            case 3:
            case 2:
            case 1:
            {
                m_Identified = reader.ReadBool();
                goto case 0;
            }

            case 0:
            {
                m_ArmorBase    = reader.ReadInt();
                m_MaxHitPoints = reader.ReadInt();
                m_HitPoints    = reader.ReadInt();
                m_Crafter      = reader.ReadMobile();
                m_Quality      = (ArmorQuality)reader.ReadInt();
                m_Durability   = (ArmorDurabilityLevel)reader.ReadInt();
                m_Protection   = (ArmorProtectionLevel)reader.ReadInt();

                AMT mat = (AMT)reader.ReadInt();

                if (m_ArmorBase == RevertArmorBase)
                {
                    m_ArmorBase = -1;
                }

                if (version >= 2)
                {
                    m_Resource = (CraftResource)reader.ReadInt();
                }
                else
                {
                    OreInfo info;

                    switch (reader.ReadInt())
                    {
                    default:
                    case 0: info = OreInfo.Iron; break;

                    case 1: info = OreInfo.DullCopper; break;

                    case 2: info = OreInfo.ShadowIron; break;

                    case 3: info = OreInfo.Copper; break;

                    case 4: info = OreInfo.Bronze; break;

                    case 5: info = OreInfo.Gold; break;

                    case 6: info = OreInfo.Agapite; break;

                    case 7: info = OreInfo.Verite; break;

                    case 8: info = OreInfo.Valorite; break;
                    }

                    m_Resource = CraftResources.GetFromOreInfo(info, mat);
                }

                m_StrBonus = reader.ReadInt();
                m_DexBonus = reader.ReadInt();
                m_IntBonus = reader.ReadInt();
                m_StrReq   = reader.ReadInt();
                m_DexReq   = reader.ReadInt();
                m_IntReq   = reader.ReadInt();

                if (m_StrBonus == OldStrBonus)
                {
                    m_StrBonus = -1;
                }

                if (m_DexBonus == OldDexBonus)
                {
                    m_DexBonus = -1;
                }

                if (m_IntBonus == OldIntBonus)
                {
                    m_IntBonus = -1;
                }

                if (m_StrReq == OldStrReq)
                {
                    m_StrReq = -1;
                }

                if (m_DexReq == OldDexReq)
                {
                    m_DexReq = -1;
                }

                if (m_IntReq == OldIntReq)
                {
                    m_IntReq = -1;
                }

                m_Meditate = (AMA)reader.ReadInt();

                if (m_Meditate == OldMedAllowance)
                {
                    m_Meditate = (AMA)(-1);
                }

                if (m_Resource == CraftResource.None)
                {
                    if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
                    {
                        m_Resource = CraftResource.RegularLeather;
                    }
                    else
                    {
                        m_Resource = CraftResource.Iron;
                    }
                }

                if (m_MaxHitPoints == 0 && m_HitPoints == 0)
                {
                    m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
                }

                break;
            }
            }

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

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }

            if (version < 7)
            {
                m_PlayerConstructed = true;                 // we don't know, so, assume it's crafted
            }
        }
Example #25
0
        public override void OnAdded(object parent)
        {
            if (m_Uses > 0 && parent is Mobile)
            {
                Mobile from    = (Mobile)parent;
                string modName = from.Serial.ToString();
                switch (m_Effect)
                {
                case MagicEffect.None:
                {
                    break;
                }

                case MagicEffect.Clumsy:
                {
                    Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this);
                    from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", Utility.Random(-5, -11), TimeSpan.Zero));
                    //from.FixedParticles( 0x3779, 10, 15, 5002, EffectLayer.Head );
                    //from.PlaySound( 0x1DF );
                    t.Start();
                    break;
                }

                case MagicEffect.Feeblemind:
                {
                    Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this);
                    from.AddStatMod(new StatMod(StatType.Int, modName + "Int", Utility.Random(-5, -11), TimeSpan.Zero));
                    //from.FixedParticles( 0x3779, 10, 15, 5004, EffectLayer.Head );
                    //from.PlaySound( 0x1E4 );
                    t.Start();
                    break;
                }

                case MagicEffect.Nightsight:
                {
                    from.LightLevel = 35;
                    new LightCycle.NightSightTimer(from).Start();
                    //from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist );
                    //from.PlaySound( 0x1E3 );
                    break;
                }

                case MagicEffect.Weaken:
                {
                    Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this);
                    from.AddStatMod(new StatMod(StatType.Str, modName + "Str", Utility.Random(-5, -11), TimeSpan.Zero));
                    //from.FixedParticles( 0x3779, 10, 15, 5009, EffectLayer.Waist );
                    //from.PlaySound( 0x1E6 );
                    t.Start();
                    break;
                }

                case MagicEffect.Agility:
                {
                    Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this);
                    from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", Utility.Random(5, 11), TimeSpan.Zero));
                    //from.FixedParticles( 0x375A, 10, 15, 5010, EffectLayer.Waist );
                    //from.PlaySound( 0x28E );
                    t.Start();
                    break;
                }

                case MagicEffect.Cunning:
                {
                    Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this);
                    from.AddStatMod(new StatMod(StatType.Int, modName + "Int", Utility.Random(5, 11), TimeSpan.Zero));
                    //from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head );
                    //from.PlaySound( 0x1EB );
                    t.Start();
                    break;
                }

                case MagicEffect.Protection:
                {
                    if (m_Registry.ContainsKey(from))
                    {
                        from.SendAsciiMessage("This spell is already in effect.");
                    }
                    else if (from.BeginAction(typeof(DefensiveSpell)))
                    {
                        double value = (int)(from.Skills[SkillName.EvalInt].Value + from.Skills[SkillName.Meditation].Value + from.Skills[SkillName.Inscribe].Value);
                        value /= 4;

                        if (value < 0)
                        {
                            value = 0;
                        }
                        else if (value > 75)
                        {
                            value = 75.0;
                        }

                        Registry.Add(from, value);
                        new ProtectionTimer(from, this).Start();

                        from.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist);
                        from.PlaySound(0x1ED);
                    }
                    else
                    {
                        from.SendAsciiMessage("The spell will not adhere to you at this time.");
                    }
                    break;
                }

                case MagicEffect.Stength:
                {
                    Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this);
                    from.AddStatMod(new StatMod(StatType.Str, modName + "Str", Utility.Random(5, 11), TimeSpan.Zero));
                    //from.FixedParticles( 0x375A, 10, 15, 5017, EffectLayer.Waist );
                    //from.PlaySound( 0x1EE );
                    t.Start();
                    break;
                }

                case MagicEffect.Bless:
                {
                    Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this);
                    from.AddStatMod(new StatMod(StatType.Str, modName + "Str", Utility.Random(5, 11), TimeSpan.Zero));
                    from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", Utility.Random(5, 11), TimeSpan.Zero));
                    from.AddStatMod(new StatMod(StatType.Int, modName + "Int", Utility.Random(5, 11), TimeSpan.Zero));
                    //from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
                    //from.PlaySound( 0x1EA );
                    t.Start();
                    break;
                }

                case MagicEffect.Invisibility:
                {
                    Timer t = new InvisTimer(from, TimeSpan.FromSeconds(10), this);
                    from.Hidden = true;
                    //Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z + 16 ), from.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 );
                    //from.PlaySound( 0x203 );
                    t.Start();
                    break;
                }

                case MagicEffect.MagicReflection:
                {
                    if (from.BeginAction(typeof(DefensiveSpell)))
                    {
                        Timer t     = new MRTimer(from, TimeSpan.FromSeconds(60), this);
                        int   value = (int)(from.Skills[SkillName.Magery].Value + from.Skills[SkillName.Inscribe].Value);
                        value = (int)(2 + (value / 200) * 7.0);                            //absorb from 8 to 15 "circles"

                        from.MagicDamageAbsorb = value;

                        from.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
                        from.PlaySound(0x1E9);
                        t.Start();
                    }
                    else
                    {
                        from.SendAsciiMessage("The spell will not adhere to you at this time.");
                    }
                    break;
                }
                }
                --m_Uses;
            }
        }
Example #26
0
        public static void UpdateProperties(Mobile from)
        {
            if (from == null)
            {
                return;
            }

            PlayerDungeonArmorProfile dungeonArmorSet = new PlayerDungeonArmorProfile(from, null);

            bool matchingSet = false;

            if (dungeonArmorSet.MatchingSet)
            {
                matchingSet = true;
            }

            List <Layer> m_Layers = new List <Layer>();

            m_Layers.Add(Layer.Helm);
            m_Layers.Add(Layer.Neck);
            m_Layers.Add(Layer.InnerTorso);
            m_Layers.Add(Layer.Arms);
            m_Layers.Add(Layer.Gloves);
            m_Layers.Add(Layer.Pants);

            for (int a = 0; a < m_Layers.Count; a++)
            {
                BaseArmor armor = from.FindItemOnLayer(m_Layers[a]) as BaseArmor;

                if (armor != null)
                {
                    string modName = armor.Serial.ToString();

                    from.RemoveStatMod(modName + "Dex");

                    armor.BaseArmorRating     = armor.ArmorBase;
                    armor.MeditationAllowance = armor.DefMedAllowance;

                    if (matchingSet && !dungeonArmorSet.InPlayerCombat)
                    {
                        armor.BaseArmorRating = dungeonArmorSet.DungeonArmorDetail.TieredArmorRating;

                        //Assign All of the Suit's Dex Penalty to The Chest Piece (Dex Will Be Automatically Recalculated if Any Piece is Removed)
                        if (armor.Layer == Layer.InnerTorso)
                        {
                            from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dungeonArmorSet.DungeonArmorDetail.DexPenalty, TimeSpan.Zero));
                        }

                        armor.MeditationAllowance = dungeonArmorSet.DungeonArmorDetail.MeditationAllowance;
                    }

                    else
                    {
                        from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", armor.OldDexBonus, TimeSpan.Zero));
                    }
                }
            }

            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                player.ResetRegenTimers();
            }
        }
Example #27
0
        public override void OnTrigger(object activator, Mobile m)
        {
            if (m == null || this.Word == null || (this.RequireIdentification && !this.m_Identified))
                return;

            if (DateTime.Now < this.m_EndTime)
                return;

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

            // assign powers to certain words
            switch ( this.Word )
            {
                case "Shoda":
                    m.AddStatMod(new StatMod(StatType.Int, "Shoda", 20, this.Duration));
                    m.SendMessage("Your mind expands!");
                    break;
                case "Malik":
                    m.AddStatMod(new StatMod(StatType.Str, "Malik", 20, this.Duration));
                    m.SendMessage("Your strength surges!");
                    break;
                case "Lepto":
                    m.AddStatMod(new StatMod(StatType.Dex, "Lepto", 20, this.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, this.Duration));
                    m.SendMessage("You are more skillful warrior!");
                    break;
                case "Marda":
                    m.AddSkillMod(new TimedSkillMod(SkillName.Magery, true, 20, this.Duration));
                    m.SendMessage("You are more skillful mage!");
                    break;
                case "Vas Malik":
                    m.AddStatMod(new StatMod(StatType.Str, "Vas Malik", 40, this.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 (this.AttachedTo is Item)
            {
                ((Item)this.AttachedTo).PublicOverheadMessage(MessageType.Regular, 0x3B2, true, msgstr);
            }
            
            this.Charges--;

            // remove the attachment after the charges run out
            if (this.Charges == 0)
            {
                this.Delete();
            }
            else
            {
                this.m_EndTime = DateTime.Now + this.Refractory;
            }
        }
Example #28
0
        public override void OnTrigger(object activator, Mobile m)
        {
            if (m == null || Word == null || (RequireIdentification && !m_Identified))
            {
                return;
            }

            if (DateTime.UtcNow < 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.UtcNow + 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 Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                #region SF Imbuing
            //SF Imbuing
            case 8:
            {
                m_TimesImbued = reader.ReadEncodedInt();
                goto case 7;
            }

                #endregion
            case 7:
            {
                m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                goto case 6;
            }

            case 6:
            {
                if (version == 6)
                {
                    m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
                }

                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 5;
            }

            //personal bless deed
            case 5:
            {
                m_BlessedBy = reader.ReadMobile();
                goto case 4;
            }

                #region Mondain's Legacy Sets
            case 4:
            {
                m_LastEquipped = reader.ReadBool();
                m_SetEquipped  = reader.ReadBool();
                m_SetHue       = reader.ReadEncodedInt();

                m_SetAttributes   = new AosAttributes(this, reader);
                m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                goto case 3;
            }

                #endregion
                #region Mondain's Legacy
            case 3:
            {
                m_Crafter = reader.ReadMobile();
                m_Quality = (ArmorQuality)reader.ReadInt();

                goto case 2;
            }

                #endregion
            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)Parent;

                    string modName = Serial.ToString();

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

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

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

                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            #region Mondain's Legacy Sets
            if (m_SetAttributes == null)
            {
                m_SetAttributes = new AosAttributes(this);
            }

            if (m_SetSkillBonuses == null)
            {
                m_SetSkillBonuses = new AosSkillBonuses(this);
            }
            #endregion

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
		public static void ApplySkillLoss(Mobile mob)
		{
			var pm = mob as PlayerMobile;

			if (pm == null || pm.StatEnd < DateTime.UtcNow)
			{
				return;
			}

			try
			{
				TimeSpan lossperiod = pm.StatEnd - DateTime.UtcNow;
				double loss = 0.40; // 40% loss

				ClearSkillLoss(pm);

				var context = new SkillLossContext();
				m_SkillLoss[pm] = context;

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

				foreach (Skill sk in pm.Skills)
				{
					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(lossperiod, m => ClearSkillLoss(m), mob);
			}
			catch
			{ }
		}
Example #32
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_Crafter = reader.ReadMobile();
                goto case 2;
            }

            case 2:
            {
                m_Slayer  = (SlayerName)reader.ReadInt();
                m_Slayer2 = (SlayerName)reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                goto case 0;
            }

            case 0:
            {
                m_Content = reader.ReadULong();
                m_Count   = reader.ReadInt();

                break;
            }
            }

            if (m_AosAttributes == null)
            {
                m_AosAttributes = new AosAttributes(this);
            }

            if (m_AosSkillBonuses == null)
            {
                m_AosSkillBonuses = new AosSkillBonuses(this);
            }

            if (Core.AOS && Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
            }

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }
        }
Example #33
0
        public static void ApplyThirstStatMod(Mobile m)
        {
            if (m is PlayerMobile && m.AccessLevel == AccessLevel.Player)
            {
                m.CloseGump(typeof(HungerGump));
                m.SendGump(new HungerGump(m));
            }

            int ThirstModDex = 0;

            if (m.Thirst == 0)
                ThirstModDex = 0;
            else if (m.Thirst < 4)
                ThirstModDex = 1;
            else if (m.Thirst < 8)
                ThirstModDex = 2;
            else if (m.Thirst < 12)
                ThirstModDex = 3;
            else if (m.Thirst < 16)
                ThirstModDex = 4;
            else if (m.Thirst <= 20)
                ThirstModDex = 5;

            m.AddStatMod(new StatMod(StatType.Dex, "ThirstModDex", ThirstModDex, TimeSpan.Zero));
        }
Example #34
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                #region ItemID_Mods
            case (3):
            {
                m_Identified = reader.ReadBool();
                goto case 2;
            }

                #endregion
            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)Parent;

                    string modName = Serial.ToString();

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

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

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

                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
Example #35
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                // Genova: suporte ao UO:ML.
                #region Mondain's Legacy
                m_Crafter = reader.ReadMobile();
                m_Quality = (ArmorQuality)reader.ReadInt();
                #endregion

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)Parent;

                    string modName = Serial.ToString();

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

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

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

                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
Example #36
0
        public static void OnMasteryChanged(Mobile m, SkillName oldMastery)
        {
            PassiveSpell passive    = GetActivePassive(m);
            SkillName    newMastery = m.Skills.CurrentMastery;

            if (oldMastery != newMastery)
            {
                List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m);

                if (list != null)
                {
                    list.ForEach(spell =>
                    {
                        spell.Expire();
                    });

                    ColUtility.Free(list);
                }

                if (m is PlayerMobile pm && oldMastery == SkillName.Necromancy)
                {
                    pm.AllFollowers.IterateReverse(mob =>
                    {
                        if (mob is BaseCreature bc && CommandUndeadSpell.ValidateTarget(bc))
                        {
                            bc.SetControlMaster(null);
                        }
                    });
                }

                SpecialMove move = SpecialMove.GetCurrentMove(m);

                if (move is SkillMasteryMove)
                {
                    SpecialMove.ClearCurrentMove(m);
                }

                m.RemoveStatMod("SavingThrow_Str");

                ColUtility.Free(list);
                RemovePassiveBuffs(m);
            }

            if (passive != PassiveSpell.None && passive != PassiveSpell.AnticipateHit)
            {
                switch (passive)
                {
                case PassiveSpell.EnchantedSummoning:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EnchantedSummoning, 1155904, 1156090, string.Format("{0}\t{0}", EnchantedSummoningBonus(m).ToString()), true));     // +~1_STAMINA~ Stamina Regeneration and +~2_HP~% Hit Points for summoned pets.<br>Increased difficulty for summoned pets to be dispelled.
                    break;

                case PassiveSpell.Intuition:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Intuition, 1155907, 1156089, IntuitionBonus(m).ToString(), true));     // Mana Increase ~1_VAL~
                    break;

                case PassiveSpell.SavingThrow:
                {
                    string args = null;

                    switch (GetMasteryLevel(m, newMastery))
                    {
                    default: args = "5\t0\t0\t0"; break;

                    case 2: args = "5\t5\t0\t0"; break;

                    case 3: args = "5\t5\t5\t5"; break;
                    }

                    m.AddStatMod(new StatMod(StatType.Str, "SavingThrow_Str", 5, TimeSpan.Zero));
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1156031, 1156032, args, true));         // Provides a chance to block disarm attempts based on Mastery level, weapon skill level and tactics skill level.
                }
                break;

                case PassiveSpell.Potency:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Potency, 1155928, 1156195, NonPoisonConsumeChance(m).ToString(), true));     // ~1_VAL~% chance to not consume poison charges when using infecting strike or injected strike.
                    break;

                case PassiveSpell.Knockout:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Knockout, 1155931, 1156030, string.Format("{0}\t{1}", GetKnockoutModifier(m).ToString(), GetKnockoutModifier(m, true).ToString(), true)));     // Wrestling Damage Bonus:<br>+~1_VAL~% PvM<br>+~2_VAL~% PvP
                    break;

                case PassiveSpell.Boarding:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Boarding, 1155934, 1156194, BoardingSlotIncrease(m).ToString(), true));     // Your number of stable slots has been increased by ~1_VAL~.
                    break;
                }

                m.Delta(MobileDelta.WeaponDamage);
                m.UpdateResistances();

                if (m.Mana > m.ManaMax)
                {
                    m.Mana = m.ManaMax;
                }
            }

            if (m.Backpack != null)
            {
                foreach (Item item in m.Backpack.FindItemsByType(typeof(BookOfMasteries)))
                {
                    BookOfMasteries book = item as BookOfMasteries;

                    if (book != null)
                    {
                        book.InvalidateProperties();
                    }
                }
            }

            foreach (Item item in m.Items.Where(i => i is BookOfMasteries))
            {
                BookOfMasteries book = item as BookOfMasteries;

                if (book != null)
                {
                    book.InvalidateProperties();
                }
            }
        }
Example #37
0
        public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus )
        {
            PlayHurtAnimation( defender );

            attacker.PlaySound( GetHitAttackSound( attacker, defender ) );
            defender.PlaySound( GetHitDefendSound( attacker, defender ) );

            int damage = ComputeDamage( attacker, defender );

            if (Effect != WeaponEffect.None && Charges > 0)
            {
                #region Magic Weapon Effects
                if (Effect == WeaponEffect.Clumsy)
                {
                    string name = String.Format("[Magic] {0} Offset", StatType.Dex);
                    StatMod mod = defender.GetStatMod(name);

                    if (mod != null && mod.Offset < 0)
                        defender.AddStatMod(new StatMod(StatType.Dex, name, mod.Offset + -10, TimeSpan.FromSeconds(60.0)));
                    else if (mod == null || mod.Offset < -10)
                        defender.AddStatMod(new StatMod(StatType.Dex, name, -10, TimeSpan.FromSeconds(60.0)));

                    Charges--;
                    defender.FixedParticles(0x3779, 10, 15, 5002, EffectLayer.Head);
                    defender.PlaySound(0x1DF);
                }
                else if (Effect == WeaponEffect.Feeblemind)
                {
                    string name = String.Format("[Magic] {0} Offset", StatType.Int);
                    StatMod mod = defender.GetStatMod(name);

                    if (mod != null && mod.Offset < 0)
                        defender.AddStatMod(new StatMod(StatType.Int, name, mod.Offset + -10, TimeSpan.FromSeconds(60.0)));
                    else if (mod == null || mod.Offset < 10)
                        defender.AddStatMod(new StatMod(StatType.Int, name, -10, TimeSpan.FromSeconds(60.0)));

                    Charges--;
                    defender.FixedParticles(0x3779, 10, 15, 5004, EffectLayer.Head);
                    defender.PlaySound(0x1E4);
                }
                else if (Effect == WeaponEffect.MagicArrow)
                {
                    DoMagicArrow(attacker, defender);
                    Charges--;
                    /*attacker.MovingParticles(defender, 0x36E4, 5, 0, false, true, 3006, 4006, 0);
                    attacker.PlaySound(0x1E5);*/
                }
                else if (Effect == WeaponEffect.Weakness)
                {
                    string name = String.Format("[Magic] {0} Offset", StatType.Str);
                    StatMod mod = defender.GetStatMod(name);

                    if (mod != null && mod.Offset < 0)
                        defender.AddStatMod(new StatMod(StatType.Str, name, mod.Offset + -10, TimeSpan.FromSeconds(60.0)));
                    else if (mod == null || mod.Offset < 10)
                        defender.AddStatMod(new StatMod(StatType.Str, name, -10, TimeSpan.FromSeconds(60.0)));

                    Charges--;
                    defender.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist);
                    defender.PlaySound(0x1E6);
                }
                else if (Effect == WeaponEffect.Harm)
                {
                    DoHarm(attacker, defender);
                    Charges--;
                    /*defender.FixedParticles(0x374A, 10, 15, 5013, EffectLayer.Waist);
                    defender.PlaySound(0x1F1);*/
                }
                else if (Effect == WeaponEffect.Paralyze)
                {
                    defender.Paralyze(TimeSpan.FromSeconds(7));
                    Charges--;
                    defender.PlaySound(0x204);
                    defender.FixedEffect(0x376A, 6, 1);
                }
                else if (Effect == WeaponEffect.Fireball)
                {
                    DoFireball(attacker, defender);
                    Charges--;
                    /*attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
                    attacker.PlaySound(0x15E);*/
                }
                else if (Effect == WeaponEffect.Curse)
                {
                    string nameS = String.Format("[Magic] {0} Offset", StatType.Str);
                    string nameD = String.Format("[Magic] {0} Offset", StatType.Dex);
                    string nameI = String.Format("[Magic] {0} Offset", StatType.Int);
                    StatMod strmod = defender.GetStatMod(nameS);
                    StatMod dexmod = defender.GetStatMod(nameD);
                    StatMod intmod = defender.GetStatMod(nameI);

                    if (strmod != null && strmod.Offset > 0)
                        defender.AddStatMod(new StatMod(StatType.Str, nameS, strmod.Offset + -10, TimeSpan.FromSeconds(60.0)));
                    else if (strmod == null || strmod.Offset > 10)
                        defender.AddStatMod(new StatMod(StatType.Str, nameS, -10, TimeSpan.FromSeconds(60.0)));

                    if (dexmod != null && dexmod.Offset > 0)
                        defender.AddStatMod(new StatMod(StatType.Dex, nameD, dexmod.Offset + -10, TimeSpan.FromSeconds(60.0)));
                    else if (dexmod == null || dexmod.Offset > 10)
                        defender.AddStatMod(new StatMod(StatType.Dex, nameD, -10, TimeSpan.FromSeconds(60.0)));

                    if (intmod != null && intmod.Offset > 0)
                        defender.AddStatMod(new StatMod(StatType.Int, nameI, intmod.Offset + -10, TimeSpan.FromSeconds(60.0)));
                    else if (intmod == null || intmod.Offset > 10)
                        defender.AddStatMod(new StatMod(StatType.Int, nameI, -10, TimeSpan.FromSeconds(60.0)));

                    Charges--;
                    defender.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
                    defender.PlaySound(0x1EA);
                }
                else if (Effect == WeaponEffect.ManaDrain)
                {
                    defender.Mana -= 10;
                    Charges--;
                    defender.FixedParticles(0x374A, 10, 15, 5032, EffectLayer.Head);
                    defender.PlaySound(0x1F8);
                }
                else if (Effect == WeaponEffect.Lightning)
                {
                    DoLightning(attacker, defender);
                    Charges--;
                    /*defender.BoltEffect(0);*/
                }
                #endregion
            }

            CheckSlayerResult cs = CheckSlayers( attacker, defender );

            if ( cs != CheckSlayerResult.None )
            {
                if ( cs == CheckSlayerResult.Slayer )
                    defender.FixedEffect( 0x37B9, 10, 5 );

                damage *= 2;
            }

            if ( attacker is BaseCreature )
                ((BaseCreature)attacker).AlterMeleeDamageTo( defender, ref damage );

            if ( defender is BaseCreature )
                ((BaseCreature)defender).AlterMeleeDamageFrom( attacker, ref damage );

            damage = AbsorbDamage( attacker, defender, damage );

            // Halve the computed damage and return
            damage /= 2;

            if (damage < 1)
                damage = 1;

            if (attacker is PlayerMobile)
                damage += 2;

            AddBlood( attacker, defender, damage );
            defender.Damage(damage, attacker);

            if (defender is Slime)
            {
                if ((damage > (defender.Hits / 4)) && (defender.Hits > 5))
                {
                    defender.Say(true, "*The slime splits when struck!*");
                    BaseCreature slime = new Slime();
                    slime.Hits = (defender.Hits / 2);
                    defender.Hits /= 2;
                    slime.MoveToWorld(new Point3D(defender.X, defender.Y, defender.Z), defender.Map);
                }
            }

            Item hammer = attacker.FindItemOnLayer(Layer.OneHanded);

            if ( (m_MaxHits > 0 || (hammer != null && hammer is SmithHammer && ((SmithHammer)hammer).MaxHitPoints > 0)) && ((MaxRange <= 1 && (defender is Slime || defender is ToxicElemental)) || Utility.Random( 25 ) == 0) ) // Stratics says 50% chance, seems more like 4%..
            {
                if ((MaxRange <= 1 || (hammer != null && hammer is SmithHammer)) && (defender is Slime || defender is ToxicElemental))
                    attacker.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "*Acid blood scars your weapon!*" );

                    if (( m_Hits > 0 ) || (hammer != null && hammer is SmithHammer && ((SmithHammer)hammer).HitPoints > 0))
                    {
                        --HitPoints;
                    }
                    else if (( m_MaxHits > 1 ) || (hammer != null && hammer is SmithHammer && ((SmithHammer)hammer).MaxHitPoints > 1))
                    {
                        --MaxHitPoints;

                        if ( Parent is Mobile )
                            ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "Your equipment is severely damaged." );
                    }
                    else
                    {
                        Delete();
                    }
            }

            if ( attacker is BaseCreature )
                ((BaseCreature)attacker).OnGaveMeleeAttack( defender );

            if ( defender is BaseCreature )
                ((BaseCreature)defender).OnGotMeleeAttack( attacker );
        }
Example #38
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))
                {
                default: break;

                case 0: item = new SolesOfProvidence(); break;

                case 1: item = new GemologistsSatchel(); break;

                case 2: item = new RelicFragment(5); break;

                case 3: item = new EnchantedEssence(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;

                case 4:
                    m_SpecialProtection[from] = DateTime.UtcNow + TimeSpan.FromMinutes(60);
                    from.SendLocalizedMessage(1113375);     // You suddenly feel less vulnerable!
                    break;

                case 5:
                    m_BalmBoost[from] = DateTime.UtcNow + TimeSpan.FromMinutes(60);
                    from.SendLocalizedMessage(1113372);     // The duration of your balm has been increased by an hour!
                    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 #39
0
        public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
        {
            base.OnHit(attacker, defender, damageBonus);

            if (!Core.AOS && (attacker.Player || attacker.Body.IsHuman) && this.Layer == Layer.TwoHanded && (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(0x308);
                }
            }
        }
Example #40
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 8:
            {
                _VvVItem   = reader.ReadBool();
                _Owner     = reader.ReadMobile();
                _OwnerName = reader.ReadString();
                goto case 7;
            }

            case 7:
            {
                this.m_IsImbued = reader.ReadBool();
                goto case 6;
            }

            case 6:
            {
                m_NegativeAttributes = new NegativeAttributes(this, reader);
                goto case 5;
            }

            case 5:
            {
                #region Runic Reforging
                m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
                m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
                m_ItemPower      = (ItemPower)reader.ReadInt();
                m_BlockRepair    = reader.ReadBool();
                #endregion

                #region Stygian Abyss
                m_GorgonLenseCharges = reader.ReadInt();
                m_GorgonLenseType    = (LenseType)reader.ReadInt();
                goto case 4;
            }

            case 4:
            {
                this.m_TimesImbued = reader.ReadEncodedInt();

                this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                #endregion

                this.m_BlessedBy    = reader.ReadMobile();
                this.m_LastEquipped = reader.ReadBool();
                this.m_SetEquipped  = reader.ReadBool();
                this.m_SetHue       = reader.ReadEncodedInt();

                this.m_SetAttributes   = new AosAttributes(this, reader);
                this.m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                this.m_Crafter = reader.ReadMobile();
                this.m_Quality = (ArmorQuality)reader.ReadInt();
                goto case 3;
            }

            case 3:
            {
                this.m_MaxHitPoints = reader.ReadEncodedInt();
                this.m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                this.m_Resource = (CraftResource)reader.ReadEncodedInt();
                this.m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                this.m_AosAttributes   = new AosAttributes(this, reader);
                this.m_AosResistances  = new AosElementAttributes(this, reader);
                this.m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && this.Parent is Mobile)
                {
                    this.m_AosSkillBonuses.AddTo((Mobile)this.Parent);
                }

                int strBonus = this.m_AosAttributes.BonusStr;
                int dexBonus = this.m_AosAttributes.BonusDex;
                int intBonus = this.m_AosAttributes.BonusInt;

                if (this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)this.Parent;

                    string modName = this.Serial.ToString();

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

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

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

                if (this.Parent is Mobile)
                {
                    ((Mobile)this.Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                this.m_AosAttributes   = new AosAttributes(this);
                this.m_AosResistances  = new AosElementAttributes(this);
                this.m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            if (m_NegativeAttributes == null)
            {
                m_NegativeAttributes = new NegativeAttributes(this);
            }

            #region Mondain's Legacy Sets
            if (this.m_SetAttributes == null)
            {
                this.m_SetAttributes = new AosAttributes(this);
            }

            if (this.m_SetSkillBonuses == null)
            {
                this.m_SetSkillBonuses = new AosSkillBonuses(this);
            }
            #endregion

            if (version < 2)
            {
                this.m_Resource = CraftResource.Iron;
                this.m_GemType  = GemType.None;
            }
        }
Example #41
0
        private void GiveArcaneFocus(Mobile to, TimeSpan duration, int strengthBonus)
        {
            if (to == null)	//Sanity
                return;

            ArcaneFocus focus = FindArcaneFocus(to);

            if (focus == null)
            {
                ArcaneFocus f = new ArcaneFocus(duration, strengthBonus);
                if (to.PlaceInBackpack(f))
                {
                    to.AddStatMod(new StatMod(StatType.Str, "[ArcaneFocus]", strengthBonus, duration));

                    f.SendTimeRemainingMessage(to);
                    to.SendLocalizedMessage(1072740); // An arcane focus appears in your backpack.
                }
                else
                {
                    f.Delete();
                }
            }
            else //OSI renewal rules: the new one will override the old one, always.
            {
                to.SendLocalizedMessage(1072828); // Your arcane focus is renewed.
                focus.LifeSpan = duration;
                focus.CreationTime = DateTime.Now;
                focus.StrengthBonus = strengthBonus;
                focus.InvalidateProperties();
                focus.SendTimeRemainingMessage(to);
            }
        }
Example #42
0
 public override bool OnEquip(Mobile from)
 {
     from.AddStatMod(new StatMod(StatType.Dex, Serial.ToString() + "Forest-Dex", 5, TimeSpan.Zero));
     return(base.OnEquip(from));
 }
Example #43
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 );

            //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( type, name, mod.Offset + offset, duration ) );
                return true;
            }
            //nothing to replace, just adding
            else if( mod == null )
            {
                target.AddStatMod( new StatMod( type, name, offset, 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( type, name, offset, duration ) );
                return true;
            }

            return false;
        }
Example #44
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 6:
            {
                m_Quality = (BookQuality)reader.ReadByte();

                goto case 5;
            }

            case 5:
            {
                m_EngravedText = reader.ReadString();

                goto case 4;
            }

            case 4:
            {
                goto case 3;
            }

            case 3:
            {
                m_Crafter = reader.ReadMobile();
                goto case 2;
            }

            case 2:
            {
                m_Slayer  = (SlayerName)reader.ReadInt();
                m_Slayer2 = (SlayerName)reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                goto case 0;
            }

            case 0:
            {
                m_Content = reader.ReadULong();
                m_Count   = reader.ReadInt();

                break;
            }
            }

            // Scriptiz : on retire les deux slayers de tous les livres
            if (version == 3)
            {
                m_Slayer  = SlayerName.None;
                m_Slayer2 = SlayerName.None;
            }

            if (m_AosAttributes == null)
            {
                m_AosAttributes = new AosAttributes(this);
            }

            if (m_AosSkillBonuses == null)
            {
                m_AosSkillBonuses = new AosSkillBonuses(this);
            }

            if (Core.AOS && Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
            }

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }
        }
Example #45
0
		public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
		{
			base.OnHit( attacker, defender, damageBonus );

			if ( (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( 0x11C );
				}
			}
		}
        public override void OnDoubleClick(Mobile from)
        {
            VampGloves   gloves   = from.FindItemOnLayer(Layer.Gloves) as VampGloves;
            VampHelm     helm     = from.FindItemOnLayer(Layer.Helm) as VampHelm;
            VampLegs     legs     = from.FindItemOnLayer(Layer.Pants) as VampLegs;
            VampArms     arms     = from.FindItemOnLayer(Layer.Arms) as VampArms;
            VampGorget   gorget   = from.FindItemOnLayer(Layer.Neck) as VampGorget;
            VampEarrings earrings = from.FindItemOnLayer(Layer.Earrings) as VampEarrings;
            VampRing     ring     = from.FindItemOnLayer(Layer.Ring) as VampRing;
            VampBracelet bracelet = from.FindItemOnLayer(Layer.Bracelet) as VampBracelet;

            if (Parent != from)
            {
                from.SendMessage("The Shroud of Dracula must be equiped to be used.");
            }

            else if (from.Mounted == true)
            {
                from.SendMessage("You cannot be mounted while trying to transform!");
            }

            else if (gloves == null || helm == null || legs == null || arms == null || gorget == null || earrings == null || ring == null || bracelet == null)
            {
                from.SendMessage("You must have all the pieces of the Vampire equiped to transform!");
            }

            else if (this.Transformed == false)
            {
                LootType = LootType.Blessed;
                from.SendMessage("You pull the hood over your head.");
                from.PlaySound(0x220);
                //from.Title = "the True Vampire";
                from.BodyMod           = 146;
                from.NameHue           = 39;
                from.HueMod            = 1;
                from.DisplayGuildTitle = false;
                this.Transformed       = true;
                ItemID = 9860;
                from.RemoveItem(this);
                from.EquipItem(this);

                m_StatMod0 = new StatMod(StatType.Str, "MOD0", 25, TimeSpan.Zero);
                m_StatMod1 = new StatMod(StatType.Int, "MOD1", 25, TimeSpan.Zero);
                m_StatMod2 = new StatMod(StatType.Dex, "MOD2", 25, TimeSpan.Zero);
                from.AddStatMod(m_StatMod0);
                from.AddStatMod(m_StatMod1);
                from.AddStatMod(m_StatMod2);
            }
            else
            {
                from.SendMessage("You lower the hood.");
                from.PlaySound(0x220);
                //from.Title = null;
                from.BodyMod           = 0x0;
                from.NameHue           = -1;
                from.HueMod            = -1;
                from.DisplayGuildTitle = true;
                this.Transformed       = false;
                ItemID = 0x1F03;
                from.RemoveItem(this);
                from.EquipItem(this);
                from.RemoveStatMod("MOD0");
                from.RemoveStatMod("MOD1");
                from.RemoveStatMod("MOD2");
            }
        }
Example #47
0
		private void SetMods( Mobile m )
		{
			m.AddStatMod( m_StatMod0 );
		}
Example #48
0
		public override void SpellEffect( Mobile target )
		{
			if ( target == Caster )
				return;

			target.SendMessage( "You breath in a noxious gas" );

			// Done primarly to draw aggro.
			SpellHelper.Damage( this, target, GetDamage( Caster, target, DamageSkill, 0.5 ), 0, 0, 100, 0, 0 );

			if ( target == null )
				return;

			int dc = 10 + (int)ScaleBySkill( Caster, DamageSkill );
			int debuff = (int)( ScaleBySkill( Caster, DamageSkill ) / 2 );
			debuff = -debuff;
			bool totalfail = true;

			StringBuilder sb = new StringBuilder();
			sb.Append( "You see " );
			sb.Append( target.Name );
			sb.Append( " suffer penalties to:" );

			if ( FullPower() )
				dc += 120;

			if ( !SavingThrow( target, DDSave.Will, dc ) )
			{
				Slow.SlowWalk( target, dc*2 );
				target.SendMessage( "You have been slowed" );
				sb.Append (" Speed" );
				totalfail = false;
			}

			if ( !SavingThrow( target, DDSave.Fort, dc ) )
			{
				target.AddSkillMod( new TimedSkillMod( SkillName.Tactics, true, debuff, TimeSpan.FromSeconds( dc*2 ) ) );
				target.AddStatMod( new StatMod( StatType.Str, "Bad Breath Str", debuff, TimeSpan.FromSeconds( dc*2 ) ) );
				target.AddStatMod( new StatMod( StatType.Dex, "Bad Breath Dex", debuff, TimeSpan.FromSeconds( dc*2 ) ) );
				target.AddStatMod( new StatMod( StatType.Int, "Bad Breath Int", debuff, TimeSpan.FromSeconds( dc*2 ) ) );
				sb.Append( " Tactics" );
				totalfail = false;

				if ( dc > 120 )
					target.AddSkillMod( new TimedSkillMod( SkillName.MagicResist, true, debuff, TimeSpan.FromSeconds( dc*2 ) ) );
			}

			if ( !SavingThrow( target, DDSave.Refl, dc ) )
			{
				ResistanceMod[] mods =
				{
					new ResistanceMod( ResistanceType.Physical, debuff ),
					new ResistanceMod( ResistanceType.Fire, debuff ),
					new ResistanceMod( ResistanceType.Cold, debuff ),
					new ResistanceMod( ResistanceType.Poison, debuff ),
					new ResistanceMod( ResistanceType.Energy, debuff )
				};

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

				TimedResistanceMod.AddMod( target, "Bad Breath", mods, TimeSpan.FromSeconds( Caster.Skills[DamageSkill].Value ) );
				sb.Append( " Resistance" );
				totalfail = false;
			}

			if ( dc > 120 )
			{
				target.ApplyPoison( Caster, Poison.Greater );
			}

			if ( totalfail )
				Caster.SendMessage( target.Name + " saved against your spell." );
			else
				Caster.SendMessage( sb.ToString() );
		}
Example #49
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
                m_OriginalHue = reader.ReadInt();
                int idx = reader.ReadInt();
                m_BaitType     = FishInfo.GetTypeFromIndex(idx);
                m_HookType     = (HookType)reader.ReadInt();
                m_HookUses     = reader.ReadInt();
                m_BaitUses     = reader.ReadInt();
                m_EnhancedBait = reader.ReadBool();

                SaveFlag flags = (SaveFlag)reader.ReadInt();

                if (GetSaveFlag(flags, SaveFlag.xAttributes))
                {
                    m_AosAttributes = new AosAttributes(this, reader);
                }
                else
                {
                    m_AosAttributes = new AosAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                }
                else
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this);
                }
                break;

            case 1:
                m_AosAttributes   = new AosAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
                break;
            }

            if (Core.AOS && Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
            }

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if (this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)this.Parent;

                string modName = this.Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }

            if (m_BaitType != null && m_BaitUses <= 0)
            {
                BaitType = null;
            }

            if (m_HookType != HookType.None && m_HookUses <= 0)
            {
                HookType = HookType.None;
            }
        }
Example #50
0
            public InternalTimer(Mobile owner, PolymorphEntry polymorphEntry)
                : base(TimeSpan.Zero)
            {
                m_Owner = owner;
                m_PolymorphEntry = polymorphEntry;

                double val = (owner.Skills[SkillName.Magery].Value) * 0.15;

                if (val > 120)
                    val = 120;

                Delay = TimeSpan.FromMinutes(val);
                Priority = TimerPriority.OneSecond;

                string modName = m_Owner.Serial + "Polymorph";

                PlayerMobile pm = ((PlayerMobile) m_Owner);

                foreach (Custom.Polymorph.StatMod sm in PolymorphEntry.EntryInfo[m_PolymorphEntry.ArtID].StatMods)
                {
                    switch (sm.Type)
                    {
                        case StatModType.Strength:
                            m_Owner.AddStatMod(new StatMod(StatType.Str, modName + "Str", sm.Value, TimeSpan.Zero));
                            break;
                        case StatModType.Dexterity:
                            m_Owner.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", sm.Value, TimeSpan.Zero));
                            break;
                        case StatModType.Intelligence:
                            m_Owner.AddStatMod(new StatMod(StatType.Int, modName + "Int", sm.Value, TimeSpan.Zero));
                            break;
                        case StatModType.Armor:
                            m_Owner.VirtualArmorMod = sm.Value;
                            break;
                        case StatModType.MinDamage:
                            if (pm != null)
                                pm.MinDamage = sm.Value;
                            break;
                        case StatModType.MaxDamage:
                            if (pm != null)
                                pm.MaxDamage = sm.Value;
                            break;
                        case StatModType.SwingSpeed:
                            if (pm != null)
                                pm.SwingSpeed = sm.Value;
                            break;
                        default:
                            break;
                    }
                }
            }
Example #51
0
		public override bool OnEquip( Mobile from )
		{
			from.CheckStatTimers();

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

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

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

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

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

			return base.OnEquip( from );
		}
Example #52
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
            {
                _VvVItem   = reader.ReadBool();
                _Owner     = reader.ReadMobile();
                _OwnerName = reader.ReadString();
                goto case 3;
            }

            case 3:
            case 2:
                IsArrowAmmo = reader.ReadBool();
                goto case 1;

            case 1:
            {
                if (version == 1)
                {
                    IsArrowAmmo = (Ammo == null || Ammo is Arrow);
                }
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                m_Resistances     = new AosElementAttributes(this, reader);
                goto case 0;
            }

            case 0:
            {
                if (version == 0)
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this);
                    m_Resistances     = new AosElementAttributes(this);
                }

                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                if (GetSaveFlag(flags, SaveFlag.Attributes))
                {
                    m_Attributes = new AosAttributes(this, reader);
                }
                else
                {
                    m_Attributes = new AosAttributes(this);
                }

                if (version < 3 && GetSaveFlag(flags, SaveFlag.LowerAmmoCost))
                {
                    m_Attributes.LowerAmmoCost = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.WeightReduction))
                {
                    m_WeightReduction = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.DamageIncrease))
                {
                    m_DamageIncrease = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Crafter))
                {
                    m_Crafter = reader.ReadMobile();
                }

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (ItemQuality)reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Capacity))
                {
                    m_Capacity = reader.ReadInt();
                }

                #region Mondain's Legacy Sets
                if (GetSaveFlag(flags, SaveFlag.SetPhysical))
                {
                    m_SetPhysicalBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetFire))
                {
                    m_SetFireBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetCold))
                {
                    m_SetColdBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetPoison))
                {
                    m_SetPoisonBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetEnergy))
                {
                    m_SetEnergyBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetAttributes))
                {
                    m_SetAttributes = new AosAttributes(this, reader);
                }
                else
                {
                    m_SetAttributes = new AosAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes))
                {
                    m_SetSkillBonuses = new AosSkillBonuses(this, reader);
                }
                else
                {
                    m_SetSkillBonuses = new AosSkillBonuses(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SetHue))
                {
                    m_SetHue = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.LastEquipped))
                {
                    m_LastEquipped = reader.ReadBool();
                }

                if (GetSaveFlag(flags, SaveFlag.SetEquipped))
                {
                    m_SetEquipped = reader.ReadBool();
                }

                if (GetSaveFlag(flags, SaveFlag.ElvesOnly))
                {
                    _ElvesOnly = reader.ReadBool();
                }
                #endregion

                break;
            }
            }

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

            if (Parent is Mobile mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = mobile;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
                ((Mobile)Parent).CheckStatTimers();
            }
        }
Example #53
0
        public static bool AddStatCurse(Mobile caster, Mobile target, StatType type, int curse, TimeSpan duration)
        {
            int offset = -curse;
            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 #54
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 8:
            {
                m_Identified = reader.ReadMobileList();

                goto case 7;
            }

            case 7:
            case 6:
            case 5:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                if (GetSaveFlag(flags, SaveFlag.Attributes))
                {
                    m_AosAttributes = new AosAttributes(this, reader);
                }
                else
                {
                    m_AosAttributes = new AosAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.ArmorAttributes))
                {
                    m_AosArmorAttributes = new AosArmorAttributes(this, reader);
                }
                else
                {
                    m_AosArmorAttributes = new AosArmorAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.PhysicalBonus))
                {
                    m_PhysicalBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.FireBonus))
                {
                    m_FireBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.ColdBonus))
                {
                    m_ColdBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.PoisonBonus))
                {
                    m_PoisonBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.EnergyBonus))
                {
                    m_EnergyBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Identified) && version < 7)
                {
                    reader.ReadBool();
                }
                //m_Identified = ( version >= 7 || reader.ReadBool() );

                if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
                {
                    m_MaxHitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.HitPoints))
                {
                    m_HitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Crafter))
                {
                    m_Crafter = reader.ReadMobile();
                }

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (CraftQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = CraftQuality.Regular;
                }

                if (version == 5 && m_Quality == CraftQuality.Low)
                {
                    m_Quality = CraftQuality.Regular;
                }

                if (GetSaveFlag(flags, SaveFlag.Durability))
                {
                    m_Durability = (DurabilityLevel)reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Protection))
                {
                    m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.BaseArmor))
                {
                    m_ArmorBase = reader.ReadEncodedInt();
                }
                else
                {
                    m_ArmorBase = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrBonus))
                {
                    m_StrBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexBonus))
                {
                    m_DexBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntBonus))
                {
                    m_IntBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrReq))
                {
                    m_StrReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexReq))
                {
                    m_DexReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntReq))
                {
                    m_IntReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.MedAllowance))
                {
                    m_Meditate = (AMA)reader.ReadEncodedInt();
                }
                else
                {
                    m_Meditate = (AMA)(-1);
                }

                if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                }

                if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
                {
                    m_PlayerConstructed = true;
                }

                break;
            }

            case 4:
            {
                m_AosAttributes      = new AosAttributes(this, reader);
                m_AosArmorAttributes = new AosArmorAttributes(this, reader);
                goto case 3;
            }

            case 3:
            {
                m_PhysicalBonus = reader.ReadInt();
                m_FireBonus     = reader.ReadInt();
                m_ColdBonus     = reader.ReadInt();
                m_PoisonBonus   = reader.ReadInt();
                m_EnergyBonus   = reader.ReadInt();
                goto case 2;
            }

            case 2:
            case 1:
            {
                /*m_Identified = */ reader.ReadBool();
                goto case 0;
            }

            case 0:
            {
                m_ArmorBase    = reader.ReadInt();
                m_MaxHitPoints = reader.ReadInt();
                m_HitPoints    = reader.ReadInt();
                m_Crafter      = reader.ReadMobile();
                m_Quality      = (CraftQuality)reader.ReadInt();
                m_Durability   = (DurabilityLevel)reader.ReadInt();
                m_Protection   = (ArmorProtectionLevel)reader.ReadInt();

                AMT mat = (AMT)reader.ReadInt();

                if (m_ArmorBase == RevertArmorBase)
                {
                    m_ArmorBase = -1;
                }

                /*m_BodyPos = (ArmorBodyType)*/ reader.ReadInt();

                if (version < 4)
                {
                    m_AosAttributes      = new AosAttributes(this);
                    m_AosArmorAttributes = new AosArmorAttributes(this);
                }

                if (version < 3 && m_Quality == CraftQuality.Exceptional)
                {
                    DistributeBonuses(6);
                }

                m_StrBonus = reader.ReadInt();
                m_DexBonus = reader.ReadInt();
                m_IntBonus = reader.ReadInt();
                m_StrReq   = reader.ReadInt();
                m_DexReq   = reader.ReadInt();
                m_IntReq   = reader.ReadInt();

                if (m_StrBonus == OldStrBonus)
                {
                    m_StrBonus = -1;
                }

                if (m_DexBonus == OldDexBonus)
                {
                    m_DexBonus = -1;
                }

                if (m_IntBonus == OldIntBonus)
                {
                    m_IntBonus = -1;
                }

                if (m_StrReq == OldStrReq)
                {
                    m_StrReq = -1;
                }

                if (m_DexReq == OldDexReq)
                {
                    m_DexReq = -1;
                }

                if (m_IntReq == OldIntReq)
                {
                    m_IntReq = -1;
                }

                m_Meditate = (AMA)reader.ReadInt();

                if (m_Meditate == OldMedAllowance)
                {
                    m_Meditate = (AMA)(-1);
                }

                if (m_MaxHitPoints == 0 && m_HitPoints == 0)
                {
                    m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
                }

                break;
            }
            }

            if (m_AosSkillBonuses == null)
            {
                m_AosSkillBonuses = new AosSkillBonuses(this);
            }

            if (Core.AOS && Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
            }

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

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }

            if (version < 7)
            {
                m_PlayerConstructed = true;                 // we don't know, so, assume it's crafted
            }
        }