コード例 #1
0
ファイル: AOS.cs プロジェクト: libcs/game.ultimaonline.io
        public void AddTo(Mobile m)
        {
            Remove();

            for (int i = 0; i < 5; ++i)
            {
                SkillName skill;
                double    bonus;

                if (!GetValues(i, out skill, out bonus))
                {
                    continue;
                }

                if (m_Mods == null)
                {
                    m_Mods = new List <SkillMod>();
                }

                SkillMod sk = new DefaultSkillMod(skill, true, bonus);
                sk.ObeyCap = true;
                m.AddSkillMod(sk);
                m_Mods.Add(sk);
            }
        }
コード例 #2
0
ファイル: NecromancerSet.cs プロジェクト: dpisanu/xrunuo
        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.Helm) as BaseArmor);
            ApplyBonus(m.FindItemOnLayer(Layer.InnerTorso) as BaseArmor);

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

            mods.Add(new AttributeMod(AosAttribute.LowerManaCost, 10));

            ApplyMods(m, mods);

            m_Bonus[m] = mods;

            // +10 necromancy (total)
            SkillMod skillmod = new DefaultSkillMod(SkillName.Necromancy, true, 10.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);
        }
コード例 #3
0
ファイル: PaladinSet.cs プロジェクト: Ravenwolfe/xrunuo
        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 ) );

            ApplyMods( m, mods );

            m_Bonus[m] = mods;

            // +10 chivalry (total)
            SkillMod skillmod = new DefaultSkillMod( SkillName.Chivalry, true, 10.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 );
        }
コード例 #4
0
        public static void ApplySkillLoss(Mobile mob)
        {
            SkillLossContext context;

            m_SkillLoss.TryGetValue(mob, out context);

            if (context == null)
            {
                context          = new SkillLossContext();
                m_SkillLoss[mob] = context;

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

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

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

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

                mob.AddStatMod(new StatMod(StatType.Str, "Ethics Penalty Str", -(int)(mob.RawStr * StatLossFactor), SkillLossPeriod));
                mob.AddStatMod(new StatMod(StatType.Dex, "Ethics Penalty Dex", -(int)(mob.RawDex * StatLossFactor), SkillLossPeriod));
                mob.AddStatMod(new StatMod(StatType.Int, "Ethics Penalty Int", -(int)(mob.RawInt * StatLossFactor), SkillLossPeriod));

                context.m_Timer = Timer.DelayCall <Mobile>(SkillLossPeriod, new TimerStateCallback <Mobile>(ClearSkillLoss_Callback), mob);
            }
        }
コード例 #5
0
        public static void ApplySkillLoss(Mobile mob)
        {
            if (InSkillLoss(mob))
            {
                return;
            }

            SkillLossContext context = new SkillLossContext();

            m_SkillLoss[mob] = context;

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

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

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

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

            context.m_Timer = Timer.DelayCall(SkillLossPeriod, new TimerStateCallback(ClearSkillLoss_Callback), mob);
        }
コード例 #6
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsLockedDown)
            {
                if (!from.InRange(this.Location, 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                //IHouse house = HousingHelper.FindHouseAt( from );
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071131);                       // Praying…

                    if (m_CooldownList.Contains(from))
                    {
                        from.SendLocalizedMessage(1071145);                           // In order to summon an undead again, you have to wait for at least 90 minutes.
                    }
                    else
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(
                                            delegate
                        {
                            // Add the skill mod
                            SkillMod mod = new DefaultSkillMod(SkillName.SpiritSpeak, true, 5.0);
                            mod.ObeyCap  = true;
                            from.AddSkillMod(mod);
                            m_Table[from] = new BonusContext(Timer.DelayCall(Duration, new TimerStateCallback <Mobile>(RemoveEffect), from), mod);

                            // Set the cooldown
                            m_CooldownList.Add(from);
                            Timer.DelayCall(Cooldown, new TimerCallback(delegate { m_CooldownList.Remove(from); }));

                            // Spawn our undead friend :)
                            SummonUndead(from);

                            from.SendLocalizedMessage(1071148);                                       // You feel a greater sense.
                        }));
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502436);                       // That is not accessible.
                }
            }
            else
            {
                from.SendLocalizedMessage(502692);                   // This must be in a house and be locked down to work.
            }
        }
コード例 #7
0
ファイル: EvilOmen.cs プロジェクト: alucardxlx/Casiopia
        public void Target(Mobile m)
        {
            if (!(m is BaseCreature || m is PlayerMobile))
            {
                Caster.SendLocalizedMessage(1060508);                   // You can't curse that.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Curses the target so that the next harmful event that affects them is magnified.
                 * Damage to the target's hit points is increased 25%,
                 * the poison level of the attack will be 1 higher
                 * and the Resist Magic skill of the target will be fixed on 50.
                 *
                 * The effect lasts for one harmful event only.
                 */

                if (m.Spell != null)
                {
                    m.Spell.OnCasterHurt();
                }

                m.Paralyzed = false;

                m.PlaySound(0xFC);
                m.FixedParticles(0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head);
                m.FixedParticles(0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head);

                if (!m_Table.ContainsKey(m))
                {
                    SkillMod mod = new DefaultSkillMod(SkillName.MagicResist, false, 50.0);

                    if (m.Skills[SkillName.MagicResist].Base > 50.0)
                    {
                        m.AddSkillMod(mod);
                    }

                    m_Table[m] = mod;
                }

                TimeSpan duration = TimeSpan.FromSeconds((Caster.Skills[SkillName.SpiritSpeak].Value / 12) + 1.0);

                Timer.DelayCall <Mobile>(duration, new TimerStateCallback <Mobile>(EffectExpire_Callback), m);

                HarmfulSpell(m);

                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EvilOmen, 1075647, 1075648, duration, m));
            }

            FinishSequence();
        }
コード例 #8
0
        public static void AddBonus(Mobile m)
        {
            if (_Table == null)
            {
                _Table = new Dictionary <Mobile, SkillMod>();
            }

            var mod = new DefaultSkillMod(SkillName.SpiritSpeak, true, 5.0);

            _Table[m] = mod;

            m.AddSkillMod(mod);
            AddToCooldown(m);

            Timer.DelayCall(TimeSpan.FromMinutes(Utility.RandomMinMax(5, 40)), ExpireBonus, new object[] { m, mod });
        }
コード例 #9
0
ファイル: EvilOmen.cs プロジェクト: suiy187/runuocustom
		public void Target( Mobile m )
		{
			if ( !(m is BaseCreature || m is PlayerMobile) )
			{
				Caster.SendLocalizedMessage( 1060508 ); // You can't curse that.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

				/* Curses the target so that the next harmful event that affects them is magnified.
				 * Damage to the target's hit points is increased 25%,
				 * the poison level of the attack will be 1 higher
				 * and the Resist Magic skill of the target will be fixed on 50.
				 * 
				 * The effect lasts for one harmful event only.
				 */

				if ( m.Spell != null )
					m.Spell.OnCasterHurt();

				m.PlaySound( 0xFC );
				m.FixedParticles( 0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head );
				m.FixedParticles( 0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head );

				if ( !m_Table.Contains( m ) )
				{
					SkillMod mod = new DefaultSkillMod( SkillName.MagicResist, false, 50.0 );

					if ( m.Skills[SkillName.MagicResist].Base > 50.0 )
						m.AddSkillMod( mod );

					m_Table[m] = mod;
				}

				TimeSpan duration = TimeSpan.FromSeconds( (Caster.Skills[SkillName.SpiritSpeak].Value / 12) + 1.0 );

				Timer.DelayCall( duration, new TimerStateCallback( EffectExpire_Callback ), m );

				HarmfulSpell( m );

                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EvilOmen, 1075647, 1075648, duration, m));

			}

			FinishSequence();
		}
コード例 #10
0
        public override void OnCast()
        {
            Caster.Hidden = true;
            if (Caster.CanBeginAction(typeof(RogueShadowSpell)))
            {
                Caster.BeginAction(typeof(RogueShadowSpell));
                DefaultSkillMod mod = new DefaultSkillMod(SkillName.Stealth, true, 50.0);
                m_Table.Add(Caster, mod);
                Caster.AddSkillMod(mod);

                new InternalTimer(Caster, DateTime.UtcNow.AddSeconds(15 * (Caster.Skills[DamageSkill].Base / 10))).Start();
            }
            else
            {
                Caster.SendMessage("You are already in the shadows!");
            }
        }
コード例 #11
0
        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
            { }
        }
コード例 #12
0
ファイル: 04.EvilOmen.cs プロジェクト: Zilmerx/Temrael2
        public void Target(Mobile m)
        {
            if (!(m is BaseCreature || m is PlayerMobile))
            {
                Caster.SendLocalizedMessage(1060508);                   // You can't curse that.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Curses the target so that the next harmful event that affects them is magnified.
                 * Damage to the target's hit points is increased 25%,
                 * the poison level of the attack will be 1 higher
                 * and the Resist Magic skill of the target will be fixed on 50.
                 *
                 * The effect lasts for one harmful event only.
                 */

                m.PlaySound(0xFC);
                Effects.SendTargetParticles(m, 0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head);
                Effects.SendTargetParticles(m, 0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head);

                if (!m_Table.Contains(m))
                {
                    SkillMod mod = new DefaultSkillMod(SkillName.Meditation, false, 50.0);

                    if (m.Skills[SkillName.Meditation].Base > 50.0)
                    {
                        m.AddSkillMod(mod);
                    }

                    m_Table[m] = mod;
                }

                double duration = 10.0;

                duration = SpellHelper.AdjustValue(Caster, duration);

                Timer.DelayCall(TimeSpan.FromSeconds(duration), new TimerStateCallback(EffectExpire_Callback), m);
            }

            FinishSequence();
        }
コード例 #13
0
ファイル: EvilOmen.cs プロジェクト: StoryOfTheBard/UOLegends
        public void Target(Mobile m)
        {
            if (!(m is BaseCreature || m is PlayerMobile))
            {
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Curses the target so that the next harmful event that affects them is magnified.
                 * Damage to the target's hit points is increased 25%,
                 * the poison level of the attack will be 1 higher
                 * and the Resist Magic skill of the target will be fixed on 50.
                 *
                 * The effect lasts for one harmful event only.
                 */

                m.PlaySound(0xFC);
                m.FixedParticles(0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head);
                m.FixedParticles(0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head);

                if (!m_Table.Contains(m))
                {
                    SkillMod mod = new DefaultSkillMod(SkillName.MagicResist, false, 50.0);

                    if (m.Skills[SkillName.MagicResist].Base > 50.0)
                    {
                        m.AddSkillMod(mod);
                    }

                    m_Table[m] = mod;
                }

                // TODO: Correct duration algorithm
                TimeSpan duration = TimeSpan.FromSeconds(3.5 + (3.5 * (Caster.Skills[SkillName.SpiritSpeak].Value / 100.0)));

                Timer.DelayCall(duration, new TimerStateCallback(EffectExpire_Callback), m);
            }

            FinishSequence();
        }
コード例 #14
0
ファイル: WoodworkersBench.cs プロジェクト: ygtkms/ServUO
        public static void AddBonus(Mobile m)
        {
            if (_Table == null)
            {
                _Table = new Dictionary <Mobile, Tuple <bool, DateTime, SkillMod> >();
            }

            DefaultSkillMod mod = new DefaultSkillMod(SkillName.Carpentry, true, 5.0);

            mod.ObeyCap = false;
            m.AddSkillMod(mod);

            _Table[m] = new Tuple <bool, DateTime, SkillMod>(true, DateTime.UtcNow, mod);

            if (_Timer == null)
            {
                _Timer          = Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), CheckTable);
                _Timer.Priority = TimerPriority.FiveSeconds;
                _Timer.Start();
            }
        }
コード例 #15
0
ファイル: AssassinSet.cs プロジェクト: Ravenwolfe/xrunuo
        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 );
        }
コード例 #16
0
ファイル: EvilOmen.cs プロジェクト: techy2493/ServUO
        public void ApplyEffects(Mobile m, double strength = 1.0)
        {
            /* Curses the target so that the next harmful event that affects them is magnified.
             * Damage to the target's hit points is increased 25%,
             * the poison level of the attack will be 1 higher
             * and the Resist Magic skill of the target will be fixed on 50.
             *
             * The effect lasts for one harmful event only.
             */

            if (m.Spell != null)
            {
                m.Spell.OnCasterHurt();
            }

            m.PlaySound(0xFC);
            m.FixedParticles(0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head);
            m.FixedParticles(0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head);

            if (!m_Table.Contains(m))
            {
                SkillMod mod = new DefaultSkillMod(SkillName.MagicResist, false, 50.0);

                if (m.Skills[SkillName.MagicResist].Base > 50.0)
                {
                    m.AddSkillMod(mod);
                }

                m_Table[m] = mod;
            }

            TimeSpan duration = TimeSpan.FromSeconds(((Caster.Skills[SkillName.SpiritSpeak].Value / 12) + 1.0) * strength);

            Timer.DelayCall(duration, new TimerStateCallback(EffectExpire_Callback), m);

            this.HarmfulSpell(m);

            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EvilOmen, 1075647, 1075648, duration, m));
        }
コード例 #17
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);
        }
コード例 #18
0
ファイル: ResurrectGump.cs プロジェクト: walshie1986/runuot2a
        public static void ApplySkillLoss(Mobile mob)
        {
            SkillLossContext context = (SkillLossContext)m_SkillLoss[mob];

            if (context != null)
            {
                return;
            }

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

            ArrayList mods = context.m_Mods = new ArrayList();

            int      ShortsLost      = mob.ShortTermMurders / 2;
            double   SkillLossFactor = Math.Min(ShortsLost * 0.01, 0.5);                    //1 percent per short. Max 50%.
            TimeSpan SkillLossPeriod = TimeSpan.FromMinutes(10 + Math.Min(50, ShortsLost)); //10 to 60 minutes.

            //mob.ShortTermMurders -= ShortsLost; //Lose half your shorts. Disable till title system set up.

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

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

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

            mob.SendMessage(String.Format("You have lost {0}% of your skill for {1} minutes for being a criminal.", (int)(SkillLossFactor * 100), 10 + Math.Min(50, ShortsLost)));

            context.m_Timer = Timer.DelayCall(SkillLossPeriod, new TimerStateCallback(ClearSkillLoss_Callback), mob);
        }
コード例 #19
0
            public InternalTimer(Mobile owner, int body, Souless m_Fake, AncientPeerSpell spell)
                : base(TimeSpan.FromSeconds(0))
            {
                m_Owner   = owner;
                m_OldBody = body;
                fake      = m_Fake;
                m_spell   = spell;

                int val = (int)owner.Skills[SkillName.Magery].Value;

                if (val > 100)
                {
                    val = 100;
                }
                double   loss2 = (0 - m_Owner.Skills[SkillName.Magery].Base);
                SkillMod sk2   = new DefaultSkillMod(SkillName.Magery, true, loss2);

                m_Owner.AddSkillMod(sk2);
                m_spell.m_PeerMod.Add(sk2);

                Delay    = TimeSpan.FromSeconds(val);
                Priority = TimerPriority.TwoFiftyMS;
            }
コード例 #20
0
ファイル: BaseWeapon.cs プロジェクト: greeduomacro/hubroot
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch( version )
            {
                case 11:
                case 10:
                case 9:
                case 8:
                    {
                        if( version <= 9 )
                        {
                            reader.ReadMobile();
                            reader.ReadString();
                            reader.ReadMobile();
                        }

                        goto case 7;
                    }
                case 7:
                case 6:
                case 5:
                    {
                        SaveFlag flags = (SaveFlag)reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.DamageLevel) )
                        {
                            m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

                            if( m_DamageLevel > WeaponDamageLevel.Vanq )
                                m_DamageLevel = WeaponDamageLevel.Ruin;
                        }

                        if( GetSaveFlag(flags, SaveFlag.AccuracyLevel) )
                        {
                            m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

                            if( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
                                m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                        }

                        if( GetSaveFlag(flags, SaveFlag.DurabilityLevel) )
                        {
                            m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

                            if( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
                                m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                        }

                        if( GetSaveFlag(flags, SaveFlag.Quality) )
                            m_Quality = (WeaponQuality)reader.ReadInt();
                        else
                            m_Quality = WeaponQuality.Regular;

                        if( GetSaveFlag(flags, SaveFlag.Hits) )
                            m_Hits = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.MaxHits) )
                            m_MaxHits = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Slayer) )
                            m_Slayer = (SlayerName)reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Poison) )
                            m_Poison = Poison.Deserialize(reader);

                        if( GetSaveFlag(flags, SaveFlag.PoisonCharges) )
                            m_PoisonCharges = reader.ReadInt();

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

                        if( GetSaveFlag(flags, SaveFlag.Identified) )
                        {
                            if( version <= 10 )
                                m_Identified = true;
                            else
                                m_Identified = reader.ReadBool();
                        }

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

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

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

                        if( GetSaveFlag(flags, SaveFlag.MinDamage) )
                            m_MinDamage = reader.ReadInt();
                        else
                            m_MinDamage = -1;

                        if( GetSaveFlag(flags, SaveFlag.MaxDamage) )
                            m_MaxDamage = reader.ReadInt();
                        else
                            m_MaxDamage = -1;

                        if( GetSaveFlag(flags, SaveFlag.HitSound) )
                            m_HitSound = reader.ReadInt();
                        else
                            m_HitSound = -1;

                        if( GetSaveFlag(flags, SaveFlag.MissSound) )
                            m_MissSound = reader.ReadInt();
                        else
                            m_MissSound = -1;

                        if( GetSaveFlag(flags, SaveFlag.Speed) )
                        {
                            if( version < 9 )
                                m_Speed = reader.ReadInt();
                            else
                                m_Speed = reader.ReadFloat();
                        }
                        else
                            m_Speed = -1;

                        if( GetSaveFlag(flags, SaveFlag.MaxRange) )
                            m_MaxRange = reader.ReadInt();
                        else
                            m_MaxRange = -1;

                        if( GetSaveFlag(flags, SaveFlag.Skill) )
                            m_Skill = (SkillName)reader.ReadInt();
                        else
                            m_Skill = (SkillName)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Type) )
                            m_Type = (WeaponType)reader.ReadInt();
                        else
                            m_Type = (WeaponType)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Animation) )
                            m_Animation = (WeaponAnimation)reader.ReadInt();
                        else
                            m_Animation = (WeaponAnimation)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Resource) )
                            m_Resource = (CraftResource)reader.ReadInt();
                        else
                            m_Resource = CraftResource.Iron;

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

                        if( GetSaveFlag(flags, SaveFlag.xWeaponAttributes) )
                            m_AosWeaponAttributes = new AosWeaponAttributes(this, reader);
                        else
                            m_AosWeaponAttributes = new AosWeaponAttributes(this);

                        if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                        {
                            m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
                            ((Mobile)Parent).AddSkillMod(m_SkillMod);
                        }

                        if( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                            m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                        if( Core.SE && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
                        {
                            m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
                            ((Mobile)Parent).AddSkillMod(m_MageMod);
                        }

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

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

                        if( GetSaveFlag(flags, SaveFlag.Slayer2) )
                            m_Slayer2 = (SlayerName)reader.ReadInt();

                        break;
                    }
                case 4:
                    {
                        m_Slayer = (SlayerName)reader.ReadInt();

                        goto case 3;
                    }
                case 3:
                    {
                        m_StrReq = reader.ReadInt();
                        m_DexReq = reader.ReadInt();
                        m_IntReq = reader.ReadInt();

                        goto case 2;
                    }
                case 2:
                    {
                        m_Identified = reader.ReadBool();

                        goto case 1;
                    }
                case 1:
                    {
                        m_MaxRange = reader.ReadInt();

                        goto case 0;
                    }
                case 0:
                    {
                        if( version == 0 )
                            m_MaxRange = 1; // default

                        if( version < 5 )
                        {
                            m_Resource = CraftResource.Iron;
                            m_AosAttributes = new AosAttributes(this);
                            m_AosWeaponAttributes = new AosWeaponAttributes(this);
                            m_AosSkillBonuses = new AosSkillBonuses(this);
                        }

                        m_MinDamage = reader.ReadInt();
                        m_MaxDamage = reader.ReadInt();

                        m_Speed = reader.ReadInt();

                        m_HitSound = reader.ReadInt();
                        m_MissSound = reader.ReadInt();

                        m_Skill = (SkillName)reader.ReadInt();
                        m_Type = (WeaponType)reader.ReadInt();
                        m_Animation = (WeaponAnimation)reader.ReadInt();
                        m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
                        m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
                        m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
                        m_Quality = (WeaponQuality)reader.ReadInt();

                        m_Crafter = reader.ReadMobile();

                        m_Poison = Poison.Deserialize(reader);
                        m_PoisonCharges = reader.ReadInt();

                        if( m_StrReq == OldStrengthReq )
                            m_StrReq = -1;

                        if( m_DexReq == OldDexterityReq )
                            m_DexReq = -1;

                        if( m_IntReq == OldIntelligenceReq )
                            m_IntReq = -1;

                        if( m_MinDamage == OldMinDamage )
                            m_MinDamage = -1;

                        if( m_MaxDamage == OldMaxDamage )
                            m_MaxDamage = -1;

                        if( m_HitSound == OldHitSound )
                            m_HitSound = -1;

                        if( m_MissSound == OldMissSound )
                            m_MissSound = -1;

                        if( m_Speed == OldSpeed )
                            m_Speed = -1;

                        if( m_MaxRange == OldMaxRange )
                            m_MaxRange = -1;

                        if( m_Skill == OldSkill )
                            m_Skill = (SkillName)(-1);

                        if( m_Type == OldType )
                            m_Type = (WeaponType)(-1);

                        if( m_Animation == OldAnimation )
                            m_Animation = (WeaponAnimation)(-1);

                        if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                        {
                            m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
                            ((Mobile)Parent).AddSkillMod(m_SkillMod);
                        }

                        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_Hits <= 0 && m_MaxHits <= 0 )
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
            }

            if( version < 6 )
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted
        }
コード例 #21
0
		public bool AddMods()
		{
			if ( Owner == null )
				return false;

			BonusNumber++;

			if ( BonusNumber > 5 )
				return false;

			// @100.0 Forensics bonus's value is 10.
			double bonus = (BlueSpell.ScaleBySkill( Owner, SkillName.Forensics ) / 2.0);
			StatMod stat = null;
			DefaultSkillMod skill = null;
			ResistanceMod resist = null;
			int intdiff = 0;
			double doublediff = 0.0;

			// Str (+10 @ GM)
			intdiff = (int)( m_StrCap - (Owner.RawStr + bonus) );

			if ( intdiff > 0 )
			{
				stat = new StatMod( StatType.Str, ("DragonForceStr" + BonusNumber.ToString()), intdiff, TimeSpan.FromHours( 24 ) );
				Owner.AddStatMod( stat );
				StatMods.Add( stat );
			}

			// Dex (+10 @ GM)
			intdiff = (int)( m_DexCap - (Owner.RawDex + bonus) );

			if ( intdiff > 0 )
			{
				stat = new StatMod( StatType.Dex, ("DragonForceDex" + BonusNumber.ToString()), intdiff, TimeSpan.FromHours( 24 ) );
				Owner.AddStatMod( stat );
				StatMods.Add( stat );
			}

			// Tactics (+5.0 @ GM)
			doublediff = m_TacticsCap - (Owner.Skills[SkillName.Tactics].Value + bonus);

			if ( doublediff > 0.0 )
			{
				skill = new DefaultSkillMod( SkillName.Tactics, true, (bonus / 2) );
				Owner.AddSkillMod( skill );
				SkillMods.Add( skill );
			}

			// Wrestling (+5.0 @ GM)
			doublediff = m_WrestlingCap - (Owner.Skills[SkillName.Tactics].Value + bonus);

			if ( doublediff > 0.0 )
			{
				skill = new DefaultSkillMod( SkillName.Wrestling, true, bonus );
				Owner.AddSkillMod( skill );
				SkillMods.Add( skill );
			}

			// Lose all Magic Resist in preparation of negative resistances.
			if ( Owner.Skills[SkillName.MagicResist].Value > 0 )
			{
				skill = new DefaultSkillMod( SkillName.MagicResist, true, -Owner.Skills[SkillName.MagicResist].Value );
				Owner.AddSkillMod( skill );
				SkillMods.Add( skill );
			}

			if ( !Status.Enabled )
			{
				// Lower Magery (-30 @ GM)
				if ( Owner.Skills[SkillName.Magery].Value > 0 )
				{
					skill = new DefaultSkillMod( SkillName.Magery, true, -(bonus * 3) );
					Owner.AddSkillMod( skill );
					SkillMods.Add( skill );
				}

				// Lower Necromancy (-30 @ GM)
				if ( Owner.Skills[SkillName.Necromancy].Value > 0 )
				{
					skill = new DefaultSkillMod( SkillName.Necromancy, true, -(bonus * 3) );
					Owner.AddSkillMod( skill );
					SkillMods.Add( skill );
				}

				// Lower Chivalry (-30 @ GM)
				if ( Owner.Skills[SkillName.Chivalry].Value > 0 )
				{
					skill = new DefaultSkillMod( SkillName.Chivalry, true, -(bonus * 3) );
					Owner.AddSkillMod( skill );
					SkillMods.Add( skill );
				}

				// Lower Bushido (-30 @ GM)
				if ( Owner.Skills[SkillName.Bushido].Value > 0 )
				{
					skill = new DefaultSkillMod( SkillName.Bushido, true, -(bonus * 3) );
					Owner.AddSkillMod( skill );
					SkillMods.Add( skill );
				}

				// Lower Ninjitsu (-30 @ GM)
				if ( Owner.Skills[SkillName.Ninjitsu].Value > 0 )
				{
					skill = new DefaultSkillMod( SkillName.Ninjitsu, true, -(bonus * 3) );
					Owner.AddSkillMod( skill );
					SkillMods.Add( skill );
				}

				// Lower Spellweaving (-30 @ GM)
				if ( Owner.Skills[SkillName.Spellweaving].Value > 0 )
				{
					skill = new DefaultSkillMod( SkillName.Spellweaving, true, -(bonus * 3) );
					Owner.AddSkillMod( skill );
					SkillMods.Add( skill );
				}

				// Lower Mysticism (-30 @ GM)
				if ( Owner.Skills[SkillName.Mysticism].Value > 0 )
				{
					skill = new DefaultSkillMod( SkillName.Mysticism, true, -(bonus * 3) );
					Owner.AddSkillMod( skill );
					SkillMods.Add( skill );
				}
			}

			// Physical (+5 @ GM)
			intdiff = m_PhysicalResistCap - (int)( Owner.PhysicalResistance + (bonus / 2) );
			
			if ( intdiff > 0 )
			{
				resist = new ResistanceMod( ResistanceType.Physical, intdiff );
				Owner.AddResistanceMod( resist );
				ResistMods.Add( resist );
			}

			// Fire (+10 @ GM)
			intdiff = m_FireResistCap - (int)( Owner.FireResistance + bonus );

			if ( intdiff > 0 )
			{
				resist = new ResistanceMod( ResistanceType.Fire, (int)(bonus) );
				Owner.AddResistanceMod( resist );
				ResistMods.Add( resist );
			}

			// Cold (-20 @ GM)
			resist = new ResistanceMod( ResistanceType.Cold, (int)(-(bonus * 2)) );
			Owner.AddResistanceMod( resist );
			ResistMods.Add( resist );

			// Energy (-10 @ GM)
			resist = new ResistanceMod( ResistanceType.Energy, (int)(-bonus) );
			Owner.AddResistanceMod( resist );
			ResistMods.Add( resist );

			return true;
		}
コード例 #22
0
        public bool AddMods()
        {
            if (Owner == null)
            {
                return(false);
            }

            BonusNumber++;

            if (BonusNumber > 5)
            {
                return(false);
            }

            // @100.0 Forensics bonus's value is 10.
            double          bonus      = (BlueSpell.ScaleBySkill(Owner, SkillName.Forensics) / 2.0);
            StatMod         stat       = null;
            DefaultSkillMod skill      = null;
            ResistanceMod   resist     = null;
            int             intdiff    = 0;
            double          doublediff = 0.0;

            // Str (+10 @ GM)
            intdiff = (int)(m_StrCap - (Owner.RawStr + bonus));

            if (intdiff > 0)
            {
                stat = new StatMod(StatType.Str, ("DragonForceStr" + BonusNumber.ToString()), intdiff, TimeSpan.FromHours(24));
                Owner.AddStatMod(stat);
                StatMods.Add(stat);
            }

            // Dex (+10 @ GM)
            intdiff = (int)(m_DexCap - (Owner.RawDex + bonus));

            if (intdiff > 0)
            {
                stat = new StatMod(StatType.Dex, ("DragonForceDex" + BonusNumber.ToString()), intdiff, TimeSpan.FromHours(24));
                Owner.AddStatMod(stat);
                StatMods.Add(stat);
            }

            // Tactics (+5.0 @ GM)
            doublediff = m_TacticsCap - (Owner.Skills[SkillName.Tactics].Value + bonus);

            if (doublediff > 0.0)
            {
                skill = new DefaultSkillMod(SkillName.Tactics, true, (bonus / 2));
                Owner.AddSkillMod(skill);
                SkillMods.Add(skill);
            }

            // Wrestling (+5.0 @ GM)
            doublediff = m_WrestlingCap - (Owner.Skills[SkillName.Tactics].Value + bonus);

            if (doublediff > 0.0)
            {
                skill = new DefaultSkillMod(SkillName.Wrestling, true, bonus);
                Owner.AddSkillMod(skill);
                SkillMods.Add(skill);
            }

            // Lose all Magic Resist in preparation of negative resistances.
            if (Owner.Skills[SkillName.MagicResist].Value > 0)
            {
                skill = new DefaultSkillMod(SkillName.MagicResist, true, -Owner.Skills[SkillName.MagicResist].Value);
                Owner.AddSkillMod(skill);
                SkillMods.Add(skill);
            }

            if (!Status.Enabled)
            {
                // Lower Magery (-30 @ GM)
                if (Owner.Skills[SkillName.Magery].Value > 0)
                {
                    skill = new DefaultSkillMod(SkillName.Magery, true, -(bonus * 3));
                    Owner.AddSkillMod(skill);
                    SkillMods.Add(skill);
                }

                // Lower Necromancy (-30 @ GM)
                if (Owner.Skills[SkillName.Necromancy].Value > 0)
                {
                    skill = new DefaultSkillMod(SkillName.Necromancy, true, -(bonus * 3));
                    Owner.AddSkillMod(skill);
                    SkillMods.Add(skill);
                }

                // Lower Chivalry (-30 @ GM)
                if (Owner.Skills[SkillName.Chivalry].Value > 0)
                {
                    skill = new DefaultSkillMod(SkillName.Chivalry, true, -(bonus * 3));
                    Owner.AddSkillMod(skill);
                    SkillMods.Add(skill);
                }

                // Lower Bushido (-30 @ GM)
                if (Owner.Skills[SkillName.Bushido].Value > 0)
                {
                    skill = new DefaultSkillMod(SkillName.Bushido, true, -(bonus * 3));
                    Owner.AddSkillMod(skill);
                    SkillMods.Add(skill);
                }

                // Lower Ninjitsu (-30 @ GM)
                if (Owner.Skills[SkillName.Ninjitsu].Value > 0)
                {
                    skill = new DefaultSkillMod(SkillName.Ninjitsu, true, -(bonus * 3));
                    Owner.AddSkillMod(skill);
                    SkillMods.Add(skill);
                }

                // Lower Spellweaving (-30 @ GM)
                if (Owner.Skills[SkillName.Spellweaving].Value > 0)
                {
                    skill = new DefaultSkillMod(SkillName.Spellweaving, true, -(bonus * 3));
                    Owner.AddSkillMod(skill);
                    SkillMods.Add(skill);
                }

                // Lower Mysticism (-30 @ GM)
                if (Owner.Skills[SkillName.Mysticism].Value > 0)
                {
                    skill = new DefaultSkillMod(SkillName.Mysticism, true, -(bonus * 3));
                    Owner.AddSkillMod(skill);
                    SkillMods.Add(skill);
                }
            }

            // Physical (+5 @ GM)
            intdiff = m_PhysicalResistCap - (int)(Owner.PhysicalResistance + (bonus / 2));

            if (intdiff > 0)
            {
                resist = new ResistanceMod(ResistanceType.Physical, intdiff);
                Owner.AddResistanceMod(resist);
                ResistMods.Add(resist);
            }

            // Fire (+10 @ GM)
            intdiff = m_FireResistCap - (int)(Owner.FireResistance + bonus);

            if (intdiff > 0)
            {
                resist = new ResistanceMod(ResistanceType.Fire, (int)(bonus));
                Owner.AddResistanceMod(resist);
                ResistMods.Add(resist);
            }

            // Cold (-20 @ GM)
            resist = new ResistanceMod(ResistanceType.Cold, (int)(-(bonus * 2)));
            Owner.AddResistanceMod(resist);
            ResistMods.Add(resist);

            // Energy (-10 @ GM)
            resist = new ResistanceMod(ResistanceType.Energy, (int)(-bonus));
            Owner.AddResistanceMod(resist);
            ResistMods.Add(resist);

            return(true);
        }
コード例 #23
0
ファイル: Faction.cs プロジェクト: jasegiffin/JustUO
        public static void ApplySkillLoss(Mobile mob)
        {
            if (InSkillLoss(mob))
                return;

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

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

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

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

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

            context.m_Timer = Timer.DelayCall(SkillLossPeriod, new TimerStateCallback(ClearSkillLoss_Callback), mob);
        }
コード例 #24
0
ファイル: BaseWeapon.cs プロジェクト: justdanofficial/khaeros
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 27:
                case 26: m_BetaNerf = reader.ReadBool(); goto case 25;
                case 25: m_Components = reader.ReadStrongItemList(); goto case 24;
                case 24: m_NewCrafting = reader.ReadBool(); m_QualityDefense = reader.ReadInt(); goto case 23;
                case 23: m_HasHalo = reader.ReadBool(); goto case 22;
                case 22:
                case 21:
                case 20:
                {
                    m_QualityDamage = reader.ReadInt();
                    m_QualitySpeed = reader.ReadInt();
                    m_QualityAccuracy = reader.ReadInt();
                    goto case 19;
                }
                case 19:
                case 18:
                case 17:
                case 16:
                case 15:
                case 14:
                case 13:
                case 12:
                case 11:
                case 10:
                {
                    m_CraftersOriginalName = reader.ReadString();
                    goto case 9;
                }
                case 9:
                {
                    m_Engraved1 = reader.ReadString();
                    m_Engraved2 = reader.ReadString();
                    m_Engraved3 = reader.ReadString();
                    goto case 5;
                }
                case 8:
                case 7:
                case 6:
                case 5:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
                    {
                        m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

                        if ( m_DamageLevel > WeaponDamageLevel.Vanq )
                            m_DamageLevel = WeaponDamageLevel.Ruin;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
                    {
                        m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

                        if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
                            m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
                    {
                        m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

                        if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
                            m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                        m_Quality = (WeaponQuality)reader.ReadInt();
                    else
                        m_Quality = WeaponQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.Hits ) )
                        m_Hits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
                        m_MaxHits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
                        m_Slayer = (SlayerName)reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Poison ) )
                        m_Poison = Poison.Deserialize( reader );

                    if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
                        m_PoisonCharges = reader.ReadInt();

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

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

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

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

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

                    if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
                        m_MinDamage = reader.ReadInt();
                    else
                        m_MinDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
                        m_MaxDamage = reader.ReadInt();
                    else
                        m_MaxDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
                        m_HitSound = reader.ReadInt();
                    else
                        m_HitSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
                        m_MissSound = reader.ReadInt();
                    else
                        m_MissSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Speed ) )
                        m_Speed = reader.ReadInt();
                    else
                        m_Speed = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
                        m_MaxRange = reader.ReadInt();
                    else
                        m_MaxRange = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Skill ) )
                        m_Skill = (SkillName)reader.ReadInt();
                    else
                        m_Skill = (SkillName)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Type ) )
                        m_Type = (WeaponType)reader.ReadInt();
                    else
                        m_Type = (WeaponType)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Animation ) )
                        m_Animation = (WeaponAnimation)reader.ReadInt();
                    else
                        m_Animation = (WeaponAnimation)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Resource ) )
                        m_Resource = (CraftResource)reader.ReadInt();
                    else
                        m_Resource = CraftResource.Iron;

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

                    if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
                        m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
                    else
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                        m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                    if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
                    {
                        m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
                        ((Mobile)Parent).AddSkillMod( m_MageMod );
                    }

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

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

                    if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
                        m_Slayer2 = (SlayerName)reader.ReadInt();

                    if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
                        m_AosElementDamages = new AosElementAttributes( this, reader );
                    else
                        m_AosElementDamages = new AosElementAttributes( this );

                    break;
                }
                case 4:
                {
                    m_Slayer = (SlayerName)reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_StrReq = reader.ReadInt();
                    m_DexReq = reader.ReadInt();
                    m_IntReq = reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_Identified = reader.ReadBool();

                    goto case 1;
                }
                case 1:
                {
                    m_MaxRange = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if ( version == 0 )
                        m_MaxRange = 1; // default

                    if ( version < 5 )
                    {
                        m_Resource = CraftResource.Iron;
                        m_AosAttributes = new AosAttributes( this );
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );
                        m_AosElementDamages = new AosElementAttributes( this );
                        m_AosSkillBonuses = new AosSkillBonuses( this );
                    }

                    m_MinDamage = reader.ReadInt();
                    m_MaxDamage = reader.ReadInt();

                    m_Speed = reader.ReadInt();

                    m_HitSound = reader.ReadInt();
                    m_MissSound = reader.ReadInt();

                    m_Skill = (SkillName)reader.ReadInt();
                    m_Type = (WeaponType)reader.ReadInt();
                    m_Animation = (WeaponAnimation)reader.ReadInt();
                    m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
                    m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
                    m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
                    m_Quality = (WeaponQuality)reader.ReadInt();

                    m_Crafter = reader.ReadMobile();

                    m_Poison = Poison.Deserialize( reader );
                    m_PoisonCharges = reader.ReadInt();

                    if ( m_StrReq == OldStrengthReq )
                        m_StrReq = -1;

                    if ( m_DexReq == OldDexterityReq )
                        m_DexReq = -1;

                    if ( m_IntReq == OldIntelligenceReq )
                        m_IntReq = -1;

                    if ( m_MinDamage == OldMinDamage )
                        m_MinDamage = -1;

                    if ( m_MaxDamage == OldMaxDamage )
                        m_MaxDamage = -1;

                    if ( m_HitSound == OldHitSound )
                        m_HitSound = -1;

                    if ( m_MissSound == OldMissSound )
                        m_MissSound = -1;

                    if ( m_Speed == OldSpeed )
                        m_Speed = -1;

                    if ( m_MaxRange == OldMaxRange )
                        m_MaxRange = -1;

                    if ( m_Skill == OldSkill )
                        m_Skill = (SkillName)(-1);

                    if ( m_Type == OldType )
                        m_Type = (WeaponType)(-1);

                    if ( m_Animation == OldAnimation )
                        m_Animation = (WeaponAnimation)(-1);

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    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_Hits <= 0 && m_MaxHits <= 0 )
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
            }

            if( version < 15 && this is IBoneArmour )
                this.Attributes.WeaponSpeed -= 4;

            if( version < 16 )
                FixResource();

            if( version < 17 )
            {
                this.m_Speed = -1;
                this.m_MinDamage = -1;
                this.m_MaxDamage = -1;

                if( this.Hue == 2413 )
                    this.Resource = CraftResource.Copper;

                if( this.Hue == 2418 )
                    this.Resource = CraftResource.Bronze;
            }

            if( version < 18 )
                this.DurabilityLevel = WeaponDurabilityLevel.Regular;

            if( version < 19 )
            {
                if( this.HitPoints > 175 )
                    this.HitPoints = 175;

                if( this.MaxHitPoints > 175 )
                    this.MaxHitPoints = 175;
            }

            if( version < 20 )
                FixBonuses();

            if( version < 21 )
            {
                if( this is IBoneArmour )
                    Hue = 0;

                else
                    Hue = CraftResources.GetHue( this.Resource );
            }

            if( version < 22 )
            {
                Speed = -1;
                MinDamage = -1;
                MaxDamage = -1;
            }

            if ( version == 26 )
                BetaNerf = false;
        }
コード例 #25
0
ファイル: BaseWeapon.cs プロジェクト: greeduomacro/divinity
        public override bool OnEquip( Mobile from )
        {
            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            BaseWeapon oldWeapon = from.Weapon as BaseWeapon;

            if ( (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = from;

                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 ) );
            }

            TimeSpan oldDelay = oldWeapon.GetDelay(from);
            if ( from.NextCombatTime >= (DateTime.MinValue+oldDelay) && oldWeapon != null )
                from.NextCombatTime -= oldDelay; // forget the delay for their old weapon
            from.NextCombatTime += GetDelay( from ); // use the delay for their new weapon (this weapon)

            if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular )
            {
                if ( m_SkillMod != null )
                    m_SkillMod.Remove();

                m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                from.AddSkillMod( m_SkillMod );
            }

            if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 )
            {
                if ( m_MageMod != null )
                    m_MageMod.Remove();

                m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
                from.AddSkillMod( m_MageMod );
            }

            return true;
        }
コード例 #26
0
ファイル: BaseWeapon.cs プロジェクト: FreeReign/imaginenation
        public override bool OnEquip( Mobile from )
		{
            if (Amount > 1)
            {
                from.SendAsciiMessage("You can only equip one weapon at a time");
                return false;
            }

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

			if ( (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
			{
				Mobile m = from;

				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 ) );
			}

            //Maka
            if (from is PlayerMobile)
                (from as PlayerMobile).WeaponTimerCheck();

            if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular )
			{
				if ( m_SkillMod != null )
					m_SkillMod.Remove();

				m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 3 );
				from.AddSkillMod( m_SkillMod );
			}

			if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 )
			{
				if ( m_MageMod != null )
					m_MageMod.Remove();

				m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
				from.AddSkillMod( m_MageMod );
			}

			return true;
		}
コード例 #27
0
ファイル: BaseWeapon.cs プロジェクト: justdanofficial/khaeros
        public override bool OnEquip( Mobile from )
        {
            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if ( (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = from;

                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 ) );
            }

            from.NextCombatTime = DateTime.Now + GetDelay( from );

            if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular )
            {
                if ( m_SkillMod != null )
                    m_SkillMod.Remove();

                m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                from.AddSkillMod( m_SkillMod );
            }

            if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 )
            {
                if ( m_MageMod != null )
                    m_MageMod.Remove();

                m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
                from.AddSkillMod( m_MageMod );
            }

            if( from is PlayerMobile )
            {
                PlayerMobile attacker = from as PlayerMobile;

                if( attacker.HealingTimer != null )
                {
                    attacker.SendMessage( "You have stopped your attempt to heal someone." );
                    attacker.HealingTimer.Stop();
                    attacker.HealingTimer = null;
                }
            }

            return true;
        }
コード例 #28
0
        public override void OnDoubleClick(Mobile mob)
        {
            SkillGainContext context = (SkillGainContext)m_SkillGain[mob];

            if (context != null)
            {
                return;
            }

            context          = new SkillGainContext();
            m_SkillGain[mob] = context;

            ArrayList mods = context.m_Mods = new ArrayList();

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

                if (mob.InRange(this.GetWorldLocation(), 2))
                {
                    Container pack     = mob.Backpack;
                    int       m_Amount = mob.Backpack.GetAmount(typeof(BabyPowder));

                    if (pack != null && pack.ConsumeTotal(typeof(BabyPowder), m_Amount))
                    {
                        if (m_Amount != 1)
                        {
                            mob.AddToBackpack(new BabyPowder(m_Amount - 1));
                        }


                        if (baseValue > 0)
                        {
                            SkillMod mod  = new DefaultSkillMod(SkillName.Fencing, true, +(baseValue * SkillGainFactor));
                            SkillMod mod1 = new DefaultSkillMod(SkillName.Parry, true, +(baseValue * SkillGainFactor));
                            SkillMod mod2 = new DefaultSkillMod(SkillName.Swords, true, +(baseValue * SkillGainFactor));
                            SkillMod mod3 = new DefaultSkillMod(SkillName.Archery, true, +(baseValue * SkillGainFactor));
                            SkillMod mod4 = new DefaultSkillMod(SkillName.Macing, true, +(baseValue * SkillGainFactor));
                            SkillMod mod5 = new DefaultSkillMod(SkillName.Tactics, true, +(baseValue * SkillGainFactor));
                            SkillMod mod6 = new DefaultSkillMod(SkillName.Wrestling, true, +(baseValue * SkillGainFactor));

                            mods.Add(mod);
                            mods.Add(mod1);
                            mods.Add(mod2);
                            mods.Add(mod3);
                            mods.Add(mod4);
                            mods.Add(mod5);
                            mods.Add(mod6);
                            mob.AddSkillMod(mod);
                            mob.AddSkillMod(mod1);
                            mob.AddSkillMod(mod2);
                            mob.AddSkillMod(mod3);
                            mob.AddSkillMod(mod4);
                            mob.AddSkillMod(mod5);
                            mob.AddSkillMod(mod6);

                            mob.SendMessage("You sprinkle some baby powder on your body and it makes your skin more resistant in combat.");
                        }
                        else
                        {
                            mob.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                        }
                    }
                }
            }

            context.m_Timer = Timer.DelayCall(SkillGainPeriod, new TimerStateCallback(ClearSkillGain_Callback), mob);
        }
コード例 #29
0
		public override bool OnEquip( Mobile from )
		{
			int strBonus = m_AosAttributes.BonusStr;
			int dexBonus = m_AosAttributes.BonusDex;
			int intBonus = m_AosAttributes.BonusInt;

			if ( (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
			{
				Mobile m = from;

				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 ) );
			}

			from.NextCombatTime = DateTime.Now + GetDelay( from );

			if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular )
			{
				if ( m_SkillMod != null )
					m_SkillMod.Remove();

				m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
				from.AddSkillMod( m_SkillMod );
			}

			if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 )
			{
				if ( m_MageMod != null )
					m_MageMod.Remove();

				m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
				from.AddSkillMod( m_MageMod );
			}

				// XmlAttachment check for OnEquip
	Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, from);

	return true;
		}
コード例 #30
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                try
                {
                    BaseCreature creature = (BaseCreature)Activator.CreateInstance(m_Types[Utility.Random(m_Types.Length)]);

                    creature.RangePerception = 100;
                    creature.ControlSlots    = 5;

                    int amount1 = 2 * (int)(Caster.Skills[SkillName.EvalInt].Value / 25);

                    creature.RawStr += (Caster.RawInt) * amount1;
                    creature.RawDex += (Caster.RawInt) * amount1;
                    creature.RawInt += (Caster.RawInt) * amount1;

                    creature.Hits += (Caster.RawInt) * amount1;
                    creature.Stam += (Caster.RawInt) * amount1;
                    creature.Mana += (Caster.RawInt) * amount1;

                    int amount2 = 1 + (int)(Caster.Skills[SkillName.EvalInt].Value / 25);

                    creature.DamageMin += (Caster.FollowersMax) * amount2;
                    creature.DamageMax += (Caster.FollowersMax) * amount2;

                    int amount3 = 3 * (int)(Caster.Skills[SkillName.MagicResist].Value / 5);

                    ResistanceMod mod1 = new ResistanceMod(ResistanceType.Physical, +amount3);
                    ResistanceMod mod2 = new ResistanceMod(ResistanceType.Fire, +amount3);
                    ResistanceMod mod3 = new ResistanceMod(ResistanceType.Cold, +amount3);
                    ResistanceMod mod4 = new ResistanceMod(ResistanceType.Poison, +amount3);
                    ResistanceMod mod5 = new ResistanceMod(ResistanceType.Energy, +amount3);

                    int amount4 = 5 * (int)(Caster.Skills[SkillName.Inscribe].Value / 5);

                    SkillMod mod6 = new DefaultSkillMod(SkillName.Anatomy, true, +amount4);
                    SkillMod mod7 = new DefaultSkillMod(SkillName.MagicResist, true, +amount4);
                    SkillMod mod8 = new DefaultSkillMod(SkillName.Tactics, true, +amount4);
                    SkillMod mod9 = new DefaultSkillMod(SkillName.Wrestling, true, +amount4);

                    creature.AddResistanceMod(mod1);
                    creature.AddResistanceMod(mod2);
                    creature.AddResistanceMod(mod3);
                    creature.AddResistanceMod(mod4);
                    creature.AddResistanceMod(mod5);

                    creature.AddSkillMod(mod6);
                    creature.AddSkillMod(mod7);
                    creature.AddSkillMod(mod8);
                    creature.AddSkillMod(mod9);

                    TimeSpan duration;

                    duration = TimeSpan.FromHours(1.0);

                    SpellHelper.Summon(creature, Caster, 0x215, duration, false, false);
                }
                catch
                {
                }
            }

            FinishSequence();
        }
コード例 #31
0
ファイル: AnimalForm.cs プロジェクト: greeduomacro/vivre-uo
		public static MorphResult Morph(Mobile m, int entryID)
		{
			if (entryID < 0 || entryID >= m_Entries.Length)
				return MorphResult.Fail;

			AnimalFormEntry entry = m_Entries[entryID];

			m_LastAnimalForms[m] = entryID;	//On OSI, it's the last /attempted/ one not the last succeeded one

			if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
			{
				string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
				m.SendLocalizedMessage(1063013, args); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
				return MorphResult.NoSkill;
			}

			/*
			if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) )
				return MorphResult.Fail;
			 *
			 * On OSI,it seems you can only gain starting at '0' using Animal form.
			*/

			double ninjitsu = m.Skills.Ninjitsu.Value;

			if (ninjitsu < entry.ReqSkill + 37.5)
			{
				double chance = (ninjitsu - entry.ReqSkill) / 37.5;

				if (chance < Utility.RandomDouble())
					return MorphResult.Fail;
			}

			m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5);

            if (!BaseFormTalisman.EntryEnabled(m, entry.Type))
                return MorphResult.Success; // Still consumes mana, just no effect

            BaseMount.Dismount(m);

            int bodyMod = entry.BodyMod;
            int hueMod = entry.HueMod;
            string namemod = entry.NameMod;

            m.BodyMod = bodyMod;
            m.HueMod = hueMod;
            m.NameMod = namemod; //Vinds : animal form anonymise, après tout, c'est pour les métiers de l'ombre

            if (entry.SpeedBoost)  
                m.Send(SpeedControl.MountSpeed);


			SkillMod mod = null;

			if (entry.StealthBonus)
			{
				mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
				mod.ObeyCap = true;
				m.AddSkillMod(mod);
			}

			SkillMod stealingMod = null;

			if (entry.StealingBonus)
			{
				stealingMod = new DefaultSkillMod(SkillName.Stealing, true, 10.0);
				stealingMod.ObeyCap = true;
				m.AddSkillMod(stealingMod);
			}

            Timer timer = new AnimalFormTimer(m, bodyMod, hueMod);
			timer.Start();

			AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type, stealingMod));
			m.CheckStatTimers();
			return MorphResult.Success;
		}
コード例 #32
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
                case 12:
                    {
                        #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_DImodded = reader.ReadBool();
                        m_SearingWeapon = reader.ReadBool();
                        goto case 11;
                    }
				case 11:
					{
						m_TimesImbued = reader.ReadInt();
                        #endregion

                        goto case 10;
					}
				case 10:
					{
						m_BlessedBy = reader.ReadMobile();
						m_EngravedText = reader.ReadString();
						m_Slayer3 = (TalismanSlayerName)reader.ReadInt();

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

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

						if (GetSaveFlag(flags, SetFlag.WeaponAttributes))
						{
							m_SetSelfRepair = (new AosWeaponAttributes(this, reader)).SelfRepair;
						}

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

						if (GetSaveFlag(flags, SetFlag.Hue))
						{
							m_SetHue = reader.ReadInt();
						}

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

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

						if (GetSaveFlag(flags, SetFlag.SetSelfRepair))
						{
							m_SetSelfRepair = reader.ReadEncodedInt();
						}

						goto case 5;
					}
				case 9:
				case 8:
				case 7:
				case 6:
				case 5:
					{
						SaveFlag flags = (SaveFlag)reader.ReadInt();

						if (GetSaveFlag(flags, SaveFlag.DamageLevel))
						{
							m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

							if (m_DamageLevel > WeaponDamageLevel.Vanq)
							{
								m_DamageLevel = WeaponDamageLevel.Ruin;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.AccuracyLevel))
						{
							m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

							if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely)
							{
								m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.DurabilityLevel))
						{
							m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

							if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible)
							{
								m_DurabilityLevel = WeaponDurabilityLevel.Durable;
							}
						}

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

						if (GetSaveFlag(flags, SaveFlag.Hits))
						{
							m_Hits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.MaxHits))
						{
							m_MaxHits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Slayer))
						{
							m_Slayer = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Poison))
						{
							m_Poison = Poison.Deserialize(reader);
						}

						if (GetSaveFlag(flags, SaveFlag.PoisonCharges))
						{
							m_PoisonCharges = reader.ReadInt();
						}

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

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

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

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

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

						if (GetSaveFlag(flags, SaveFlag.MinDamage))
						{
							m_MinDamage = reader.ReadInt();
						}
						else
						{
							m_MinDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxDamage))
						{
							m_MaxDamage = reader.ReadInt();
						}
						else
						{
							m_MaxDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.HitSound))
						{
							m_HitSound = reader.ReadInt();
						}
						else
						{
							m_HitSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MissSound))
						{
							m_MissSound = reader.ReadInt();
						}
						else
						{
							m_MissSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Speed))
						{
							if (version < 9)
							{
								m_Speed = reader.ReadInt();
							}
							else
							{
								m_Speed = reader.ReadFloat();
							}
						}
						else
						{
							m_Speed = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxRange))
						{
							m_MaxRange = reader.ReadInt();
						}
						else
						{
							m_MaxRange = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Skill))
						{
							m_Skill = (SkillName)reader.ReadInt();
						}
						else
						{
							m_Skill = (SkillName)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Type))
						{
							m_Type = (WeaponType)reader.ReadInt();
						}
						else
						{
							m_Type = (WeaponType)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Animation))
						{
							m_Animation = (WeaponAnimation)reader.ReadInt();
						}
						else
						{
							m_Animation = (WeaponAnimation)(-1);
						}

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

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

						if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes))
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this, reader);
						}
						else
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						if (version < 7 && m_AosWeaponAttributes.MageWeapon != 0)
						{
							m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;
						}

						if (Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 &&
							Parent is Mobile)
						{
							m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
							((Mobile)Parent).AddSkillMod(m_MageMod);
						}

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

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

						if (GetSaveFlag(flags, SaveFlag.Slayer2))
						{
							m_Slayer2 = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.ElementalDamages))
						{
							m_AosElementDamages = new AosElementAttributes(this, reader);
						}
						else
						{
							m_AosElementDamages = new AosElementAttributes(this);
						}

						if (GetSaveFlag(flags, SaveFlag.EngravedText))
						{
							m_EngravedText = reader.ReadString();
						}

						#region Stygian Abyss
						if (version > 9 && GetSaveFlag(flags, SaveFlag.xAbsorptionAttributes))
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
						}
						else
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
						}
						#endregion

						break;
					}
				case 4:
					{
						m_Slayer = (SlayerName)reader.ReadInt();

						goto case 3;
					}
				case 3:
					{
						m_StrReq = reader.ReadInt();
						m_DexReq = reader.ReadInt();
						m_IntReq = reader.ReadInt();

						goto case 2;
					}
				case 2:
					{
						m_Identified = reader.ReadBool();

						goto case 1;
					}
				case 1:
					{
						m_MaxRange = reader.ReadInt();

						goto case 0;
					}
				case 0:
					{
						if (version == 0)
						{
							m_MaxRange = 1; // default
						}

						if (version < 5)
						{
							m_Resource = CraftResource.Iron;
							m_AosAttributes = new AosAttributes(this);
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
							m_AosElementDamages = new AosElementAttributes(this);
							m_AosSkillBonuses = new AosSkillBonuses(this);
						}

						m_MinDamage = reader.ReadInt();
						m_MaxDamage = reader.ReadInt();

						m_Speed = reader.ReadInt();

						m_HitSound = reader.ReadInt();
						m_MissSound = reader.ReadInt();

						m_Skill = (SkillName)reader.ReadInt();
						m_Type = (WeaponType)reader.ReadInt();
						m_Animation = (WeaponAnimation)reader.ReadInt();
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
						m_Quality = (WeaponQuality)reader.ReadInt();

						m_Crafter = reader.ReadMobile();

						m_Poison = Poison.Deserialize(reader);
						m_PoisonCharges = reader.ReadInt();

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

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

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

						if (m_MinDamage == OldMinDamage)
						{
							m_MinDamage = -1;
						}

						if (m_MaxDamage == OldMaxDamage)
						{
							m_MaxDamage = -1;
						}

						if (m_HitSound == OldHitSound)
						{
							m_HitSound = -1;
						}

						if (m_MissSound == OldMissSound)
						{
							m_MissSound = -1;
						}

						if (m_Speed == OldSpeed)
						{
							m_Speed = -1;
						}

						if (m_MaxRange == OldMaxRange)
						{
							m_MaxRange = -1;
						}

						if (m_Skill == OldSkill)
						{
							m_Skill = (SkillName)(-1);
						}

						if (m_Type == OldType)
						{
							m_Type = (WeaponType)(-1);
						}

						if (m_Animation == OldAnimation)
						{
							m_Animation = (WeaponAnimation)(-1);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						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 (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();
			}

			if (m_Hits <= 0 && m_MaxHits <= 0)
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
			}

			if (version < 6)
			{
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
			}
		}
コード例 #33
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             //On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);
                // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            /*
             * if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) )
             * return MorphResult.Fail;
             *
             * On OSI,it seems you can only gain starting at '0' using Animal form.
             */

            double ninjitsu = m.Skills.Ninjitsu.Value;

            if (ninjitsu < entry.ReqSkill + 37.5)
            {
                double chance = (ninjitsu - entry.ReqSkill) / 37.5;

                if (chance < Utility.RandomDouble())
                {
                    return(MorphResult.Fail);
                }
            }

            m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5);

            if (!BaseFormTalisman.EntryEnabled(m, entry.Type))
            {
                return(MorphResult.Success);                // Still consumes mana, just no effect
            }

            BaseMount.Dismount(m);

            int bodyMod = entry.BodyMod;
            int hueMod  = entry.HueMod;

            m.BodyMod = bodyMod;
            m.HueMod  = hueMod;

            if (entry.SpeedBoost)
            {
                m.Send(SpeedControl.MountSpeed);
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            SkillMod stealingMod = null;

            if (entry.StealingBonus)
            {
                stealingMod         = new DefaultSkillMod(SkillName.Stealing, true, 10.0);
                stealingMod.ObeyCap = true;
                m.AddSkillMod(stealingMod);
            }

            Timer timer = new AnimalFormTimer(m, bodyMod, hueMod);

            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type, stealingMod));
            return(MorphResult.Success);
        }
コード例 #34
0
        public static void ApplySkillLoss(Mobile mob)
        {
            PlayerMobile Killer = mob as PlayerMobile;

            if (mob.ShortTermMurders >= 5 && Killer.MurderBounty <= 0)
            {
                double loss = (100.0 - (19.0 + (mob.ShortTermMurders / 5.0))) / 100.0;                 // 20 to 30% loss

                if (loss < 0.75)
                {
                    loss = 0.60;                    // changed to .80 from .95
                }
                else if (loss > 0.95)
                {
                    loss = 0.60;                     // changed to .80 from /95
                }
                TimeSpan lossperiod = TimeSpan.FromMinutes(240.0);

                loss = 1.0 - loss;

                ClearSkillLoss(mob);

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

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

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

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

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

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

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

                int m = (int)Math.Round(timeloss);
                mob.SendMessage("You have entered a bounty statloss for: " + m + " minutes.");

                loss = 1.0 - loss;

                ClearSkillLoss(mob);

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

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

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

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

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

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

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

                Killer.MurderBounty = 0;

                int m = (int)Math.Round(timeloss + 240.0);
                mob.SendMessage("You have entered statloss for: " + m + " minutes.");

                loss = 1.0 - loss;

                ClearSkillLoss(mob);

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

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

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

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

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

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

                context.m_Timer = Timer.DelayCall <Mobile>(lossperiod, new TimerStateCallback <Mobile>(ClearSkillLoss_Callback), mob);
            }
        }
コード例 #35
0
		public override bool OnEquip(Mobile from)
		{
			int strBonus = m_AosAttributes.BonusStr;
			int dexBonus = m_AosAttributes.BonusDex;
			int intBonus = m_AosAttributes.BonusInt;

			if ((strBonus != 0 || dexBonus != 0 || intBonus != 0))
			{
				Mobile m = from;

				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));
				}
			}

			from.NextCombatTime = Core.TickCount + (int)GetDelay(from).TotalMilliseconds;

			if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular)
			{
				if (m_SkillMod != null)
				{
					m_SkillMod.Remove();
				}

				m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
				from.AddSkillMod(m_SkillMod);
			}

			if (Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30)
			{
				if (m_MageMod != null)
				{
					m_MageMod.Remove();
				}

				m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
				from.AddSkillMod(m_MageMod);
			}

			XmlAttach.CheckOnEquip(this, from);

			return true;
		}
コード例 #36
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             // On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);                   // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            double minSkill = entry.ReqSkill - 12.5;
            double maxSkill = entry.ReqSkill + 37.5;

            if (!m.CheckSkill(SkillName.Ninjitsu, minSkill, maxSkill))
            {
                return(MorphResult.Fail);
            }

            BaseMount.Dismount(m);

            m.BodyMod = entry.BodyMod;

            if (entry.HueMod >= 0)
            {
                m.HueMod = entry.HueMod;
            }

            if (entry.SpeedBoost)
            {
                m.ForcedRun = true;
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            #region Heritage Items

            /*
             * else if ( entry.StealingBonus )
             * {
             *      mod = new DefaultSkillMod( SkillName.Stealing, true, 10.0 );
             *      mod.ObeyCap = true;
             *      m.AddSkillMod( mod );
             * }
             */
            #endregion

            Timer timer = new AnimalFormTimer(m, entry.BodyMod, m.HueMod);
            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type));

            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x7F3);

            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.AnimalForm, 1075822, 1075823, String.Format("{0}\t{1}", entry.ArticleCliloc, entry.FormCliloc)));

            m.Target = null;

            return(MorphResult.Success);
        }
コード例 #37
0
		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
			{ }
		}
コード例 #38
0
ファイル: Faction.cs プロジェクト: greeduomacro/UO-Forever
		public static void ApplySkillLoss(Mobile mob)
		{
			SkillLossContext context;

			if (!m_SkillLoss.TryGetValue(mob, out context))
			{
				m_SkillLoss.Add(mob, context = new SkillLossContext());
			}
			else if (context == null)
			{
				m_SkillLoss[mob] = context = new SkillLossContext();
			}
			else
			{
				return;
			}

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

			foreach (Skill sk in mob.Skills)
			{
				double baseValue = sk.Base;

				if (baseValue <= 0)
				{
					continue;
				}

				SkillMod mod = new DefaultSkillMod(sk.SkillName, true, -(baseValue * SkillLossFactor));

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

			//PlayerState ps = PlayerState.Find( mob );

		    context.m_Timer = Timer.DelayCall(SkillLossPeriod, ClearSkillLoss_Callback, mob);
		}
コード例 #39
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

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

					if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
					{
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

						if ( m_DamageLevel > WeaponDamageLevel.Vanq )
							m_DamageLevel = WeaponDamageLevel.Ruin;
					}

					if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
					{
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

						if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
							m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
					}

					if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
					{
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

						if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
							m_DurabilityLevel = WeaponDurabilityLevel.Durable;
					}

					if ( GetSaveFlag( flags, SaveFlag.Quality ) )
						m_Quality = (WeaponQuality)reader.ReadInt();
					else
						m_Quality = WeaponQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Hits ) )
						m_Hits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
						m_MaxHits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (SlayerName)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Poison ) )
						m_Poison = Poison.Deserialize( reader );

					if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
						m_PoisonCharges = reader.ReadInt();

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

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

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

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

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

					if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
						m_MinDamage = reader.ReadInt();
					else
						m_MinDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
						m_MaxDamage = reader.ReadInt();
					else
						m_MaxDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
						m_HitSound = reader.ReadInt();
					else
						m_HitSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
						m_MissSound = reader.ReadInt();
					else
						m_MissSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.Speed ) )
						m_Speed = reader.ReadInt();
					else
						m_Speed = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
						m_MaxRange = reader.ReadInt();
					else
						m_MaxRange = -1;

					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName)reader.ReadInt();
					else
						m_Skill = (SkillName)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Type ) )
						m_Type = (WeaponType)reader.ReadInt();
					else
						m_Type = (WeaponType)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Animation ) )
						m_Animation = (WeaponAnimation)reader.ReadInt();
					else
						m_Animation = (WeaponAnimation)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Resource ) )
						m_Resource = (CraftResource)reader.ReadInt();
					else
						m_Resource = CraftResource.Iron;

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

					if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
						m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
					else
						m_AosWeaponAttributes = new AosWeaponAttributes( this );

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
						m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

					if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
					{
						m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
						((Mobile)Parent).AddSkillMod( m_MageMod );
					}

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

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

                    // mod to randomly add sockets and socketability features to weapons. These settings will yield
                    // 2% drop rate of socketed/socketable items
                    // 0.1% chance of 5 sockets
                    // 0.5% of 4 sockets
                    // 3% chance of 3 sockets
                    // 15% chance of 2 sockets
                    // 50% chance of 1 socket
                    // the remainder will be 0 socket (31.4% in this case)
                    // uncomment the next line to prevent artifacts from being socketed
                    // if(ArtifactRarity == 0)
                    XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);

					if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
						m_Slayer2 = (SlayerName)reader.ReadInt();

					if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
						m_AosElementDamages = new AosElementAttributes( this, reader );
					else
						m_AosElementDamages = new AosElementAttributes( this );

					break;
				}
				case 4:
				{
					m_Slayer = (SlayerName)reader.ReadInt();

					goto case 3;
				}
				case 3:
				{
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_Identified = reader.ReadBool();

					goto case 1;
				}
				case 1:
				{
					m_MaxRange = reader.ReadInt();

					goto case 0;
				}
				case 0:
				{
					if ( version == 0 )
						m_MaxRange = 1; // default

					if ( version < 5 )
					{
						m_Resource = CraftResource.Iron;
						m_AosAttributes = new AosAttributes( this );
						m_AosWeaponAttributes = new AosWeaponAttributes( this );
						m_AosElementDamages = new AosElementAttributes( this );
                        m_AosSkillBonuses = new AosSkillBonuses(this);

                        // mod to randomly add sockets and socketability features to weapons. These settings will yield
                        // 2% drop rate of socketed/socketable items
                        // 0.1% chance of 5 sockets
                        // 0.5% of 4 sockets
                        // 3% chance of 3 sockets
                        // 15% chance of 2 sockets
                        // 50% chance of 1 socket
                        // the remainder will be 0 socket (31.4% in this case)
                        // uncomment the next line to prevent artifacts from being socketed
                        // if(ArtifactRarity == 0)
                        XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
					}

					m_MinDamage = reader.ReadInt();
					m_MaxDamage = reader.ReadInt();

					m_Speed = reader.ReadInt();

					m_HitSound = reader.ReadInt();
					m_MissSound = reader.ReadInt();

					m_Skill = (SkillName)reader.ReadInt();
					m_Type = (WeaponType)reader.ReadInt();
					m_Animation = (WeaponAnimation)reader.ReadInt();
					m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
					m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
					m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
					m_Quality = (WeaponQuality)reader.ReadInt();

					m_Crafter = reader.ReadMobile();

					m_Poison = Poison.Deserialize( reader );
					m_PoisonCharges = reader.ReadInt();

					if ( m_StrReq == OldStrengthReq )
						m_StrReq = -1;

					if ( m_DexReq == OldDexterityReq )
						m_DexReq = -1;

					if ( m_IntReq == OldIntelligenceReq )
						m_IntReq = -1;

					if ( m_MinDamage == OldMinDamage )
						m_MinDamage = -1;

					if ( m_MaxDamage == OldMaxDamage )
						m_MaxDamage = -1;

					if ( m_HitSound == OldHitSound )
						m_HitSound = -1;

					if ( m_MissSound == OldMissSound )
						m_MissSound = -1;

					if ( m_Speed == OldSpeed )
						m_Speed = -1;

					if ( m_MaxRange == OldMaxRange )
						m_MaxRange = -1;

					if ( m_Skill == OldSkill )
						m_Skill = (SkillName)(-1);

					if ( m_Type == OldType )
						m_Type = (WeaponType)(-1);

					if ( m_Animation == OldAnimation )
						m_Animation = (WeaponAnimation)(-1);

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					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_Hits <= 0 && m_MaxHits <= 0 )
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
			}

			if ( version < 6 )
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
		}
コード例 #40
0
ファイル: AnimalForm.cs プロジェクト: Orion321/unknown-shard
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             //On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);                   // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            double ninjitsu = m.Skills.Ninjitsu.Value;

            if (ninjitsu < entry.ReqSkill + 37.5)
            {
                double chance = (ninjitsu - entry.ReqSkill) / 37.5;

                if (chance < Utility.RandomDouble())
                {
                    return(MorphResult.Fail);
                }
            }

            m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5);

            BaseMount.Dismount(m);

            m.BodyMod = entry.BodyMod;

            if (entry.HueMod > 0)
            {
                m.HueMod = entry.HueMod;
            }

            if (entry.SpeedBoost)
            {
                m.Send(SpeedBoost.Instantiate(true));
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            Timer timer = new AnimalFormTimer(m, entry.BodyMod, entry.HueMod);

            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type));
            return(MorphResult.Success);
        }
コード例 #41
0
        public override void OnCast()
        {
            if (!CheckSequence())
            {
                return;
            }
            else if (Caster.Mounted)
            {
                Caster.SendLocalizedMessage(1042561); //Please dismount first.
            }
            else if (!Caster.CanBeginAction(typeof(AncientPeerSpell)))
            {
                Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
            }
            else if (Server.Spells.TransformationSpellHelper.UnderTransformation(Caster))
            {
                Caster.SendMessage("Your eyes stay firmly inside your body.");
            }
            else if (DisguiseTimers.IsDisguised(Caster)) //
            {
                Caster.SendMessage("Your eyes stay firmly inside your body.");
            }
            else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
            {
                Caster.SendMessage("Your eyes stay firmly inside your body.");
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod)
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(AncientPeerSpell)))
                {
                    if (this.Scroll != null)
                    {
                        Scroll.Consume();
                    }
                    Caster.PlaySound(0x2DF);

                    Caster.SendMessage("Your sight leaves your body.");

                    Souless dg = new Souless(this);

                    dg.Body = Caster.Body;

                    dg.Hue         = Caster.Hue;
                    dg.Name        = Caster.Name;
                    dg.SpeechHue   = Caster.SpeechHue;
                    dg.Fame        = Caster.Fame;
                    dg.Karma       = Caster.Karma;
                    dg.EmoteHue    = Caster.EmoteHue;
                    dg.Title       = Caster.Title;
                    dg.Criminal    = (Caster.Criminal);
                    dg.AccessLevel = Caster.AccessLevel;
                    dg.Str         = Caster.Str;
                    dg.Int         = Caster.Int;
                    dg.Hits        = Caster.Hits;
                    dg.Dex         = Caster.Dex;
                    dg.Mana        = Caster.Mana;
                    dg.Stam        = Caster.Stam;

                    dg.VirtualArmor = (Caster.VirtualArmor);
                    dg.SetSkill(SkillName.Wrestling, Caster.Skills[SkillName.Wrestling].Value);
                    dg.SetSkill(SkillName.Tactics, Caster.Skills[SkillName.Tactics].Value);
                    dg.SetSkill(SkillName.Anatomy, Caster.Skills[SkillName.Anatomy].Value);

                    dg.SetSkill(SkillName.Magery, Caster.Skills[SkillName.Magery].Value);
                    dg.SetSkill(SkillName.MagicResist, Caster.Skills[SkillName.MagicResist].Value);
                    dg.SetSkill(SkillName.Meditation, Caster.Skills[SkillName.Meditation].Value);
                    dg.SetSkill(SkillName.EvalInt, Caster.Skills[SkillName.EvalInt].Value);

                    dg.SetSkill(SkillName.Archery, Caster.Skills[SkillName.Archery].Value);
                    dg.SetSkill(SkillName.Macing, Caster.Skills[SkillName.Macing].Value);
                    dg.SetSkill(SkillName.Swords, Caster.Skills[SkillName.Swords].Value);
                    dg.SetSkill(SkillName.Fencing, Caster.Skills[SkillName.Fencing].Value);
                    dg.SetSkill(SkillName.Lumberjacking, Caster.Skills[SkillName.Lumberjacking].Value);
                    dg.SetSkill(SkillName.Alchemy, Caster.Skills[SkillName.Alchemy].Value);
                    dg.SetSkill(SkillName.Parry, Caster.Skills[SkillName.Parry].Value);
                    dg.SetSkill(SkillName.Focus, Caster.Skills[SkillName.Focus].Value);
                    dg.SetSkill(SkillName.Necromancy, Caster.Skills[SkillName.Necromancy].Value);
                    dg.SetSkill(SkillName.Chivalry, Caster.Skills[SkillName.Chivalry].Value);
                    dg.SetSkill(SkillName.ArmsLore, Caster.Skills[SkillName.ArmsLore].Value);
                    dg.SetSkill(SkillName.Poisoning, Caster.Skills[SkillName.Poisoning].Value);
                    dg.SetSkill(SkillName.SpiritSpeak, Caster.Skills[SkillName.SpiritSpeak].Value);
                    dg.SetSkill(SkillName.Stealing, Caster.Skills[SkillName.Stealing].Value);
                    dg.SetSkill(SkillName.Inscribe, Caster.Skills[SkillName.Inscribe].Value);
                    dg.Kills = (Caster.Kills);

                    m_PeerMod = new ArrayList();
                    double   loss = (0 - Caster.Skills[SkillName.AnimalTaming].Base);
                    SkillMod sk   = new DefaultSkillMod(SkillName.AnimalTaming, true, loss);
                    Caster.AddSkillMod(sk);
                    m_PeerMod.Add(sk);
                    double   loss1 = (0 - Caster.Skills[SkillName.AnimalLore].Base);
                    SkillMod sk1   = new DefaultSkillMod(SkillName.AnimalLore, true, loss1);// Druidry
                    Caster.AddSkillMod(sk1);
                    m_PeerMod.Add(sk1);

                    double   loss3 = (0 - Caster.Skills[SkillName.Necromancy].Base);
                    SkillMod sk3   = new DefaultSkillMod(SkillName.Necromancy, true, loss3);
                    Caster.AddSkillMod(sk3);
                    m_PeerMod.Add(sk3);
                    double   loss4 = (0 - Caster.Skills[SkillName.TasteID].Base);
                    SkillMod sk4   = new DefaultSkillMod(SkillName.TasteID, true, loss4);
                    Caster.AddSkillMod(sk4);
                    m_PeerMod.Add(sk4);
                    // Clear Items
                    RemoveFromAllLayers(dg);

                    // Then copy
                    CopyFromLayer(Caster, dg, Layer.FirstValid);
                    CopyFromLayer(Caster, dg, Layer.OneHanded);
                    CopyFromLayer(Caster, dg, Layer.TwoHanded);
                    CopyFromLayer(Caster, dg, Layer.Shoes);
                    CopyFromLayer(Caster, dg, Layer.Pants);
                    CopyFromLayer(Caster, dg, Layer.Shirt);
                    CopyFromLayer(Caster, dg, Layer.Helm);
                    CopyFromLayer(Caster, dg, Layer.Gloves);
                    CopyFromLayer(Caster, dg, Layer.Ring);
                    CopyFromLayer(Caster, dg, Layer.Talisman);
                    CopyFromLayer(Caster, dg, Layer.Neck);
                    CopyFromLayer(Caster, dg, Layer.Hair);
                    CopyFromLayer(Caster, dg, Layer.Waist);
                    CopyFromLayer(Caster, dg, Layer.InnerTorso);
                    CopyFromLayer(Caster, dg, Layer.Bracelet);
                    //CopyFromLayer(Caster, dg, Layer.Unused_xF);
                    CopyFromLayer(Caster, dg, Layer.FacialHair);
                    CopyFromLayer(Caster, dg, Layer.MiddleTorso);
                    CopyFromLayer(Caster, dg, Layer.Earrings);
                    CopyFromLayer(Caster, dg, Layer.Arms);
                    CopyFromLayer(Caster, dg, Layer.Cloak);
                    CopyFromLayer(Caster, dg, Layer.Backpack);
                    CopyFromLayer(Caster, dg, Layer.OuterTorso);
                    CopyFromLayer(Caster, dg, Layer.OuterLegs);
                    CopyFromLayer(Caster, dg, Layer.InnerLegs);
                    CopyFromLayer(Caster, dg, Layer.LastUserValid);
                    CopyFromLayer(Caster, dg, Layer.Mount);

                    dg.Owner    = Caster;
                    dg.OldBody  = m_OldBody;
                    m_Fake      = dg;
                    dg.Map      = Caster.Map;
                    dg.Location = Caster.Location;
                    BaseArmor.ValidateMobile(Caster);
                    m_OldBody        = Caster.Body;
                    Caster.BodyValue = 903;
                    Caster.Blessed   = true;
                    StopTimer(Caster);

                    Timer t = new InternalTimer(Caster, m_OldBody, m_Fake, this);

                    m_Timers[Caster] = t;

                    t.Start();
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
                }
            }

            FinishSequence();
        }
コード例 #42
0
ファイル: EvilOmen.cs プロジェクト: cynricthehun/UOLegends
        public void Target( Mobile m )
        {
            if ( !(m is BaseCreature || m is PlayerMobile) )
            {
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

                /* Curses the target so that the next harmful event that affects them is magnified.
                 * Damage to the target's hit points is increased 25%,
                 * the poison level of the attack will be 1 higher
                 * and the Resist Magic skill of the target will be fixed on 50.
                 *
                 * The effect lasts for one harmful event only.
                 */

                m.PlaySound( 0xFC );
                m.FixedParticles( 0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head );
                m.FixedParticles( 0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head );

                if ( !m_Table.Contains( m ) )
                {
                    SkillMod mod = new DefaultSkillMod( SkillName.MagicResist, false, 50.0 );

                    if ( m.Skills[SkillName.MagicResist].Base > 50.0 )
                        m.AddSkillMod( mod );

                    m_Table[m] = mod;
                }

                // TODO: Correct duration algorithm
                TimeSpan duration = TimeSpan.FromSeconds( 3.5 + (3.5 * (Caster.Skills[SkillName.SpiritSpeak].Value / 100.0)) );

                Timer.DelayCall( duration, new TimerStateCallback( EffectExpire_Callback ), m );
            }

            FinishSequence();
        }