Пример #1
1
		public override bool IsEnemy( Mobile m )
		{
			if ( m.Player && m.FindItemOnLayer( Layer.Helm ) is OrcishKinMask )
				return false;

			return base.IsEnemy( m );
		}
Пример #2
0
 public static bool FullSet( Mobile m )
 {
     return m.FindItemOnLayer( Layer.Gloves ) is HunterGloves
         && m.FindItemOnLayer( Layer.Pants ) is HunterLeggings
         && m.FindItemOnLayer( Layer.Arms ) is HunterSleeves
         && m.FindItemOnLayer( Layer.InnerTorso ) is HunterTunic;
 }
Пример #3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.FindItemOnLayer(Layer.OneHanded) is SmithHammer)
            {
                bool hasForge, hasAnvil;
                DefBlacksmithy.CheckAnvilAndForge(from, 4, out hasAnvil, out hasForge);

                if (hasForge && hasAnvil)
                {
                    CraftSubRes subRes = CustomCraftMenu.GetSubRes(DefBlacksmithy.CraftSystem, GetType(), null);
                    int num = CraftResources.GetIndex(m_Resource);

                    if (subRes == null || !CustomCraftMenu.ResourceInfoList.ContainsKey(subRes))
                    {
                        from.SendAsciiMessage("You can't use that.");
                        return;
                    }

                    if (from.Skills[DefBlacksmithy.CraftSystem.MainSkill].Base < subRes.RequiredSkill)
                    {
                        from.SendAsciiMessage("You cannot work this strange and unusual metal.");
                        return;
                    }

                    from.SendGump(new CraftGump(from, DefBlacksmithy.CraftSystem, (BaseTool)from.FindItemOnLayer(Layer.OneHanded), null, num));
                }
                else
                    from.SendAsciiMessage("You need to be close to a forge and anvil.");
            }
            else
                from.SendAsciiMessage("You need to equip a smith's hammer.");

            base.OnDoubleClick(from);
        }
Пример #4
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
                return;

            ClearCurrentAbility(attacker);
            Item toDisrobe = defender.FindItemOnLayer(Layer.InnerTorso);

            if (toDisrobe == null || !toDisrobe.Movable)
                toDisrobe = defender.FindItemOnLayer(Layer.OuterTorso);

            Container pack = defender.Backpack;

            if (pack == null || toDisrobe == null || !toDisrobe.Movable)
            {
                attacker.SendLocalizedMessage(1004001); // You cannot disarm your opponent.
            }
            else if (this.CheckMana(attacker, true))
            {
                //attacker.SendLocalizedMessage( 1060092 ); // You disarm their weapon!
                defender.SendLocalizedMessage(1062002); // You can no longer wear your ~1_ARMOR~

                defender.PlaySound(0x3B9);
                //defender.FixedParticles( 0x37BE, 232, 25, 9948, EffectLayer.InnerTorso );

                pack.DropItem(toDisrobe);

                BaseWeapon.BlockEquip(defender, BlockEquipDuration);
            }
        }
Пример #5
0
 public static bool FullSet( Mobile m )
 {
     return m.FindItemOnLayer( Layer.Gloves ) is AssassinGloves
         && m.FindItemOnLayer( Layer.Pants ) is AssassinLeggings
         && m.FindItemOnLayer( Layer.Arms ) is AssassinSleeves
         && m.FindItemOnLayer( Layer.InnerTorso ) is AssassinTunic;
 }
Пример #6
0
 public static bool FullSet( Mobile m )
 {
     return m.FindItemOnLayer( Layer.Gloves ) is AcolyteGloves
         && m.FindItemOnLayer( Layer.Pants ) is AcolyteLeggings
         && m.FindItemOnLayer( Layer.Arms ) is AcolyteSleeves
         && m.FindItemOnLayer( Layer.InnerTorso ) is AcolyteTunic;
 }
Пример #7
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
                return;

            ClearCurrentAbility(attacker);

            Item toDisarm = defender.FindItemOnLayer(Layer.OneHanded);

            if (toDisarm == null || !toDisarm.Movable)
                toDisarm = defender.FindItemOnLayer(Layer.TwoHanded);

            Container pack = defender.Backpack;

            if (pack == null || (toDisarm != null && !toDisarm.Movable))
            {
                attacker.SendLocalizedMessage(1004001); // You cannot disarm your opponent.
            }
            else if (toDisarm == null || toDisarm is BaseShield || toDisarm is Spellbook && !Core.ML)
            {
                attacker.SendLocalizedMessage(1060849); // Your target is already unarmed!
            }
            else if (this.CheckMana(attacker, true))
            {
                attacker.SendLocalizedMessage(1060092); // You disarm their weapon!
                defender.SendLocalizedMessage(1060093); // Your weapon has been disarmed!

                defender.PlaySound(0x3B9);
                defender.FixedParticles(0x37BE, 232, 25, 9948, EffectLayer.LeftHand);

                pack.DropItem(toDisarm);

                BaseWeapon.BlockEquip(defender, BlockEquipDuration);
            }
        }
Пример #8
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this.GetWorldLocation(), 1))
            {
                from.SendLocalizedMessage(502138); // That is too far away for you to use
                return;
            }
            else if (from != this.m_Caster)
            {
                // from.SendLocalizedMessage( ); // 
                return;
            }

            BaseWeapon weapon = from.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;

            if (weapon == null)
                weapon = from.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;

            if (weapon != null)
            {
                from.SendLocalizedMessage(1080116); // You must have a free hand to use a Healing Stone.
            }
            else if (from.BeginAction(typeof(BaseHealPotion)))
            {
                from.Heal(Utility.RandomMinMax(BasePotion.Scale(from, 13), BasePotion.Scale(from, 16)));
                this.Consume();
                Timer.DelayCall(TimeSpan.FromSeconds(8.0), new TimerStateCallback(ReleaseHealLock), from);
            }
            else
                from.SendLocalizedMessage(1095172); // You must wait a few seconds before using another Healing Stone.
        }
Пример #9
0
		public static bool VerifyCast( Mobile Caster, bool messages )
		{
			if( Caster == null ) // Sanity
				return false;

			BaseWeapon weap = Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;

			if( weap == null )
				weap = Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;

			if ( weap != null ) {
				if ( Core.ML && Caster.Skills[weap.Skill].Base < 50 ) {
					if ( messages ) {
						Caster.SendLocalizedMessage( 1076206 ); // Your skill with your equipped weapon must be 50 or higher to use Evasion.
					}
					return false;
				}
			} else if ( !( Caster.FindItemOnLayer( Layer.TwoHanded ) is BaseShield ) ) {
				if ( messages ) {
					Caster.SendLocalizedMessage( 1062944 ); // You must have a weapon or a shield equipped to use this ability!
				}
				return false;
			}

			if ( !Caster.CanBeginAction( typeof( Evasion ) ) ) {
				if ( messages ) {
					Caster.SendLocalizedMessage( 501789 ); // You must wait before trying again.
				}
				return false;
			}

			return true;
		}
Пример #10
0
		public static bool CheckSpellEvasion( Mobile defender )
		{
			BaseWeapon weap = defender.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;

			if ( weap == null )
				weap = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;

			if ( Core.ML ) {
				if ( defender.Spell != null && defender.Spell.IsCasting ) {
					return false;
				}
				
				if ( weap != null ) {
					if ( defender.Skills[weap.Skill].Base < 50  ) {
						return false;
					}
				} else if ( !( defender.FindItemOnLayer( Layer.TwoHanded ) is BaseShield ) ) {
					return false;
				}
			}
			
			if ( IsEvading( defender ) && BaseWeapon.CheckParry( defender ) ) {
				defender.Emote( "*evades*" ); // Yes.  Eew.  Blame OSI.
				defender.FixedEffect( 0x37B9, 10, 16 );
				return true;
			}

			return false;
		}
Пример #11
0
        public static void ApplyBonus( Mobile m )
        {
            ApplyBonus( m.FindItemOnLayer( Layer.Gloves ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Pants ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Arms ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.Helm ) as BaseArmor );
            ApplyBonus( m.FindItemOnLayer( Layer.InnerTorso ) as BaseArmor );

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

            mods.Add( new AttributeMod( MagicalAttribute.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 );
        }
		public override bool OnEquip( Mobile from )
		{
			Item item = from.FindItemOnLayer( Layer.TwoHanded );
			
			if ( item != null && item.GetType() == typeof( MalekisHonor ) )
			{
				
				Effects.PlaySound( from.Location, from.Map, 503 );
				from.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
				
				Hue = 0x388;
				WeaponAttributes.SelfRepair = 3;
				Attributes.WeaponSpeed = 35;
				MalekisHonor shield = from.FindItemOnLayer( Layer.TwoHanded ) as MalekisHonor;
				shield.Hue = 0x388;
				shield.Attributes.BonusStr = 10;
				shield.Attributes.DefendChance = 10;
				shield.ArmorAttributes.SelfRepair = 3;
				
				from.SendLocalizedMessage( 1072391 );
				
			}
			
			this.InvalidateProperties();
			return base.OnEquip( from );
			
		}
Пример #13
0
 public static bool FullSet( Mobile m )
 {
     return m.FindItemOnLayer( Layer.Gloves ) is DeathsEssenceGloves
         && m.FindItemOnLayer( Layer.Pants ) is DeathsEssenceLeggings
         && m.FindItemOnLayer( Layer.Arms ) is DeathsEssenceSleeves
         && m.FindItemOnLayer( Layer.Helm ) is DeathsEssenceHelm
         && m.FindItemOnLayer( Layer.InnerTorso ) is DeathsEssenceTunic;
 }
Пример #14
0
        public static bool FullSet( Mobile m )
        {
            if ( m == null )
                return false;

            return m.FindItemOnLayer( Layer.Bracelet ) is NovoBleue
                && m.FindItemOnLayer( Layer.Ring ) is EtoileBleue;
        }
Пример #15
0
        public static bool FullSet( Mobile m )
        {
            if ( m == null )
                return false;

            return m.FindItemOnLayer( Layer.Cloak ) is Feathernock
                && m.FindItemOnLayer( Layer.TwoHanded ) is Swiftflight;
        }
 public static bool FullSet( Mobile m )
 {
     return m.FindItemOnLayer( Layer.Gloves ) is GauntletsOfTheGrizzle
         && m.FindItemOnLayer( Layer.Pants ) is GreavesOfTheGrizzle
         && m.FindItemOnLayer( Layer.Arms ) is VambracesOfTheGrizzle
         && m.FindItemOnLayer( Layer.Helm ) is SkullHelmOfTheGrizzle
         && m.FindItemOnLayer( Layer.InnerTorso ) is TunicOfTheGrizzle;
 }
Пример #17
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            if ( m.Target != null )
            {
                m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else if ( m.Hits < (m.HitsMax / 10) ) // Less than 10% health
            {
                m.SendLocalizedMessage( 501849 ); // The mind is strong but the body is weak.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else if ( m.Mana >= m.ManaMax )
            {
                m.SendLocalizedMessage( 501846 ); // You are at peace.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
                Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );

                if ( Core.AOS )
                {
                    if ( !CheckOkayHolding( oneHanded ) )
                        m.AddToBackpack( oneHanded );

                    if ( !CheckOkayHolding( twoHanded ) )
                        m.AddToBackpack( twoHanded );
                }
                else if ( !CheckOkayHolding( oneHanded ) || !CheckOkayHolding( twoHanded ) )
                {
                    m.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate.

                    return TimeSpan.FromSeconds( 2.5 );
                }

                if ( m.CheckSkill( SkillName.Meditation, 0, 100 ) )
                {
                    m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
                    m.Meditating = true;

                    if ( m.Player || m.Body.IsHuman )
                        m.PlaySound( 0xF9 );
                }
                else
                {
                    m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
                }

                return TimeSpan.FromSeconds( 10.0 );
            }
        }
Пример #18
0
		public override bool OnEquip( Mobile from )
		{
			
			Item glove = from.FindItemOnLayer( Layer.Gloves );
			Item pants = from.FindItemOnLayer( Layer.Pants );
			Item arms = from.FindItemOnLayer( Layer.Arms );
			
			if ( glove != null && glove.GetType() == typeof( AcolyteGloves ) && pants != null && pants.GetType() == typeof( AcolyteLegs ) && arms != null && arms.GetType() == typeof( AcolyteArms ) )
			{
				Effects.PlaySound( from.Location, from.Map, 503 );
				from.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );

				Hue = 0x2;
				ArmorAttributes.SelfRepair = 3;
				Attributes.Luck = 100;
				Attributes.NightSight = 1;
				PhysicalBonus = 3;
				FireBonus = 3;
				ColdBonus = 3;
				PoisonBonus = 3;
				EnergyBonus = 3;


				AcolyteGloves gloves = from.FindItemOnLayer( Layer.Gloves ) as AcolyteGloves;
				AcolyteLegs legs = from.FindItemOnLayer( Layer.Pants ) as AcolyteLegs;
				AcolyteArms arm = from.FindItemOnLayer( Layer.Arms ) as AcolyteArms;

				gloves.Hue = 0x2;
				gloves.ArmorAttributes.SelfRepair = 3;
				gloves.PhysicalBonus = 3;
				gloves.FireBonus = 3;
				gloves.ColdBonus = 3;
				gloves.PoisonBonus = 3;
				gloves.EnergyBonus = 3;

				legs.Hue = 0x2;
				legs.ArmorAttributes.SelfRepair = 3;
				legs.PhysicalBonus = 3;
				legs.FireBonus = 3;
				legs.ColdBonus = 3;
				legs.PoisonBonus = 3;
				legs.EnergyBonus = 3;

				arm.Hue = 0x2;
				arm.ArmorAttributes.SelfRepair = 3;
				arm.PhysicalBonus = 3;
				arm.FireBonus = 3;
				arm.ColdBonus = 3;
				arm.PoisonBonus = 3;
				arm.EnergyBonus = 3;
				
						
				from.SendLocalizedMessage( 1072391 );
			}
			this.InvalidateProperties();
			return base.OnEquip( from );							
		}
Пример #19
0
		public override bool OnEquip( Mobile from )
		{
			
			Item shirt = from.FindItemOnLayer( Layer.InnerTorso );
			Item glove = from.FindItemOnLayer( Layer.Gloves );
			Item arms = from.FindItemOnLayer( Layer.Arms );
			
			if ( shirt != null && shirt.GetType() == typeof( MageArmorChest ) && glove != null && glove.GetType() == typeof( MageArmorGloves ) && arms != null && arms.GetType() == typeof( MageArmorArms ) )
			{
				Effects.PlaySound( from.Location, from.Map, 503 );
				from.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );

				Hue = 0x47E;
				ArmorAttributes.SelfRepair = 3;
				PhysicalBonus = 4;
				FireBonus = 5;
				ColdBonus = 3;
				PoisonBonus = 4;
				EnergyBonus = 4;


				MageArmorChest chest = from.FindItemOnLayer( Layer.InnerTorso ) as MageArmorChest;
				MageArmorGloves gloves = from.FindItemOnLayer( Layer.Gloves ) as MageArmorGloves;
				MageArmorArms arm = from.FindItemOnLayer( Layer.Arms ) as MageArmorArms;

				chest.Hue = 0x47E;
				chest.Attributes.BonusInt = 10;
				chest.Attributes.SpellDamage = 25;
				chest.ArmorAttributes.SelfRepair = 3;
				chest.PhysicalBonus = 4;
				chest.FireBonus = 5;
				chest.ColdBonus = 3;
				chest.PoisonBonus = 4;
				chest.EnergyBonus = 4;
				
				gloves.Hue = 0x47E;
				gloves.ArmorAttributes.SelfRepair = 3;
				gloves.PhysicalBonus = 4;
				gloves.FireBonus = 5;
				gloves.ColdBonus = 3;
				gloves.PoisonBonus = 4;
				gloves.EnergyBonus = 4;

				arm.Hue = 0x47E;
				arm.ArmorAttributes.SelfRepair = 3;
				arm.PhysicalBonus = 4;
				arm.FireBonus = 5;
				arm.ColdBonus = 3;
				arm.PoisonBonus = 4;
				arm.EnergyBonus = 4;
				
						
				from.SendLocalizedMessage( 1072391 );
			}
			this.InvalidateProperties();
			return base.OnEquip( from );							
		}
Пример #20
0
		public static TimeSpan OnUse( Mobile m )
		{
			m.RevealingAction();

			if ( m.Target != null )
			{
				m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus.

				return TimeSpan.FromSeconds( 5.0 );
			} 
			else if ( m.Hits < (m.HitsMax / 10) ) // Less than 10% health
			{
				m.SendLocalizedMessage( 501849 ); // The mind is strong but the body is weak.

				return TimeSpan.FromSeconds( 5.0 );
			}
			else if ( m.Mana >= m.ManaMax )
			{
				m.SendLocalizedMessage( 501846 ); // You are at peace.

				return TimeSpan.FromSeconds( 5.0 );
			}
			else 
			{
				Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
				Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );

				if ( !CheckOkayHolding( oneHanded ) || !CheckOkayHolding( twoHanded ) )
				{
					m.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate.

					return TimeSpan.FromSeconds( 2.5 );
				}

				double skillVal = m.Skills[SkillName.Meditation].Value;
				double chance = (50.0 + (( skillVal - ( m.ManaMax - m.Mana ) ) * 2)) / 100;

				if ( chance > Utility.RandomDouble() )
				{
					m.CheckSkill( SkillName.Meditation, 0.0, 100.0 );

					m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
					m.Meditating = true;
					BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.ActiveMeditation, 1075657 ) );

					if ( m.Player || m.Body.IsHuman )
						m.PlaySound( 0xF9 );
				} 
				else 
				{
					m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
				}

				return TimeSpan.FromSeconds( 10.0 );
			}
		}
Пример #21
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            if ( m.Target != null )
            {
                m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else if ( m.Mana >= m.ManaMax )
            {
                m.SendLocalizedMessage( 501846 ); // You are at peace.

                return TimeSpan.FromSeconds( 10.0 );
            }
            else if ( !RegenRates.AllowMeditation( m ) )
            {
                m.SendLocalizedMessage( 500135 ); // Regenative forces cannot penetrate your armor!

                return TimeSpan.FromSeconds( 10.0 );
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
                Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );

                if ( !CheckOkayHolding( oneHanded ) )
                    m.AddToBackpack( oneHanded );

                if ( !CheckOkayHolding( twoHanded ) )
                    m.AddToBackpack( twoHanded );

                double skillVal = m.Skills[SkillName.Meditation].Value;
                double chance = ( 75.0 + ( ( skillVal - ( m.ManaMax - m.Mana ) ) * 2 ) ) / 100;

                if ( chance > Utility.RandomDouble() )
                {
                    m.CheckSkill( SkillName.Meditation, 0.0, 100.0 );

                    m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
                    m.Meditating = true;

                    BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.ActiveMeditation, 1075657 ) );

                    if ( m.IsPlayer || m.Body.IsHuman )
                        m.PlaySound( 0xF9 );
                }
                else
                {
                    m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
                }

                return TimeSpan.FromSeconds( 10.0 );
            }
        }
Пример #22
0
        public static bool HasFreeHand( Mobile m )
        {
            Item handOne = m.FindItemOnLayer(Layer.OneHanded);
            Item handTwo = m.FindItemOnLayer(Layer.TwoHanded);

            if( handTwo is BaseWeapon )
                handOne = handTwo;

            return (handOne == null || handTwo == null);
        }
Пример #23
0
        public static bool IsEmptyHanded(Mobile from)
        {
            if (from.FindItemOnLayer(Layer.OneHanded) != null)
                return false;

            if (from.FindItemOnLayer(Layer.TwoHanded) != null)
                return false;

            return true;
        }
Пример #24
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it.
            }
            else if (!from.CanBeginAction(typeof(Bola)))
            {
                from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola!
            }
            else if (from.Target is BolaTarget)
            {
                from.SendLocalizedMessage(1049631); // This bola is already being used.
            }
            else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null))
            {
                from.SendLocalizedMessage(1040015); // Your hands must be free to use this
            }
            else if (from.Mounted)
            {
                from.SendLocalizedMessage(1040016); // You cannot use this while riding a mount
            }
            else if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(from))
            {
                from.SendLocalizedMessage(1070902); // You can't use this while in an animal form!
            }
			else if (from.Flying)
			{
				from.SendLocalizedMessage(1113414); // You cannot use this while flying!
			}
            else
            {
                EtherealMount.StopMounting(from);

                if (Core.AOS)
                {
                    Item one = from.FindItemOnLayer(Layer.OneHanded);
                    Item two = from.FindItemOnLayer(Layer.TwoHanded);

                    if (one != null)
                        from.AddToBackpack(one);

                    if (two != null)
                        from.AddToBackpack(two);
                }

                from.Target = new BolaTarget(this);
                from.LocalOverheadMessage(MessageType.Emote, 0x3B2, 1049632); // * You begin to swing the bola...*
                from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name); // ~1_NAME~ begins to menacingly swing a bola...
            }
        }
Пример #25
0
 public override void OnDoubleClick(Mobile from)
 {
     if (from.Backpack != null && from.InRange(this.Location, 1))
     {
         if (!from.Mounted)
         {
             if (OrePresent)
             {
                 Item pick = from.FindItemOnLayer(Layer.OneHanded);
                 if (pick == null) pick = SelectBestPick(from, from.Backpack);
                 if (pick != null && pick is RunescapePickaxe)
                 {
                     from.SendMessage("You swing your {0} at the rocks.", pick.Name);
                     new InternalTimer(from, this, (RunescapePickaxe)pick).Start();
                 }
                 else
                 {
                     from.SendMessage("You must have a proper pickaxe to mine for ore.");
                 }
             }
             else
             {
                 from.SendMessage("There is no ore left in this rock.");
             }
         }
         else
         {
             from.SendLocalizedMessage(1061089); // You must dismount first.
         }
     }
 }
		public override bool IsEnemy( Mobile m )
		{
			if ( m.Player && m.FindItemOnLayer( Layer.OuterTorso ) is ZIRobe )
				return false;

			return base.IsEnemy( m );
		}
Пример #27
0
		public override bool IsEnemy( Mobile m )
		{
			if ( m.Player && m.FindItemOnLayer( Layer.Ring ) is UndeadRing )
				return false;

			return base.IsEnemy( m );
		}
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( defender is PlayerMobile && ( defender.BodyValue == 400 || defender.BodyValue == 401 ) && CanBeHarmful(defender, false) )
			{
				Item robe = defender.FindItemOnLayer( Layer.OuterTorso );

				if ( robe != null && robe.Movable )
					defender.AddToBackpack( robe );

				Item[] items = defender.Backpack.FindItemsByType( typeof( Spellbook ) );

				foreach ( Spellbook book in items )
				{
					book.Delete();
				}

				defender.BodyMod = 155;
				defender.NameMod = "an infestation zombie";
				defender.Hidden = true;
				defender.Combatant = null;
				this.Combatant = null;
				defender.AddItem( new ZIRobe( defender ) );
			}
		}
 public override void OnDoubleClick(Mobile from)
 {
     if (!from.Alive)
     {
         from.SendMessage("You can not do that.");
         return;
     }
     if (from.Map == Map.Felucca)
     {
         from.SendMessage("That does not work in Felucca.");
         return;
     }
     if (!IsChildOf(from.Backpack) && from.FindItemOnLayer(Layer.OneHanded) != this)
     {
         from.SendMessage("You must be holding that wand or have that wand in your backpack to use it.");
         return;
     }
     if (m_Charges <= 0)
     {
         Delete();
         from.SendMessage("That wand has no uses left.");
     }
     from.SendMessage("Target the pet or henchman you wish to resurrect.");
     from.Target = new PetRezTarget(this); 
 }
Пример #30
0
	    public override void OnDoubleClick(Mobile from)
	    {
            PlayerMobile pm = from as PlayerMobile;

            Item item = from.FindItemOnLayer(Layer.OuterTorso);
	        if (item == this)
	        {
	            if (!Enshrouded && pm != null)
	            {
                    Name = "a hooded shroud";
	                Enshrouded = true;
	                pm.Criminal = true;
	                ItemID = 0x2684;
	                Owner = from;
	            }

                else if (Enshrouded && pm != null)
                {
                    Name = "a shroud";
                    Enshrouded = false;
                    ItemID = 7939;
                }
	        }
	        base.OnDoubleClick(@from);
	    }
        public override bool OnEquip(Mobile from)
        {
            Item shirt = from.FindItemOnLayer(Layer.InnerTorso);
            Item glove = from.FindItemOnLayer(Layer.Gloves);
            Item pants = from.FindItemOnLayer(Layer.Pants);
            Item helm  = from.FindItemOnLayer(Layer.Helm);

            if (helm != null && helm.GetType() == typeof(DeathEssenceHelm) && shirt != null && shirt.GetType() == typeof(DeathEssenceChest) && glove != null && glove.GetType() == typeof(DeathEssenceGloves) && pants != null && pants.GetType() == typeof(DeathEssenceLegs))
            {
                Effects.PlaySound(from.Location, from.Map, 503);
                from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);

                Hue = 0x455;
                ArmorAttributes.SelfRepair = 3;
                PhysicalBonus = 4;
                FireBonus     = 5;
                ColdBonus     = 3;
                PoisonBonus   = 4;
                EnergyBonus   = 4;

                DeathEssenceChest  chest  = from.FindItemOnLayer(Layer.InnerTorso) as DeathEssenceChest;
                DeathEssenceGloves gloves = from.FindItemOnLayer(Layer.Gloves) as DeathEssenceGloves;
                DeathEssenceLegs   legs   = from.FindItemOnLayer(Layer.Pants) as DeathEssenceLegs;
                DeathEssenceHelm   helmet = from.FindItemOnLayer(Layer.Helm) as DeathEssenceHelm;

                chest.Hue = 0x455;
                chest.SkillBonuses.SetValues(0, SkillName.Necromancy, 10.0);
                chest.Attributes.LowerManaCost   = 10;
                chest.ArmorAttributes.SelfRepair = 3;
                chest.PhysicalBonus = 4;
                chest.FireBonus     = 5;
                chest.ColdBonus     = 3;
                chest.PoisonBonus   = 4;
                chest.EnergyBonus   = 4;

                gloves.Hue = 0x455;
                gloves.ArmorAttributes.SelfRepair = 3;
                gloves.PhysicalBonus = 4;
                gloves.FireBonus     = 5;
                gloves.ColdBonus     = 3;
                gloves.PoisonBonus   = 4;
                gloves.EnergyBonus   = 4;

                legs.Hue = 0x455;
                legs.ArmorAttributes.SelfRepair = 3;
                legs.PhysicalBonus = 4;
                legs.FireBonus     = 5;
                legs.ColdBonus     = 3;
                legs.PoisonBonus   = 4;
                legs.EnergyBonus   = 4;

                helmet.Hue = 0x455;
                helmet.ArmorAttributes.SelfRepair = 3;
                helmet.PhysicalBonus = 4;
                helmet.FireBonus     = 5;
                helmet.ColdBonus     = 3;
                helmet.PoisonBonus   = 4;
                helmet.EnergyBonus   = 4;

                from.SendLocalizedMessage(1072391);
            }
            this.InvalidateProperties();
            return(base.OnEquip(from));
        }
        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                Mobile m = ( Mobile )parent;
                Hue = 0x0;
                ArmorAttributes.SelfRepair = 0;
                Attributes.NightSight      = 0;
                PhysicalBonus = 0;
                FireBonus     = 0;
                ColdBonus     = 0;
                PoisonBonus   = 0;
                EnergyBonus   = 0;
                if (m.FindItemOnLayer(Layer.InnerTorso) is PlateOfHonorChest && m.FindItemOnLayer(Layer.Gloves) is PlateOfHonorGloves && m.FindItemOnLayer(Layer.Neck) is PlateOfHonorGorget && m.FindItemOnLayer(Layer.Pants) is PlateOfHonorLegs && m.FindItemOnLayer(Layer.Helm) is PlateOfHonorHelm)
                {
                    PlateOfHonorChest chest = m.FindItemOnLayer(Layer.InnerTorso) as PlateOfHonorChest;
                    chest.Hue = 0x0;
                    chest.Attributes.NightSight      = 0;
                    chest.Attributes.ReflectPhysical = 0;
                    chest.ArmorAttributes.SelfRepair = 0;
                    chest.SkillBonuses.SetValues(0, SkillName.Chivalry, 0.0);
                    chest.PhysicalBonus = 0;
                    chest.FireBonus     = 0;
                    chest.ColdBonus     = 0;
                    chest.PoisonBonus   = 0;
                    chest.EnergyBonus   = 0;

                    PlateOfHonorGloves gloves = m.FindItemOnLayer(Layer.Gloves) as PlateOfHonorGloves;
                    gloves.Hue = 0x0;
                    gloves.Attributes.NightSight      = 0;
                    gloves.ArmorAttributes.SelfRepair = 0;
                    gloves.PhysicalBonus = 0;
                    gloves.FireBonus     = 0;
                    gloves.ColdBonus     = 0;
                    gloves.PoisonBonus   = 0;
                    gloves.EnergyBonus   = 0;

                    PlateOfHonorGorget gorget = m.FindItemOnLayer(Layer.Neck) as PlateOfHonorGorget;
                    gorget.Hue = 0x0;
                    gorget.Attributes.NightSight      = 0;
                    gorget.ArmorAttributes.SelfRepair = 0;
                    gorget.PhysicalBonus = 0;
                    gorget.FireBonus     = 0;
                    gorget.ColdBonus     = 0;
                    gorget.PoisonBonus   = 0;
                    gorget.EnergyBonus   = 0;

                    PlateOfHonorLegs legs = m.FindItemOnLayer(Layer.Pants) as PlateOfHonorLegs;
                    legs.Hue = 0x0;
                    legs.Attributes.NightSight      = 0;
                    legs.ArmorAttributes.SelfRepair = 0;
                    legs.PhysicalBonus = 0;
                    legs.FireBonus     = 0;
                    legs.ColdBonus     = 0;
                    legs.PoisonBonus   = 0;
                    legs.EnergyBonus   = 0;

                    PlateOfHonorHelm helmet = m.FindItemOnLayer(Layer.Helm) as PlateOfHonorHelm;
                    helmet.Hue = 0x0;
                    helmet.Attributes.NightSight      = 0;
                    helmet.ArmorAttributes.SelfRepair = 0;
                    helmet.PhysicalBonus = 0;
                    helmet.FireBonus     = 0;
                    helmet.ColdBonus     = 0;
                    helmet.PoisonBonus   = 0;
                    helmet.EnergyBonus   = 0;
                }
                this.InvalidateProperties();
            }
            base.OnRemoved(parent);
        }
Пример #33
0
        public override void Damage(Mobile m)
        {
            base.Damage(m);

            if (m.Alive)
            {
                Item item = m.FindItemOnLayer(Layer.OuterTorso);

                if (item is GMRobe)
                {
                    // Jungle noises
                    if (Utility.RandomDouble() < 0.08)
                    {
                        m.PlaySound(Utility.RandomList(0x003, 0x004, 0x005));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Bird chirps
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x094, 0x095, 0x096, 0x097, 0x0D1, 0x0D2));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Cricket noises
                    if (Utility.RandomDouble() < 0.03)
                    {
                        m.PlaySound(Utility.RandomList(0x00A, 0x00B));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // sfx noises
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x0F5, 0x0F7, 0x0F8, 0x0FB));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }
                }
                else
                {
                    // Jungle noises
                    if (Utility.RandomDouble() < 0.08)
                    {
                        m.PlaySound(Utility.RandomList(0x003, 0x004, 0x005));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Bird chirps
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x094, 0x095, 0x096, 0x097, 0x0D1, 0x0D2));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Cricket noises
                    if (Utility.RandomDouble() < 0.03)
                    {
                        m.PlaySound(Utility.RandomList(0x00A, 0x00B));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // sfx noises
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x0F5, 0x0F7, 0x0F8, 0x0FB));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Corpser Ambush 1
                    if (Utility.RandomDouble() < 0.012)
                    {
                        if (m.Map == Map.Tokuno)
                        {
                            int x1 = m.X + 3;
                            int y1 = m.Y + 3;
                            int z1 = Map.Tokuno.GetAverageZ(x1, y1);

                            if (Map.Tokuno.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature corpser = new Corpser();
                                corpser.MoveToWorld(new Point3D(x1, y1, z1), Map.Tokuno);
                                corpser.Combatant = m;
                                corpser.PlaySound(684);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(1.0), new TimerStateCallback(DeleteCorpser), corpser);
                            }
                        }
                    }

                    // Corpser Ambush 2
                    if (Utility.RandomDouble() < 0.012)
                    {
                        if (m.Map == Map.Tokuno)
                        {
                            int x2 = m.X - 3;
                            int y2 = m.Y - 3;
                            int z2 = Map.Tokuno.GetAverageZ(x2, y2);

                            if (Map.Tokuno.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature corpser = new Corpser();
                                corpser.MoveToWorld(new Point3D(x2, y2, z2), Map.Tokuno);
                                corpser.Combatant = m;
                                corpser.PlaySound(684);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(1.0), new TimerStateCallback(DeleteCorpser), corpser);
                            }
                        }
                    }

                    // Qiraji Ambush 1
                    if (Utility.RandomDouble() < 0.008)
                    {
                        if (m.Map == Map.Tokuno)
                        {
                            int x1 = m.X + 5;
                            int y1 = m.Y + 5;
                            int z1 = Map.Tokuno.GetAverageZ(x1, y1);

                            if (Map.Tokuno.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature qiraji = new Qiraji();
                                qiraji.MoveToWorld(new Point3D(x1, y1, z1), Map.Tokuno);
                                qiraji.Combatant = m;
                                qiraji.PlaySound(0x269);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(2.0), new TimerStateCallback(DeleteQiraji), qiraji);
                            }
                        }
                    }

                    // Qiraji Ambush 2
                    if (Utility.RandomDouble() < 0.008)
                    {
                        if (m.Map == Map.Tokuno)
                        {
                            int x2 = m.X - 5;
                            int y2 = m.Y - 5;
                            int z2 = Map.Tokuno.GetAverageZ(x2, y2);

                            if (Map.Tokuno.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature qiraji = new Qiraji();
                                qiraji.MoveToWorld(new Point3D(x2, y2, z2), Map.Tokuno);
                                qiraji.Combatant = m;
                                qiraji.PlaySound(0x269);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(2.0), new TimerStateCallback(DeleteQiraji), qiraji);
                            }
                        }
                    }
                }
            }
        }
Пример #34
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            if (m.Target != null)
            {
                m.SendLocalizedMessage(501845);                   // You are busy doing something else and cannot focus.

                return(TimeSpan.FromSeconds(5.0));
            }
            else if (m.Mana >= m.ManaMax)
            {
                m.SendLocalizedMessage(501846);                   // You are at peace.

                return(TimeSpan.FromSeconds(10.0));
            }
            else if (!RegenRates.AllowMeditation(m))
            {
                m.SendLocalizedMessage(500135);                   // Regenative forces cannot penetrate your armor!

                return(TimeSpan.FromSeconds(10.0));
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer(Layer.OneHanded);
                Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded);

                if (!CheckOkayHolding(oneHanded))
                {
                    m.AddToBackpack(oneHanded);
                }

                if (!CheckOkayHolding(twoHanded))
                {
                    m.AddToBackpack(twoHanded);
                }

                double skillVal = m.Skills[SkillName.Meditation].Value;
                double chance   = (75.0 + ((skillVal - (m.ManaMax - m.Mana)) * 2)) / 100;

                if (chance > Utility.RandomDouble())
                {
                    m.CheckSkill(SkillName.Meditation, 0.0, 100.0);

                    m.SendLocalizedMessage(501851);                       // You enter a meditative trance.
                    m.Meditating = true;

                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657));

                    if (m.Player || m.Body.IsHuman)
                    {
                        m.PlaySound(0xF9);
                    }
                }
                else
                {
                    m.SendLocalizedMessage(501850);                       // You cannot focus your concentration.
                }

                return(TimeSpan.FromSeconds(10.0));
            }
        }
        public override void Damage(Mobile m)
        {
            base.Damage(m);

            if (m.Alive)
            {
                PlayerMobile player = m as PlayerMobile;
                QuestSystem  qs     = player.Quest;

                if (qs is StolenNecklaceQuest)
                {
                    if (qs.IsObjectiveInProgress(typeof(ReturnStolenNecklaceObjective)))
                    {
                        // Brigand Ambush
                        if (Utility.RandomDouble() < 0.02)
                        {
                            if (m.Map == Map.Malas)
                            {
                                int x1 = m.X + 12;
                                int y1 = m.Y + 12;
                                int z1 = Map.Malas.GetAverageZ(x1, y1);

                                if (Map.Malas.CanSpawnMobile(x1, y1, z1))
                                {
                                    BaseCreature brigandmale = new BrigandMaleQuest();
                                    brigandmale.MoveToWorld(new Point3D(x1, y1, z1), Map.Malas);
                                    brigandmale.Combatant = m;

                                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                    Timer.DelayCall(TimeSpan.FromMinutes(1.0), new TimerStateCallback(DeleteBrigandMale), brigandmale);
                                }
                            }
                        }

                        // Brigand Ambush 2
                        if (Utility.RandomDouble() < 0.02)
                        {
                            if (m.Map == Map.Malas)
                            {
                                int x2 = m.X - 12;
                                int y2 = m.Y - 12;
                                int z2 = Map.Malas.GetAverageZ(x2, y2);

                                if (Map.Malas.CanSpawnMobile(x2, y2, z2))
                                {
                                    BaseCreature brigandfemale = new BrigandFemaleQuest();
                                    brigandfemale.MoveToWorld(new Point3D(x2, y2, z2), Map.Malas);
                                    brigandfemale.Combatant = m;

                                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                    Timer.DelayCall(TimeSpan.FromMinutes(1.0), new TimerStateCallback(DeleteBrigandFemale), brigandfemale);
                                }
                            }
                        }
                    }
                }

                PlayerMobile pm          = m as PlayerMobile;
                GreenCandle  greencandle = m.FindItemOnLayer(Layer.TwoHanded) as GreenCandle;

                if (greencandle != null && greencandle.Burning)
                {
                    // Swamp noises
                    if (Utility.RandomDouble() < 0.08)
                    {
                        m.PlaySound(Utility.RandomList(0x006, 0x007, 0x00E, 0x00F, 0x2B6, 0x2B7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Bird chirps
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x097, 0x0D1, 0x0D2, 0x0D3, 0x0D4, 0x29B, 0x29C, 0x29D, 0x29E, 0x29F, 0x2A0));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Air Elemental noises
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(0x107);
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Daemon noises
                    if (Utility.RandomDouble() < 0.010)
                    {
                        m.PlaySound(0x2B8);
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Cricket noises
                    if (Utility.RandomDouble() < 0.03)
                    {
                        m.PlaySound(Utility.RandomList(0x00A, 0x00B));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Wind
                    if (Utility.RandomDouble() < 0.04)
                    {
                        m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }
                }
                else
                {
                    // Swamp noises
                    if (Utility.RandomDouble() < 0.08)
                    {
                        m.PlaySound(Utility.RandomList(0x006, 0x007, 0x00E, 0x00F, 0x2B6, 0x2B7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Bird chirps
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x097, 0x0D1, 0x0D2, 0x0D3, 0x0D4, 0x29B, 0x29C, 0x29D, 0x29E, 0x29F, 0x2A0));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Air Elemental noises
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(0x107);
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Daemon noises
                    if (Utility.RandomDouble() < 0.010)
                    {
                        m.PlaySound(0x2B8);
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Cricket noises
                    if (Utility.RandomDouble() < 0.03)
                    {
                        m.PlaySound(Utility.RandomList(0x00A, 0x00B));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Wind
                    if (Utility.RandomDouble() < 0.04)
                    {
                        m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Annoying Llama Ambush 1
                    if (Utility.RandomDouble() < 0.02)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x1 = m.X + 20;
                            int y1 = m.Y + 20;
                            int z1 = Map.Malas.GetAverageZ(x1, y1);

                            if (Map.Malas.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature annoyingllama;
                                switch (Utility.Random(3))
                                {
                                default:
                                case 0: annoyingllama = new AnnoyingLlama1(); break;

                                case 1: annoyingllama = new AnnoyingLlama2(); break;

                                case 2: annoyingllama = new AnnoyingLlama3(); break;
                                }

                                annoyingllama.MoveToWorld(new Point3D(x1, y1, z1), Map.Malas);
                                annoyingllama.Combatant = m;

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(1.0), new TimerStateCallback(DeleteAnnoyingLlama), annoyingllama);
                            }
                        }
                    }

                    // Annoying Llama Ambush 2
                    if (Utility.RandomDouble() < 0.02)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x2 = m.X - 20;
                            int y2 = m.Y - 20;
                            int z2 = Map.Malas.GetAverageZ(x2, y2);

                            if (Map.Malas.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature annoyingllama;
                                switch (Utility.Random(3))
                                {
                                default:
                                case 0: annoyingllama = new AnnoyingLlama1(); break;

                                case 1: annoyingllama = new AnnoyingLlama2(); break;

                                case 2: annoyingllama = new AnnoyingLlama3(); break;
                                }

                                annoyingllama.MoveToWorld(new Point3D(x2, y2, z2), Map.Malas);
                                annoyingllama.Combatant = m;

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(1.0), new TimerStateCallback(DeleteAnnoyingLlama), annoyingllama);
                            }
                        }
                    }
                }
            }
        }
Пример #36
0
        public override bool OnEquip(Mobile from)
        {
            Item shirt = from.FindItemOnLayer(Layer.InnerTorso);
            Item pants = from.FindItemOnLayer(Layer.Pants);
            Item neck  = from.FindItemOnLayer(Layer.Neck);
            Item helm  = from.FindItemOnLayer(Layer.Helm);
            Item arms  = from.FindItemOnLayer(Layer.Arms);

            if (shirt != null && shirt.GetType() == typeof(MyrmidonChest) && pants != null && pants.GetType() == typeof(MyrmidonLegs) && neck != null && neck.GetType() == typeof(MyrmidonGorget) && helm != null && helm.GetType() == typeof(MyrmidonHelm) && arms != null && arms.GetType() == typeof(MyrmidonArms))
            {
                Effects.PlaySound(from.Location, from.Map, 503);
                from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);

                Hue = 0x2CA;
                ArmorAttributes.SelfRepair = 3;
                PhysicalBonus = 3;
                FireBonus     = 3;
                ColdBonus     = 3;
                PoisonBonus   = 3;
                EnergyBonus   = 3;

                MyrmidonChest  chest  = from.FindItemOnLayer(Layer.InnerTorso) as MyrmidonChest;
                MyrmidonLegs   legs   = from.FindItemOnLayer(Layer.Pants) as MyrmidonLegs;
                MyrmidonGorget gorget = from.FindItemOnLayer(Layer.Neck) as MyrmidonGorget;
                MyrmidonHelm   helmet = from.FindItemOnLayer(Layer.Helm) as MyrmidonHelm;
                MyrmidonArms   arm    = from.FindItemOnLayer(Layer.Arms) as MyrmidonArms;

                chest.Hue = 0x2CA;
                chest.Attributes.NightSight      = 1;
                chest.Attributes.Luck            = 500;
                chest.ArmorAttributes.SelfRepair = 3;
                chest.PhysicalBonus = 3;
                chest.FireBonus     = 3;
                chest.ColdBonus     = 3;
                chest.PoisonBonus   = 3;
                chest.EnergyBonus   = 3;

                legs.Hue = 0x2CA;
                legs.ArmorAttributes.SelfRepair = 3;
                legs.PhysicalBonus = 3;
                legs.FireBonus     = 3;
                legs.ColdBonus     = 3;
                legs.PoisonBonus   = 3;
                legs.EnergyBonus   = 3;

                gorget.Hue = 0x2CA;
                gorget.ArmorAttributes.SelfRepair = 3;
                gorget.PhysicalBonus = 3;
                gorget.FireBonus     = 3;
                gorget.ColdBonus     = 3;
                gorget.PoisonBonus   = 3;
                gorget.EnergyBonus   = 3;

                helmet.Hue = 0x2CA;
                helmet.ArmorAttributes.SelfRepair = 3;
                helmet.PhysicalBonus = 3;
                helmet.FireBonus     = 3;
                helmet.ColdBonus     = 3;
                helmet.PoisonBonus   = 3;
                helmet.EnergyBonus   = 3;

                arm.Hue = 0x2CA;
                arm.ArmorAttributes.SelfRepair = 3;
                arm.PhysicalBonus = 3;
                arm.FireBonus     = 3;
                arm.ColdBonus     = 3;
                arm.PoisonBonus   = 3;
                arm.EnergyBonus   = 3;


                from.SendLocalizedMessage(1072391);
            }
            this.InvalidateProperties();
            return(base.OnEquip(from));
        }
Пример #37
0
        protected override void OnTarget(Mobile from, object obj)
        {
            if (m_Bola.Deleted)
            {
                return;
            }

            if (obj is Mobile)
            {
                Mobile to = (Mobile)obj;

                if (!m_Bola.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it.
                }
                else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null))
                {
                    from.SendLocalizedMessage(1040015); // Your hands must be free to use this
                }
                else if (from.Mounted)
                {
                    from.SendLocalizedMessage(1040016); // You cannot use this while riding a mount
                }
                else if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(from))
                {
                    from.SendLocalizedMessage(1070902); // You can't use this while in an animal form!
                }
                else if (!to.Mounted)
                {
                    from.SendLocalizedMessage(1049628); // You have no reason to throw a bola at that.
                }
                else if (!from.CanBeHarmful(to))
                {
                }
                else if (from.BeginAction(typeof(Bola)))
                {
                    EtherealMount.StopMounting(from);

                    Item one = from.FindItemOnLayer(Layer.OneHanded);
                    Item two = from.FindItemOnLayer(Layer.TwoHanded);

                    if (one != null)
                    {
                        from.AddToBackpack(one);
                    }

                    if (two != null)
                    {
                        from.AddToBackpack(two);
                    }

                    from.DoHarmful(to);

                    if (Core.AOS)
                    {
                        BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(3.0));
                    }

                    m_Bola.Consume();

                    from.Direction = from.GetDirectionTo(to);
                    from.Animate(11, 5, 1, true, false, 0);
                    from.MovingEffect(to, 0x26AC, 10, 0, false, false);

                    Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(Bola.FinishThrow), new object[] { from, to });
                }
                else
                {
                    from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola!
                }
            }
            else
            {
                from.SendLocalizedMessage(1049629); // You cannot throw a bola at that.
            }
        }
Пример #38
0
        public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, ITool tool, Item item, CraftResource resource, Type resType, ref object resMessage)
        {
            if (item == null)
            {
                return(EnhanceResult.BadItem);
            }

            if (item is GargishNecklace || item is GargishEarrings)
            {
                return(EnhanceResult.BadItem);
            }

            if (!item.IsChildOf(from.Backpack))
            {
                return(EnhanceResult.NotInBackpack);
            }

            IResource ires = item as IResource;

            if (!CanEnhance(item) || ires == null)
            {
                return(EnhanceResult.BadItem);
            }

            if (item is IArcaneEquip)
            {
                IArcaneEquip eq = (IArcaneEquip)item;
                if (eq.IsArcane)
                {
                    return(EnhanceResult.BadItem);
                }
            }

            if (item is BaseWeapon && Spells.Mysticism.EnchantSpell.IsUnderSpellEffects(from, (BaseWeapon)item))
            {
                return(EnhanceResult.Enchanted);
            }

            if (CraftResources.IsStandard(resource))
            {
                return(EnhanceResult.BadResource);
            }

            int num = craftSystem.CanCraft(from, tool, item.GetType());

            if (num > 0)
            {
                resMessage = num;
                return(EnhanceResult.None);
            }

            CraftItem craftItem = craftSystem.CraftItems.SearchFor(item.GetType());

            if (IsSpecial(item, craftSystem))
            {
                craftItem = craftSystem.CraftItems.SearchForSubclass(item.GetType());
            }

            if (craftItem == null || craftItem.Resources.Count == 0)
            {
                return(EnhanceResult.BadItem);
            }

            #region Mondain's Legacy
            if (craftItem.ForceNonExceptional)
            {
                return(EnhanceResult.BadItem);
            }
            #endregion

            bool allRequiredSkills = false;
            if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0)
            {
                return(EnhanceResult.NoSkill);
            }

            CraftResourceInfo info = CraftResources.GetInfo(resource);

            if (info == null || info.ResourceTypes.Length == 0)
            {
                return(EnhanceResult.BadResource);
            }

            CraftAttributeInfo attributes = info.AttributeInfo;

            if (attributes == null)
            {
                return(EnhanceResult.BadResource);
            }

            int resHue = 0, maxAmount = 0;

            if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage))
            {
                return(EnhanceResult.NoResources);
            }

            if (!CraftResources.IsStandard(ires.Resource))
            {
                return(EnhanceResult.AlreadyEnhanced);
            }

            if (craftSystem is DefBlacksmithy)
            {
                AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;
                if (hammer != null)
                {
                    hammer.UsesRemaining--;
                    if (hammer.UsesRemaining < 1)
                    {
                        hammer.Delete();
                    }
                }
            }

            int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
            int dura = 0, luck = 0, lreq = 0, dinc = 0;
            int baseChance = 0;

            bool physBonus = false;
            bool fireBonus = false;
            bool coldBonus = false;
            bool nrgyBonus = false;
            bool poisBonus = false;
            bool duraBonus = false;
            bool luckBonus = false;
            bool lreqBonus = false;
            bool dincBonus = false;

            if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (weapon.ExtendedWeaponAttributes.AssassinHoned > 0)
                {
                    return(EnhanceResult.BadItem);
                }

                baseChance = 20;

                dura = weapon.MaxHitPoints;
                luck = weapon.Attributes.Luck;
                lreq = weapon.WeaponAttributes.LowerStatReq;
                dinc = weapon.Attributes.WeaponDamage;

                fireBonus = (attributes.WeaponFireDamage > 0);
                coldBonus = (attributes.WeaponColdDamage > 0);
                nrgyBonus = (attributes.WeaponEnergyDamage > 0);
                poisBonus = (attributes.WeaponPoisonDamage > 0);

                duraBonus = (attributes.WeaponDurability > 0);
                luckBonus = (attributes.WeaponLuck > 0);
                lreqBonus = (attributes.WeaponLowerRequirements > 0);
                dincBonus = (dinc > 0);
            }
            else if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                baseChance = 20;

                phys = armor.PhysicalResistance;
                fire = armor.FireResistance;
                cold = armor.ColdResistance;
                pois = armor.PoisonResistance;
                nrgy = armor.EnergyResistance;

                dura = armor.MaxHitPoints;
                luck = armor.Attributes.Luck;
                lreq = armor.ArmorAttributes.LowerStatReq;

                physBonus = (attributes.ArmorPhysicalResist > 0);
                fireBonus = (attributes.ArmorFireResist > 0);
                coldBonus = (attributes.ArmorColdResist > 0);
                nrgyBonus = (attributes.ArmorEnergyResist > 0);
                poisBonus = (attributes.ArmorPoisonResist > 0);

                duraBonus = (attributes.ArmorDurability > 0);
                luckBonus = (attributes.ArmorLuck > 0);
                lreqBonus = (attributes.ArmorLowerRequirements > 0);
                dincBonus = false;
            }
            else if (item is FishingPole)
            {
                FishingPole pole = (FishingPole)item;

                baseChance = 20;

                luck = pole.Attributes.Luck;

                luckBonus = (attributes.ArmorLuck > 0);
                lreqBonus = (attributes.ArmorLowerRequirements > 0);
                dincBonus = false;
            }

            int skill = from.Skills[craftSystem.MainSkill].Fixed / 10;

            if (skill >= 100)
            {
                baseChance -= (skill - 90) / 10;
            }

            EnhanceResult res = EnhanceResult.Success;

            PlayerMobile user = from as PlayerMobile;

            if (physBonus)
            {
                CheckResult(ref res, baseChance + phys);
            }

            if (fireBonus)
            {
                CheckResult(ref res, baseChance + fire);
            }

            if (coldBonus)
            {
                CheckResult(ref res, baseChance + cold);
            }

            if (nrgyBonus)
            {
                CheckResult(ref res, baseChance + nrgy);
            }

            if (poisBonus)
            {
                CheckResult(ref res, baseChance + pois);
            }

            if (duraBonus)
            {
                CheckResult(ref res, baseChance + (dura / 40));
            }

            if (luckBonus)
            {
                CheckResult(ref res, baseChance + 10 + (luck / 2));
            }

            if (lreqBonus)
            {
                CheckResult(ref res, baseChance + (lreq / 4));
            }

            if (dincBonus)
            {
                CheckResult(ref res, baseChance + (dinc / 4));
            }

            if (user.NextEnhanceSuccess)
            {
                user.NextEnhanceSuccess = false;
                user.SendLocalizedMessage(1149969); // The magical aura that surrounded you disipates and you feel that your item enhancement chances have returned to normal.
                res = EnhanceResult.Success;
            }

            switch (res)
            {
            case EnhanceResult.Broken:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                item.Delete();
                break;
            }

            case EnhanceResult.Success:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                if (item is IResource)
                {
                    ((IResource)item).Resource = resource;
                }

                if (item is BaseWeapon)
                {
                    BaseWeapon w = (BaseWeapon)item;
                    w.DistributeMaterialBonus(attributes);

                    int hue = w.GetElementalDamageHue();

                    if (hue > 0)
                    {
                        w.Hue = hue;
                    }
                }
                else if (item is BaseArmor)             //Sanity
                {
                    ((BaseArmor)item).DistributeMaterialBonus(attributes);
                }
                else if (item is FishingPole)
                {
                    ((FishingPole)item).DistributeMaterialBonus(attributes);
                }
                break;
            }

            case EnhanceResult.Failure:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                break;
            }
            }

            return(res);
        }
Пример #39
0
        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                Mobile m = ( Mobile )parent;
                Hue = 0x0;
                ArmorAttributes.SelfRepair = 0;
                PhysicalBonus = 0;
                FireBonus     = 0;
                ColdBonus     = 0;
                PoisonBonus   = 0;
                EnergyBonus   = 0;
                if (m.FindItemOnLayer(Layer.InnerTorso) is MyrmidonChest && m.FindItemOnLayer(Layer.Pants) is MyrmidonLegs && m.FindItemOnLayer(Layer.Arms) is MyrmidonArms && m.FindItemOnLayer(Layer.Neck) is MyrmidonGorget && m.FindItemOnLayer(Layer.Helm) is MyrmidonHelm)
                {
                    MyrmidonChest chest = m.FindItemOnLayer(Layer.InnerTorso) as MyrmidonChest;
                    chest.Hue = 0x0;
                    chest.Attributes.NightSight      = 0;
                    chest.Attributes.Luck            = 0;
                    chest.ArmorAttributes.SelfRepair = 0;
                    chest.PhysicalBonus = 0;
                    chest.FireBonus     = 0;
                    chest.ColdBonus     = 0;
                    chest.PoisonBonus   = 0;
                    chest.EnergyBonus   = 0;


                    MyrmidonLegs legs = m.FindItemOnLayer(Layer.Pants) as MyrmidonLegs;
                    legs.Hue = 0x0;
                    legs.ArmorAttributes.SelfRepair = 0;
                    legs.PhysicalBonus = 0;
                    legs.FireBonus     = 0;
                    legs.ColdBonus     = 0;
                    legs.PoisonBonus   = 0;
                    legs.EnergyBonus   = 0;

                    MyrmidonArms arm = m.FindItemOnLayer(Layer.Arms) as MyrmidonArms;
                    arm.Hue = 0x0;
                    arm.ArmorAttributes.SelfRepair = 0;
                    arm.PhysicalBonus = 0;
                    arm.FireBonus     = 0;
                    arm.ColdBonus     = 0;
                    arm.PoisonBonus   = 0;
                    arm.EnergyBonus   = 0;

                    MyrmidonGorget gorget = m.FindItemOnLayer(Layer.Neck) as MyrmidonGorget;
                    gorget.Hue = 0x0;
                    gorget.ArmorAttributes.SelfRepair = 0;
                    gorget.PhysicalBonus = 0;
                    gorget.FireBonus     = 0;
                    gorget.ColdBonus     = 0;
                    gorget.PoisonBonus   = 0;
                    gorget.EnergyBonus   = 0;

                    MyrmidonHelm helmet = m.FindItemOnLayer(Layer.Helm) as MyrmidonHelm;
                    helmet.Hue = 0x0;
                    helmet.ArmorAttributes.SelfRepair = 0;
                    helmet.PhysicalBonus = 0;
                    helmet.FireBonus     = 0;
                    helmet.ColdBonus     = 0;
                    helmet.PoisonBonus   = 0;
                    helmet.EnergyBonus   = 0;
                }
                this.InvalidateProperties();
            }
            base.OnRemoved(parent);
        }
Пример #40
0
 public static Spellbook FindEquippedSpellbook(Mobile from)
 {
     return(from.FindItemOnLayer(Layer.OneHanded) as Spellbook);
 }
Пример #41
0
        public override TimeSpan OnSwing(Mobile attacker, Mobile defender)
        {
            if (attacker.StunReady)
            {
                if (attacker.CanBeginAction(typeof(Fists)))
                {
                    if (attacker.Skills[SkillName.Anatomy].Value >= 80.0 && attacker.Skills[SkillName.Wrestling].Value >= 80.0)
                    {
                        if (attacker.Stam >= 15)
                        {
                            attacker.Stam -= 15;

                            if (CheckMove(attacker, SkillName.Anatomy))
                            {
                                StartMoveDelay(attacker);

                                attacker.StunReady = false;

                                attacker.SendLocalizedMessage(1004013);                                   // You successfully stun your opponent!
                                defender.SendLocalizedMessage(1004014);                                   // You have been stunned!

                                defender.Freeze(TimeSpan.FromSeconds(4.0));
                            }
                            else
                            {
                                attacker.SendLocalizedMessage(1004010);                                   // You failed in your attempt to stun.
                                defender.SendLocalizedMessage(1004011);                                   // Your opponent tried to stun you and failed.
                            }
                        }
                        else
                        {
                            attacker.SendLocalizedMessage(1004009);                               // You are too fatigued to attempt anything.
                        }
                    }
                    else
                    {
                        attacker.SendLocalizedMessage(1004008);                           // You are not skilled enough to stun your opponent.
                        attacker.StunReady = false;
                    }
                }
            }
            else if (attacker.DisarmReady)
            {
                if (attacker.CanBeginAction(typeof(Fists)))
                {
                    if (defender.Player || defender.Body.IsHuman)
                    {
                        if (attacker.Skills[SkillName.ArmsLore].Value >= 80.0 && attacker.Skills[SkillName.Wrestling].Value >= 80.0)
                        {
                            if (attacker.Stam >= 15)
                            {
                                Item toDisarm = defender.FindItemOnLayer(Layer.OneHanded);

                                if (toDisarm == null || !toDisarm.Movable)
                                {
                                    toDisarm = defender.FindItemOnLayer(Layer.TwoHanded);
                                }

                                Container pack = defender.Backpack;

                                if (pack == null || toDisarm == null || !toDisarm.Movable)
                                {
                                    attacker.SendLocalizedMessage(1004001);                                       // You cannot disarm your opponent.
                                }
                                else if (CheckMove(attacker, SkillName.ArmsLore))
                                {
                                    StartMoveDelay(attacker);

                                    attacker.Stam       -= 15;
                                    attacker.DisarmReady = false;

                                    attacker.SendLocalizedMessage(1004006);                                       // You successfully disarm your opponent!
                                    defender.SendLocalizedMessage(1004007);                                       // You have been disarmed!

                                    pack.DropItem(toDisarm);
                                }
                                else
                                {
                                    attacker.Stam -= 15;

                                    attacker.SendLocalizedMessage(1004004);                                       // You failed in your attempt to disarm.
                                    defender.SendLocalizedMessage(1004005);                                       // Your opponent tried to disarm you but failed.
                                }
                            }
                            else
                            {
                                attacker.SendLocalizedMessage(1004003);                                   // You are too fatigued to attempt anything.
                            }
                        }
                        else
                        {
                            attacker.SendLocalizedMessage(1004002);                               // You are not skilled enough to disarm your opponent.
                            attacker.DisarmReady = false;
                        }
                    }
                    else
                    {
                        attacker.SendLocalizedMessage(1004001);                           // You cannot disarm your opponent.
                    }
                }
            }

            return(base.OnSwing(attacker, defender));
        }
Пример #42
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled && e.HasKeyword(0x003B) && e.Mobile.InRange(this.Location, 2)) //hello
            {
                e.Handled = true;

                Mobile m = e.Mobile;

                if (Shield is OrderShield && (m.FindItemOnLayer(Layer.TwoHanded) is OrderShield || (m.Backpack != null && m.Backpack.FindItemByType(typeof(OrderShield)) != null)))
                {
                    switch (Utility.Random(10))
                    {
                    case 0: Say(true, "Greetings, fellow guard."); break;

                    case 1: Say(true, "In the name of our liege, greetings!"); break;

                    case 2: Say(true, "Greetings, my friend."); break;

                    case 3: Say(true, "Hail, my friend."); break;

                    case 4: Say(true, "Hail and well met!"); break;
                    }
                    ;
                }
                else if (Shield is ChaosShield && (m.FindItemOnLayer(Layer.TwoHanded) is ChaosShield || (m.Backpack != null && m.Backpack.FindItemByType(typeof(ChaosShield)) != null)))
                {
                    switch (Utility.Random(10))
                    {
                    case 0: Say(true, "Greetings, fellow guard."); break;

                    case 1: Say(true, "In the name of our liege, greetings!"); break;

                    case 2: Say(true, "Greetings, my friend."); break;

                    case 3: Say(true, "Hail, my friend."); break;

                    case 4: Say(true, "Hail and well met!"); break;
                    }
                    ;
                }
                else if (Shield is OrderShield && (m.FindItemOnLayer(Layer.TwoHanded) is ChaosShield || (m.Backpack != null && m.Backpack.FindItemByType(typeof(ChaosShield)) != null)))
                {
                    switch (Utility.Random(0, 7))
                    {
                    case 0: Say(true, "Stay away, lest our rivalry develop into something worse!"); break;

                    case 1: Say(true, "Thou'rt not of my brotherhood! Away with thee!"); break;

                    case 2: Say(true, "Whilst I grant respect to thy lord, I mislike thy emblem."); break;

                    case 3: Say(true, "Art thou here to harass me?"); break;

                    case 4: Say(true, "Tch tch... thou wearest the wrong emblem!"); break;

                    case 5: Say(true, "'Tis a pity that thou art in the wrong camp!"); break;

                    case 6: Say(true, "There is a rivalry between thy group and mine--be careful."); break;

                    case 7: Say(true, "Is not thy emblem a sign that thou art a member of our rival guards?"); break;
                    }
                }
                else if (Shield is ChaosShield && (m.FindItemOnLayer(Layer.TwoHanded) is OrderShield || (m.Backpack != null && m.Backpack.FindItemByType(typeof(OrderShield)) != null)))
                {
                    switch (Utility.Random(0, 7))
                    {
                    case 0: Say(true, "Stay away, lest our rivalry develop into something worse!"); break;

                    case 1: Say(true, "Thou'rt not of my brotherhood! Away with thee!"); break;

                    case 2: Say(true, "Whilst I grant respect to thy lord, I mislike thy emblem."); break;

                    case 3: Say(true, "Art thou here to harass me?"); break;

                    case 4: Say(true, "Tch tch... thou wearest the wrong emblem!"); break;

                    case 5: Say(true, "'Tis a pity that thou art in the wrong camp!"); break;

                    case 6: Say(true, "There is a rivalry between thy group and mine--be careful."); break;

                    case 7: Say(true, "Is not thy emblem a sign that thou art a member of our rival guards?"); break;
                    }
                }
                else if (m.Karma == 127)
                {
                    if (Shield is OrderShield)
                    {
                        switch (Utility.Random(5))
                        {
                        case 0: Say(true, "Thou hast the look of a likely candidate for joining Lord British's guards."); break;

                        case 1: Say(true, "Wouldst thou be interested in joining British's guard?"); break;

                        case 2: Say(true, "British's guard hath been looking for folk like thee."); break;

                        case 3: Say(true, "Thou'rt a good and honest person. Care to join Lord British's guard?"); break;

                        case 4: Say(true, "If thou art interested in joining Lord British's guard, a place can be found for thee."); break;
                        }
                        ;


                        Say(true, "Say 'order shield' if thou art interested.");
                    }
                    else if (Shield is ChaosShield)
                    {
                        switch (Utility.Random(5))
                        {
                        case 0: Say(true, "Thou hast the look of a likely candidate for joining Lord Blackthorn's guards."); break;

                        case 1: Say(true, "Wouldst thou be interested in joining Blackthorn's guard?"); break;

                        case 2: Say(true, "Blackthorn's guard hath been looking for folk like thee."); break;

                        case 3: Say(true, "Thou'rt a good and honest person. Care to join Lord Blackthorn's guard?"); break;

                        case 4: Say(true, "If thou art interested in joining Lord Blackthorn's guard, a place can be found for thee."); break;
                        }
                        ;

                        Say(true, "Say 'chaos shield' if thou art interested.");
                    }
                }
                else if (m.Karma < 127)
                {
                    if (Shield is OrderShield)
                    {
                        Say(true, "Wouldst thou be interested in joining British's guard?");
                        Say(true, "Say 'order shield' if thou art interested.");
                    }
                    else if (Shield is ChaosShield)
                    {
                        Say(true, "Wouldst thou be interested in joining Blackthorn's guard?");
                        Say(true, "Say 'chaos shield' if thou art interested.");
                    }
                }
            }

            if (!e.Handled && (e.HasKeyword(Keyword) || e.HasKeyword(0x0020)) && e.Mobile.InRange(this.Location, 2)) //virtue guard, order shield, chaos shield
            {
                e.Handled = true;

                Mobile from = e.Mobile;

                if (from.Karma < 127)
                {
                    switch (Utility.Random(0, 6))
                    {
                    case 0: Say(true, "Thou art not worthy of being a member of our fraternity."); break;

                    case 1: Say(true, "The guards will not accept thee until thy reputation improves."); break;

                    case 2: Say(true, "Thou hast not the unblemished record we expect from our members."); break;

                    case 3: Say(true, "Thy record is not good enough to join the guards."); break;

                    case 4: Say(true, "Only those of utmost probity are accepted into the guards."); break;

                    case 5: Say(true, "Only the very best of citizens may join the guards."); break;

                    case 6: Say(true, "Thou dost not qualify for the virtue guards; thy record is not good enough."); break;
                    }
                    if (from.Karma < -39)
                    {
                        Say(true, "Do not dishonor us by asking again, scum.");
                    }
                    if (from.Karma > 109)
                    {
                        Say(true, " Thou'rt extremely close, however.");
                    }
                }
                else
                {
                    Container  pack      = from.Backpack;
                    BaseShield shield    = Shield;
                    Item       twoHanded = from.FindItemOnLayer(Layer.TwoHanded);

                    if ((pack != null && pack.FindItemByType(shield.GetType()) != null) || (twoHanded != null && shield.GetType().IsAssignableFrom(twoHanded.GetType())))
                    {
                        switch (Utility.Random(0, 4))
                        {
                        case 0: Say(true, "Yes, thou'rt a virtue guard."); break;

                        case 1: Say(true, "Hmm? Yes, I am one. So art thou."); break;

                        case 2: Say(true, "Yes, as thou knowest, it is a great thing to be one!"); break;

                        case 3: Say(true, "Isn't it wonderful being a virtue guard?"); break;

                        case 4: Say(true, "Why dost thou ask about virtue guards when thou art one?"); break;
                        }
                        shield.Delete();
                    }
                    else if (pack != null && (Shield is OrderShield && pack.FindItemByType(typeof(ChaosShield)) != null) || (twoHanded != null && (Shield is OrderShield && twoHanded is ChaosShield)))
                    {
                        switch (Utility.Random(0, 7))
                        {
                        case 0: Say(true, "Stay away, lest our rivalry develop into something worse!"); break;

                        case 1: Say(true, "Thou'rt not of my brotherhood! Away with thee!"); break;

                        case 2: Say(true, "Whilst I grant respect to thy lord, I mislike thy emblem."); break;

                        case 3: Say(true, "Art thou here to harass me?"); break;

                        case 4: Say(true, "Tch tch... thou wearest the wrong emblem!"); break;

                        case 5: Say(true, "'Tis a pity that thou art in the wrong camp!"); break;

                        case 6: Say(true, "There is a rivalry between thy group and mine--be careful."); break;

                        case 7: Say(true, "Is not thy emblem a sign that thou art a member of our rival guards?"); break;
                        }
                        shield.Delete();
                    }
                    else if (pack != null && (Shield is ChaosShield && pack.FindItemByType(typeof(OrderShield)) != null) || (twoHanded != null && (Shield is ChaosShield && twoHanded is OrderShield)))
                    {
                        switch (Utility.Random(0, 7))
                        {
                        case 0: Say(true, "Stay away, lest our rivalry develop into something worse!"); break;

                        case 1: Say(true, "Thou'rt not of my brotherhood! Away with thee!"); break;

                        case 2: Say(true, "Whilst I grant respect to thy lord, I mislike thy emblem."); break;

                        case 3: Say(true, "Art thou here to harass me?"); break;

                        case 4: Say(true, "Tch tch... thou wearest the wrong emblem!"); break;

                        case 5: Say(true, "'Tis a pity that thou art in the wrong camp!"); break;

                        case 6: Say(true, "There is a rivalry between thy group and mine--be careful."); break;

                        case 7: Say(true, "Is not thy emblem a sign that thou art a member of our rival guards?"); break;
                        }
                        shield.Delete();
                    }
                    else if (from.PlaceInBackpack(shield))
                    {
                        Say(true, "Thy shield is in thy backpack. Be sure thou dost not lose thy reputation, or else thou shalt lose thy life with it.");
                        from.AddToBackpack(shield);
                    }
                    else
                    {
                        from.SendAsciiMessage("Your backpack is too full."); // Your backpack is too full.
                        shield.Delete();
                    }
                }

                /*if ( g == null || g.Type != Type )
                 * {
                 *      Say( SignupNumber );
                 * }
                 * else
                 * {
                 *      Container pack = from.Backpack;
                 *      BaseShield shield = Shield;
                 *      Item twoHanded = from.FindItemOnLayer( Layer.TwoHanded );
                 *
                 *      if ( (pack != null && pack.FindItemByType( shield.GetType() ) != null) || ( twoHanded != null && shield.GetType().IsAssignableFrom( twoHanded.GetType() ) ) )
                 *      {
                 *              Say( 1007110 ); // Why dost thou ask about virtue guards when thou art one?
                 *              shield.Delete();
                 *      }
                 *      else if ( from.PlaceInBackpack( shield ) )
                 *      {
                 *              Say( Utility.Random( 1007101, 5 ) );
                 *              Say( 1007139 ); // I see you are in need of our shield, Here you go.
                 *              from.AddToBackpack( shield );
                 *      }
                 *      else
                 *      {
                 *              from.SendLocalizedMessage( 502868 ); // Your backpack is too full.
                 *              shield.Delete();
                 *      }
                 * }*/
            }

            base.OnSpeech(e);
        }
Пример #43
0
        private bool CheckUse(Mobile from, bool successMessage)
        {
            BraceletOfBinding bound = Bound;

            if (bound == null)
            {
                return(false);
            }

            Mobile boundRoot = bound.RootParent as Mobile;

            if (Charges == 0)
            {
                from.SendLocalizedMessage(1054005); // The bracelet glows black. It must be charged before it can be used again.
                return(false);
            }
            else if (from.FindItemOnLayer(Layer.Bracelet) != this)
            {
                from.SendLocalizedMessage(1054004); // You must equip the bracelet in order to use its power.
                return(false);
            }
            else if (boundRoot == null || boundRoot.NetState == null || boundRoot.FindItemOnLayer(Layer.Bracelet) != bound)
            {
                from.SendLocalizedMessage(1054006); // The bracelet emits a red glow. The bracelet's twin is not available for transport.
                return(false);
            }
            else if (!SpellHelper.CheckTravel(from, TravelCheckType.RecallFrom))
            {
                return(false);
            }
            else if (!SpellHelper.CheckTravel(from, boundRoot.Map, boundRoot.Location, TravelCheckType.RecallTo))
            {
                return(false);
            }
            else if (boundRoot.Map == Map.Felucca && from is PlayerMobile && ((PlayerMobile)from).Young)
            {
                from.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
                return(false);
            }
            else if (SpellHelper.RestrictRedTravel && from.Murderer && boundRoot.Map != Map.Felucca)
            {
                from.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                return(false);
            }
            else if (from.Criminal)
            {
                from.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
                return(false);
            }
            else if (SpellHelper.CheckCombat(from))
            {
                from.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                return(false);
            }
            else if (Server.Misc.WeightOverloading.IsOverloaded(from))
            {
                from.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
                return(false);
            }
            else if (from.Region.IsPartOf <Server.Regions.Jail>())
            {
                from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
                return(false);
            }
            else if (boundRoot.Region.IsPartOf <Server.Regions.Jail>())
            {
                from.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                return(false);
            }
            else
            {
                if (successMessage)
                {
                    from.SendLocalizedMessage(1054015); // The bracelet's twin is available for transport.
                }
                return(true);
            }
        }
Пример #44
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(this.GetWorldLocation(), 2))
            {
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    ArrayList items = new ArrayList(this.Items);

                    bool gathered = false;
                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = (Item)items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable || !GetRestoreInfo(item, ref loc))
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                Map map = from.Map;

                                if (map != null && map != Map.Internal)
                                {
                                    robe.MoveToWorld(from.Location, map);
                                }
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        m_Carved = true;

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID = Utility.Random(0xECA, 9);                               // bone graphic
                            Hue    = 0;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                           // You quickly gather all of your belongings.
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                           // You gather some of your belongings. The rest remain on the corpse.
                    }
                }

                if (!CheckLoot(from))
                {
                    return;
                }

                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is UzeraanTurmoilQuest)
                    {
                        GetDaemonBoneObjective obj = qs.FindObjective(typeof(GetDaemonBoneObjective)) as GetDaemonBoneObjective;

                        if (obj != null && obj.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
                        {
                            Item bone = new QuestDaemonBone();

                            if (player.PlaceInBackpack(bone))
                            {
                                obj.CorpseWithBone = null;
                                player.SendLocalizedMessage(1049341, "", 0x22);                                   // You rummage through the bones and find a Daemon Bone!  You quickly place the item in your pack.

                                if (!obj.Completed)
                                {
                                    obj.Complete();
                                }
                            }
                            else
                            {
                                bone.Delete();
                                player.SendLocalizedMessage(1049342, "", 0x22);                                   // Rummaging through the bones you find a Daemon Bone, but can't pick it up because your pack is too full.  Come back when you have more room in your pack.
                            }

                            return;
                        }
                    }
                    else if (qs is TheSummoningQuest)
                    {
                        VanquishDaemonObjective obj = qs.FindObjective(typeof(VanquishDaemonObjective)) as VanquishDaemonObjective;

                        if (obj != null && obj.Completed && obj.CorpseWithSkull == this)
                        {
                            GoldenSkull sk = new GoldenSkull();

                            if (player.PlaceInBackpack(sk))
                            {
                                obj.CorpseWithSkull = null;
                                player.SendLocalizedMessage(1050022);                                   // For your valor in combating the devourer, you have been awarded a golden skull.
                                qs.Complete();
                            }
                            else
                            {
                                sk.Delete();
                                player.SendLocalizedMessage(1050023);                                   // You find a golden skull, but your backpack is too full to carry it.
                            }
                        }
                    }
                }

                base.OnDoubleClick(from);

                if (from != m_Owner)
                {
                    from.RevealingAction();
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
                return;
            }
        }
Пример #45
0
        public static void CheckReflect(int circle, ref Mobile caster, ref Mobile target)
        {
            if (target.FindItemOnLayer(Layer.OuterTorso) is RobeOfReflection && (caster != target) && target.CheckSkill(SkillName.Magery, caster.Skills.Magery.Value * 0.5, caster.Skills.Magery.Value * 1.5))
            {
                RobeOfReflection ror = (RobeOfReflection)target.FindItemOnLayer(Layer.OuterTorso);

                if (ror.IsArcane && ror.CurArcaneCharges >= 0)
                {
                    target.FixedEffect(0x37B9, 10, 5);

                    Mobile temp = caster;
                    caster = target;
                    target = temp;

                    ror.CurArcaneCharges--;

                    return;
                }
            }

            if (target.MagicDamageAbsorb > 0)
            {
                ++circle;

                target.MagicDamageAbsorb -= circle;

                // This order isn't very intuitive, but you have to nullify reflect before target gets switched

                bool reflect = (target.MagicDamageAbsorb >= 0);

                if (target is BaseCreature)
                {
                    ((BaseCreature)target).CheckReflect(caster, ref reflect);
                }

                if (target.MagicDamageAbsorb <= 0)
                {
                    target.MagicDamageAbsorb = 0;
                    DefensiveSpell.Nullify(target);
                }

                if (reflect)
                {
                    target.FixedEffect(0x37B9, 10, 5);

                    Mobile temp = caster;
                    caster = target;
                    target = temp;
                }
            }
            else if (target is BaseCreature)
            {
                bool reflect = false;

                ((BaseCreature)target).CheckReflect(caster, ref reflect);

                if (reflect)
                {
                    target.FixedEffect(0x37B9, 10, 5);

                    Mobile temp = caster;
                    caster = target;
                    target = temp;
                }
            }
        }
Пример #46
0
        public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, BaseTool tool, Item item,
                                           CraftResource resource, Type resType, ref object resMessage)
        {
            if (item == null)
            {
                return(EnhanceResult.BadItem);
            }

            if (!item.IsChildOf(from.Backpack))
            {
                return(EnhanceResult.NotInBackpack);
            }

            if (!(item is BaseArmor) && !(item is BaseWeapon))
            {
                return(EnhanceResult.BadItem);
            }

            if (item is IArcaneEquip eq && eq.IsArcane)
            {
                return(EnhanceResult.BadItem);
            }

            if (CraftResources.IsStandard(resource))
            {
                return(EnhanceResult.BadResource);
            }

            int num = craftSystem.CanCraft(from, tool, item.GetType());

            if (num > 0)
            {
                resMessage = num;
                return(EnhanceResult.None);
            }

            CraftItem craftItem = craftSystem.CraftItems.SearchFor(item.GetType());

            if (craftItem == null || craftItem.Resources.Count == 0)
            {
                return(EnhanceResult.BadItem);
            }

            if (craftItem.GetSuccessChance(from, resType, craftSystem, false, out _) <= 0.0)
            {
                return(EnhanceResult.NoSkill);
            }

            CraftResourceInfo info = CraftResources.GetInfo(resource);

            if (info == null || info.ResourceTypes.Length == 0)
            {
                return(EnhanceResult.BadResource);
            }

            CraftAttributeInfo attributes = info.AttributeInfo;

            if (attributes == null)
            {
                return(EnhanceResult.BadResource);
            }

            int resHue = 0, maxAmount = 0;

            if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None,
                                      ref resMessage))
            {
                return(EnhanceResult.NoResources);
            }

            if (craftSystem is DefBlacksmithy)
            {
                if (from.FindItemOnLayer(Layer.OneHanded) is AncientSmithyHammer hammer)
                {
                    hammer.UsesRemaining--;
                    if (hammer.UsesRemaining < 1)
                    {
                        hammer.Delete();
                    }
                }
            }

            int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
            int dura, luck, lreq, dinc = 0;
            int baseChance;

            bool physBonus = false;
            bool fireBonus;
            bool coldBonus;
            bool nrgyBonus;
            bool poisBonus;
            bool duraBonus;
            bool luckBonus;
            bool lreqBonus;
            bool dincBonus;

            if (item is BaseWeapon weapon)
            {
                if (!CraftResources.IsStandard(weapon.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                baseChance = 20;

                dura = weapon.MaxHitPoints;
                luck = weapon.Attributes.Luck;
                lreq = weapon.WeaponAttributes.LowerStatReq;
                dinc = weapon.Attributes.WeaponDamage;

                fireBonus = attributes.WeaponFireDamage > 0;
                coldBonus = attributes.WeaponColdDamage > 0;
                nrgyBonus = attributes.WeaponEnergyDamage > 0;
                poisBonus = attributes.WeaponPoisonDamage > 0;

                duraBonus = attributes.WeaponDurability > 0;
                luckBonus = attributes.WeaponLuck > 0;
                lreqBonus = attributes.WeaponLowerRequirements > 0;
                dincBonus = dinc > 0;
            }
            else
            {
                BaseArmor armor = (BaseArmor)item;

                if (!CraftResources.IsStandard(armor.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                baseChance = 20;

                phys = armor.PhysicalResistance;
                fire = armor.FireResistance;
                cold = armor.ColdResistance;
                pois = armor.PoisonResistance;
                nrgy = armor.EnergyResistance;

                dura = armor.MaxHitPoints;
                luck = armor.Attributes.Luck;
                lreq = armor.ArmorAttributes.LowerStatReq;

                physBonus = attributes.ArmorPhysicalResist > 0;
                fireBonus = attributes.ArmorFireResist > 0;
                coldBonus = attributes.ArmorColdResist > 0;
                nrgyBonus = attributes.ArmorEnergyResist > 0;
                poisBonus = attributes.ArmorPoisonResist > 0;

                duraBonus = attributes.ArmorDurability > 0;
                luckBonus = attributes.ArmorLuck > 0;
                lreqBonus = attributes.ArmorLowerRequirements > 0;
                dincBonus = false;
            }

            int skill = from.Skills[craftSystem.MainSkill].Fixed / 10;

            if (skill >= 100)
            {
                baseChance -= (skill - 90) / 10;
            }

            EnhanceResult res = EnhanceResult.Success;

            if (physBonus)
            {
                CheckResult(ref res, baseChance + phys);
            }

            if (fireBonus)
            {
                CheckResult(ref res, baseChance + fire);
            }

            if (coldBonus)
            {
                CheckResult(ref res, baseChance + cold);
            }

            if (nrgyBonus)
            {
                CheckResult(ref res, baseChance + nrgy);
            }

            if (poisBonus)
            {
                CheckResult(ref res, baseChance + pois);
            }

            if (duraBonus)
            {
                CheckResult(ref res, baseChance + dura / 40);
            }

            if (luckBonus)
            {
                CheckResult(ref res, baseChance + 10 + luck / 2);
            }

            if (lreqBonus)
            {
                CheckResult(ref res, baseChance + lreq / 4);
            }

            if (dincBonus)
            {
                CheckResult(ref res, baseChance + dinc / 4);
            }

            switch (res)
            {
            case EnhanceResult.Broken:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half,
                                          ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                item.Delete();
                break;
            }

            case EnhanceResult.Success:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All,
                                          ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                if (item is BaseWeapon w)
                {
                    w.Resource = resource;

                    int hue = w.GetElementalDamageHue();
                    if (hue > 0)
                    {
                        w.Hue = hue;
                    }
                }
                else
                {
                    ((BaseArmor)item).Resource = resource;
                }

                break;
            }

            case EnhanceResult.Failure:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half,
                                          ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                break;
            }
            }

            return(res);
        }
Пример #47
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            if (m.Target != null)
            {
                m.SendLocalizedMessage(501845);                   // You are busy doing something else and cannot focus.

                return(TimeSpan.FromSeconds(5.0));
            }
            else if (!Core.AOS && m.Hits < (m.HitsMax / 10))      // Less than 10% health
            {
                m.SendLocalizedMessage(501849);                   // The mind is strong but the body is weak.

                return(TimeSpan.FromSeconds(5.0));
            }
            else if (m.Mana >= m.ManaMax)
            {
                m.SendLocalizedMessage(501846);                   // You are at peace.

                return(TimeSpan.FromSeconds(Core.AOS ? 10.0 : 5.0));
            }
            else if (Core.AOS && Server.Misc.RegenRates.GetArmorOffset(m) > 0)
            {
                m.SendLocalizedMessage(500135);                   // Regenative forces cannot penetrate your armor!

                return(TimeSpan.FromSeconds(10.0));
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer(Layer.OneHanded);
                Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded);

                if (Core.AOS && m.Player)
                {
                    if (!CheckOkayHolding(oneHanded))
                    {
                        m.AddToBackpack(oneHanded);
                    }

                    if (!CheckOkayHolding(twoHanded))
                    {
                        m.AddToBackpack(twoHanded);
                    }
                }
                else if (!CheckOkayHolding(oneHanded) || !CheckOkayHolding(twoHanded))
                {
                    m.SendLocalizedMessage(502626);                       // Your hands must be free to cast spells or meditate.

                    return(TimeSpan.FromSeconds(2.5));
                }

                double skillVal = m.Skills[SkillName.Meditation].Value;
                double chance   = (50.0 + ((skillVal - (m.ManaMax - m.Mana)) * 2)) / 100;

                if (chance > Utility.RandomDouble())
                {
                    m.CheckSkill(SkillName.Meditation, 0.0, 100.0);

                    m.SendLocalizedMessage(501851);                       // You enter a meditative trance.
                    m.Meditating = true;
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657));

                    if (m.Player || m.Body.IsHuman)
                    {
                        m.PlaySound(0xF9);
                    }
                }
                else
                {
                    m.SendLocalizedMessage(501850);                       // You cannot focus your concentration.
                }

                return(TimeSpan.FromSeconds(10.0));
            }
        }
Пример #48
0
        private void CopyFromLayer(Mobile from, Mobile mimic, Layer layer)
        {
            if (from.FindItemOnLayer(layer) != null)
            {
                Item copy = (Item)from.FindItemOnLayer(layer);
                Type t    = copy.GetType();

                ConstructorInfo[] info = t.GetConstructors();

                foreach (ConstructorInfo c in info)
                {
                    //if ( !c.IsDefined( typeof( ConstructableAttribute ), false ) ) continue;

                    ParameterInfo[] paramInfo = c.GetParameters();

                    if (paramInfo.Length == 0)
                    {
                        object[] objParams = new object[0];

                        try
                        {
                            Item   newItem = null;
                            object o       = c.Invoke(objParams);

                            if (o != null && o is Item)
                            {
                                newItem = (Item)o;
                                CopyProperties(newItem, copy);//copy.Dupe( item, copy.Amount );
                                newItem.Parent = null;

                                mimic.EquipItem(newItem);
                            }

                            if (newItem != null)
                            {
                                if (newItem is BaseWeapon && o is BaseWeapon)
                                {
                                    BaseWeapon weapon  = newItem as BaseWeapon;
                                    BaseWeapon oweapon = o as BaseWeapon;
                                    weapon.Attributes       = oweapon.Attributes;
                                    weapon.WeaponAttributes = oweapon.WeaponAttributes;
                                }
                                if (newItem is BaseArmor && o is BaseArmor)
                                {
                                    BaseArmor armor  = newItem as BaseArmor;
                                    BaseArmor oarmor = o as BaseArmor;
                                    armor.Attributes      = oarmor.Attributes;
                                    armor.ArmorAttributes = oarmor.ArmorAttributes;
                                    armor.SkillBonuses    = oarmor.SkillBonuses;
                                }

                                mimic.EquipItem(newItem);
                            }
                        }
                        catch
                        {
                            from.Say("Error!");
                            return;
                        }
                    }
                }
            }

            if (mimic.FindItemOnLayer(layer) != null && mimic.FindItemOnLayer(layer).LootType != LootType.Blessed)
            {
                mimic.FindItemOnLayer(layer).LootType = LootType.Newbied;
            }
        }
Пример #49
0
        private static void AddSkillItems(Mobile m, SkillName skill)
        {
            switch (skill)
            {
            case SkillName.Alchemy:
            {
                PackItem(new Bottle(4));
                PackItem(new MortarPestle());

                int hue = Utility.RandomPinkHue();

                if (m.Race == Race.Human)
                {
                    EquipItem(new Robe(hue));
                }
                else if (m.Race == Race.Elf)
                {
                    if (m.Female)
                    {
                        EquipItem(new FemaleElvenRobe(hue));
                    }
                    else
                    {
                        EquipItem(new ElvenRobe(hue));
                    }
                }
                else if (m.Race == Race.Gargoyle)
                {
                    EquipItem(new GargishFancyRobe(hue));
                }

                break;
            }

            case SkillName.Anatomy:
            {
                PackItem(new Bandage(3));

                int hue = Utility.RandomYellowHue();

                if (m.Race == Race.Human)
                {
                    EquipItem(new Robe(hue));
                }
                else if (m.Race == Race.Elf)
                {
                    if (m.Female)
                    {
                        EquipItem(new FemaleElvenRobe(hue));
                    }
                    else
                    {
                        EquipItem(new ElvenRobe(hue));
                    }
                }
                else if (m.Race == Race.Gargoyle)
                {
                    EquipItem(new GargishFancyRobe(hue));
                }

                break;
            }

            case SkillName.AnimalLore:
            {
                int hue = Utility.RandomBlueHue();

                if (m.Race == Race.Human)
                {
                    EquipItem(new ShepherdsCrook());
                    EquipItem(new Robe(hue));
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new WildStaff());

                    if (m.Female)
                    {
                        EquipItem(new FemaleElvenRobe(hue));
                    }
                    else
                    {
                        EquipItem(new ElvenRobe(hue));
                    }
                }
                else if (m.Race == Race.Gargoyle)
                {
                    // TODO: Gargoyles Staff?

                    EquipItem(new GargishFancyRobe(hue));
                }

                break;
            }

            case SkillName.Archery:
            {
                PackItem(new Arrow(25));

                if (m.Race == Race.Human)
                {
                    EquipItem(new Bow());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new ElvenCompositeLongBow());
                }

                break;
            }

            case SkillName.ArmsLore:
            {
                if (m.Race == Race.Human)
                {
                    switch (Utility.Random(3))
                    {
                    case 0:
                        EquipItem(new Leafblade());
                        break;

                    case 1:
                        EquipItem(new RuneBlade());
                        break;

                    case 2:
                        EquipItem(new DiamondMace());
                        break;
                    }
                }
                else if (m.Race == Race.Elf)
                {
                    switch (Utility.Random(3))
                    {
                    case 0:
                        EquipItem(new Kryss());
                        break;

                    case 1:
                        EquipItem(new Katana());
                        break;

                    case 2:
                        EquipItem(new Club());
                        break;
                    }
                }

                break;
            }

            case SkillName.Begging:
            {
                if (m.Race == Race.Human)
                {
                    EquipItem(new WildStaff());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new GnarledStaff());
                }

                break;
            }

            case SkillName.Blacksmith:
            {
                PackItem(new Tongs());
                PackItem(new Pickaxe());
                PackItem(new Pickaxe());
                PackItem(new IronIngot(50));

                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new HalfApron(Utility.RandomYellowHue()));
                }

                break;
            }

            case SkillName.Bushido:
            {
                EquipItem(new Hakama());
                EquipItem(new Kasa());
                EquipItem(new BookOfBushido());

                break;
            }

            case SkillName.Fletching:
            {
                PackItem(new Board(14));
                PackItem(new Feather(5));
                PackItem(new Shaft(5));

                break;
            }

            case SkillName.Camping:
            {
                PackItem(new Bedroll());
                PackItem(new Kindling(5));

                break;
            }

            case SkillName.Carpentry:
            {
                PackItem(new Board(10));
                PackItem(new Saw());

                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new HalfApron(Utility.RandomYellowHue()));
                }

                break;
            }

            case SkillName.Cartography:
            {
                PackItem(new BlankMap());
                PackItem(new BlankMap());
                PackItem(new BlankMap());
                PackItem(new BlankMap());
                PackItem(new Sextant());

                break;
            }

            case SkillName.Cooking:
            {
                PackItem(new Kindling(2));
                PackItem(new RawLambLeg());
                PackItem(new RawChickenLeg());
                PackItem(new RawFishSteak());
                PackItem(new SackFlour());
                PackItem(new Pitcher(BeverageType.Water));

                break;
            }

            case SkillName.Chivalry:
            {
                PackItem(new BookOfChivalry((ulong)0x3FF));

                break;
            }

            case SkillName.DetectHidden:
            {
                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new Cloak(0x455));
                }

                break;
            }

            case SkillName.Discordance:
            {
                PackInstrument();

                break;
            }

            case SkillName.Fencing:
            {
                if (m.Race == Race.Human)
                {
                    EquipItem(new Kryss());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new Leafblade());
                }

                break;
            }

            case SkillName.Fishing:
            {
                EquipItem(new FishingPole());

                int hue = Utility.RandomYellowHue();

                if (m.Race == Race.Human)
                {
                    EquipItem(new FloppyHat(Utility.RandomYellowHue()));
                }
                else if (m.Race == Race.Elf)
                {
                    Item i = new Circlet();
                    i.Hue = hue;
                    EquipItem(i);
                }

                break;
            }

            case SkillName.Healing:
            {
                PackItem(new Bandage(50));
                PackItem(new Scissors());

                break;
            }

            case SkillName.Herding:
            {
                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new ShepherdsCrook());
                }

                break;
            }

            case SkillName.Hiding:
            {
                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new Cloak(0x455));
                }

                break;
            }

            case SkillName.Inscribe:
            {
                PackItem(new BlankScroll(2));
                PackItem(new BlueBook());

                break;
            }

            case SkillName.ItemID:
            {
                if (m.Race == Race.Human)
                {
                    EquipItem(new GnarledStaff());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new WildStaff());
                }

                break;
            }

            case SkillName.Lockpicking:
            {
                PackItem(new Lockpick(20));

                break;
            }

            case SkillName.Lumberjacking:
            {
                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new Hatchet());
                }

                break;
            }

            case SkillName.Macing:
            {
                if (m.Race == Race.Human)
                {
                    EquipItem(new Club());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new DiamondMace());
                }

                break;
            }

            case SkillName.Magery:
            {
                BagOfReagents regs = new BagOfReagents(30);

                PackItem(regs);

                regs.LootType = LootType.Regular;

                PackScroll(0);
                PackScroll(1);
                PackScroll(2);

                Spellbook book = new Spellbook((ulong)0x382A8C38);

                EquipItem(book);

                book.LootType = LootType.Blessed;

                if (m.Race == Race.Human)
                {
                    EquipItem(new WizardsHat());
                    EquipItem(new Robe(Utility.RandomBlueHue()));
                }
                if (m.Race == Race.Elf)
                {
                    EquipItem(new Circlet());

                    if (m.Female)
                    {
                        EquipItem(new FemaleElvenRobe(Utility.RandomBlueHue()));
                    }
                    else
                    {
                        EquipItem(new ElvenRobe(Utility.RandomBlueHue()));
                    }
                }
                else if (m.Race == Race.Gargoyle)
                {
                    // TODO: hat?

                    EquipItem(new GargishFancyRobe(Utility.RandomBlueHue()));
                }

                break;
            }

            case SkillName.Mining:
            {
                PackItem(new Pickaxe());

                break;
            }

            case SkillName.Musicianship:
            {
                PackInstrument();

                break;
            }

            case SkillName.Necromancy:
            {
                Container regs = new BagOfNecroReagents(50);

                PackItem(regs);

                regs.LootType = LootType.Regular;

                break;
            }

            case SkillName.Ninjitsu:
            {
                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new Hakama(0x2C3));                                               //Only ninjas get the hued one.
                    EquipItem(new Kasa());
                }

                EquipItem(new BookOfNinjitsu());

                break;
            }

            case SkillName.Parry:
            {
                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new WoodenShield());
                }

                break;
            }

            case SkillName.Peacemaking:
            {
                PackInstrument();

                break;
            }

            case SkillName.Poisoning:
            {
                PackItem(new LesserPoisonPotion());
                PackItem(new LesserPoisonPotion());

                break;
            }

            case SkillName.Provocation:
            {
                PackInstrument();

                break;
            }

            case SkillName.Snooping:
            {
                PackItem(new Lockpick(20));

                break;
            }

            case SkillName.SpiritSpeak:
            {
                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new Cloak(0x455));
                }

                break;
            }

            case SkillName.Stealing:
            {
                PackItem(new Lockpick(20));

                break;
            }

            case SkillName.Swords:
            {
                if (m.Race == Race.Human)
                {
                    EquipItem(new Katana());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new RuneBlade());
                }

                break;
            }

            case SkillName.Tactics:
            {
                if (m.Race == Race.Human)
                {
                    EquipItem(new Katana());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new RuneBlade());
                }

                break;
            }

            case SkillName.Tailoring:
            {
                PackItem(new BoltOfCloth());
                PackItem(new SewingKit());

                break;
            }

            case SkillName.Tracking:
            {
                if (m_Mobile != null)
                {
                    Item shoes = m_Mobile.FindItemOnLayer(Layer.Shoes);

                    if (shoes != null)
                    {
                        shoes.Delete();
                    }
                }

                int hue = Utility.RandomYellowHue();

                if (m.Race == Race.Human)
                {
                    EquipItem(new Boots(hue));
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new ElvenBoots(hue));
                }

                if (m.Race != Race.Gargoyle)
                {
                    EquipItem(new SkinningKnife());
                }

                break;
            }

            case SkillName.Veterinary:
            {
                PackItem(new Bandage(5));
                PackItem(new Scissors());

                break;
            }

            case SkillName.Wrestling:
            {
                if (m.Race == Race.Human)
                {
                    EquipItem(new LeatherGloves());
                }
                else if (m.Race == Race.Elf)
                {
                    EquipItem(new LeafGloves());
                }

                break;
            }
            }
        }
Пример #50
0
        private static void AddSkillItems(SkillName skill)
        {
            switch (skill)
            {
            case SkillName.Alchemy:
            {
                BankBox bank = m_Mobile.BankBox;
                bank.DropItem(new Bottle(50));

                PackItem(new Bottle(4));
                PackItem(new MortarPestle());
                break;
            }

            case SkillName.Anatomy:
            {
                PackItem(new Bandage(3));
                break;
            }

            case SkillName.AnimalLore:
            {
                EquipItem(new ShepherdsCrook());
                break;
            }

            case SkillName.Archery:
            {
                BankBox bank = m_Mobile.BankBox;
                bank.DropItem(new Arrow(550));

                PackItem(new Arrow(25));
                EquipItem(new Bow());
                break;
            }

            case SkillName.ArmsLore:
            {
                switch (Utility.Random(3))
                {
                case 0: EquipItem(new Kryss()); break;

                case 1: EquipItem(new Katana()); break;

                case 2: EquipItem(new Club()); break;
                }

                break;
            }

            case SkillName.Begging:
            {
                EquipItem(new GnarledStaff());
                break;
            }

            case SkillName.Blacksmith:
            {
                PackItem(new Tongs());
                PackItem(new Pickaxe());
                PackItem(new Pickaxe());
                PackItem(new IronIngot(50));
                EquipItem(new HalfApron(Utility.RandomYellowHue()));
                break;
            }

            case SkillName.Fletching:
            {
                PackItem(new Board(14));
                PackItem(new Feather(5));
                PackItem(new Shaft(5));
                break;
            }

            case SkillName.Camping:
            {
                PackItem(new Bedroll());
                PackItem(new Kindling(5));
                break;
            }

            case SkillName.Carpentry:
            {
                PackItem(new Board(10));
                PackItem(new Saw());
                EquipItem(new HalfApron(Utility.RandomYellowHue()));
                break;
            }

            case SkillName.Cartography:
            {
                PackItem(new BlankMap());
                PackItem(new BlankMap());
                PackItem(new BlankMap());
                PackItem(new BlankMap());
                PackItem(new Sextant());
                break;
            }

            case SkillName.Cooking:
            {
                PackItem(new Kindling(5));
                PackItem(new RawLambLeg(5));
                PackItem(new RawChickenLeg(5));
                PackItem(new RawFishSteak(5));
                PackItem(new SackFlour(2));
                PackItem(new Pitcher(BeverageType.Water));
                break;
            }

            case SkillName.DetectHidden:
            {
                EquipItem(new Cloak(0x455));
                break;
            }

            case SkillName.Discordance:
            {
                PackInstrument();
                break;
            }

            case SkillName.Fencing:
            {
                EquipItem(new Kryss());
                break;
            }

            case SkillName.Fishing:
            {
                EquipItem(new FishingPole());
                EquipItem(new FloppyHat(Utility.RandomYellowHue()));
                break;
            }

            case SkillName.Healing:
            {
                BankBox bank = m_Mobile.BankBox;
                bank.DropItem(new Bandage(500));

                PackItem(new Bandage(50));
                PackItem(new Scissors());
                break;
            }

            case SkillName.Herding:
            {
                EquipItem(new ShepherdsCrook());
                break;
            }

            case SkillName.Hiding:
            {
                EquipItem(new Cloak(0x455));
                break;
            }

            case SkillName.Inscribe:
            {
                BankBox bank = m_Mobile.BankBox;
                bank.DropItem(new BlankScroll(250));

                PackItem(new BlankScroll(2));
                PackItem(new BlueBook(2));
                break;
            }

            case SkillName.ItemID:
            {
                EquipItem(new GnarledStaff());
                break;
            }

            case SkillName.Lockpicking:
            {
                BankBox bank = m_Mobile.BankBox;
                bank.DropItem(new Lockpick(150));

                PackItem(new Lockpick(20));
                break;
            }

            case SkillName.Lumberjacking:
            {
                EquipItem(new Hatchet());
                break;
            }

            case SkillName.Macing:
            {
                EquipItem(new Club());
                break;
            }

            case SkillName.Magery:
            {
                BankBox bank = m_Mobile.BankBox;
                bank.DropItem(new BagOfReagents(550));
                bank.DropItem(new RecallRune());
                bank.DropItem(new RecallRune());
                bank.DropItem(new RecallRune());
                bank.DropItem(new RecallRune());

                BagOfReagents regs = new BagOfReagents(50);

                if (!Core.AOS)
                {
                    foreach (Item item in regs.Items)
                    {
                        item.LootType = LootType.Newbied;
                    }
                }

                PackItem(regs);

                regs.LootType = LootType.Regular;

                PackScroll(0);
                PackScroll(1);
                PackScroll(2);

                Spellbook book = new Spellbook((ulong)0xFFFFFFFFFFFFFFFF);

                EquipItem(book);

                book.LootType = LootType.Blessed;

                EquipItem(new Robe(Utility.RandomBlueHue()));
                EquipItem(new WizardsHat());

                break;
            }

            case SkillName.Mining:
            {
                PackItem(new Pickaxe());
                break;
            }

            case SkillName.Musicianship:
            {
                PackInstrument();
                break;
            }

            case SkillName.Parry:
            {
                EquipItem(new WoodenShield());
                break;
            }

            case SkillName.Peacemaking:
            {
                PackInstrument();
                break;
            }

            case SkillName.Poisoning:
            {
                PackItem(new LesserPoisonPotion());
                PackItem(new LesserPoisonPotion());
                break;
            }

            case SkillName.Provocation:
            {
                PackInstrument();
                break;
            }

            case SkillName.Snooping:
            {
                PackItem(new Lockpick(20));
                break;
            }

            case SkillName.SpiritSpeak:
            {
                EquipItem(new Cloak(0x455));
                break;
            }

            case SkillName.Stealing:
            {
                PackItem(new Lockpick(20));
                break;
            }

            case SkillName.Swords:
            {
                EquipItem(new Katana());
                break;
            }

            case SkillName.Tactics:
            {
                EquipItem(new Katana());
                break;
            }

            case SkillName.Tailoring:
            {
                PackItem(new BoltOfCloth());
                PackItem(new SewingKit());
                break;
            }

            case SkillName.Tracking:
            {
                if (m_Mobile != null)
                {
                    Item shoes = m_Mobile.FindItemOnLayer(Layer.Shoes);

                    if (shoes != null)
                    {
                        shoes.Delete();
                    }
                }

                EquipItem(new Boots(Utility.RandomYellowHue()));
                EquipItem(new SkinningKnife());
                break;
            }

            case SkillName.Veterinary:
            {
                PackItem(new Bandage(5));
                PackItem(new Scissors());
                break;
            }

            case SkillName.Wrestling:
            {
                EquipItem(new LeatherGloves());
                break;
            }
            }
        }
Пример #51
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(this.GetWorldLocation(), 2))
            {
                #region Self Looting
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    if (from.QuestArrow != null)
                    {
                        from.QuestArrow.Stop();
                    }
                    List <Item> items = new List <Item>(this.Items);

                    bool gathered = false;
                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable || !GetRestoreInfo(item, ref loc))
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                if (Core.SE)
                                {
                                    robe.Delete();
                                }
                                else
                                {
                                    Map map = from.Map;

                                    if (map != null && map != Map.Internal)
                                    {
                                        robe.MoveToWorld(from.Location, map);
                                    }
                                }
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            pack.AddItem(item);
                            item.Location = loc;
                            gathered      = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        SetFlag(CorpseFlag.Carved, true);

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID = Utility.Random(0xECA, 9);                               // bone graphic
                            Hue    = 0;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                           // You quickly gather all of your belongings.
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                           // You gather some of your belongings. The rest remain on the corpse.
                    }
                }

                #endregion

                if (!CheckLoot(from, null))
                {
                    return;
                }

                base.OnDoubleClick(from);
                from.SendSound(0x48, from.Location);
                Server.Items.CharacterDatabase.LootContainer(from, this);
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
                return;
            }
        }
Пример #52
0
        protected override void OnTarget(Mobile from, object target)
        {
            if (!from.CanSee(target))
            {
                from.SendMessage("Target cannot be seen.");
            }
            else if (!from.Alive)
            {
                from.SendMessage("You cannot transform out of your current state.");
            }
            else if (target is Mobile && ((Mobile)target).Alive)
            {
                Mobile t = (Mobile)target;

                if (t == from)
                {
                    from.HueMod = -1;

                    ((Player)from).RawStr -= ((Player)from).StrMod;
                    ((Player)from).RawDex -= ((Player)from).DexMod;
                    ((Player)from).RawInt -= ((Player)from).IntMod;

                    ((Player)from).RaceBody = 58;
                    ((Player)from).AdjustBody();

                    ((Player)from).StrMod = 0;
                    ((Player)from).DexMod = 0;
                    ((Player)from).IntMod = 0;

                    ((Player)from).BodyDamageBonus = 0;
                }

                else if (from.Mounted && !t.Body.IsHuman)
                {
                    from.SendMessage("You cannot transform while mounted.");
                }

                else
                {
                    from.FixedParticles(14089, 0, 30, 0, 1155, 7, EffectLayer.CenterFeet);

                    ((Player)from).RaceBody = t.Body;
                    ((Player)from).AdjustBody();

                    from.HueMod = t.Hue;

                    ((Player)from).RawStr -= ((Player)from).StrMod;
                    ((Player)from).RawDex -= ((Player)from).DexMod;
                    ((Player)from).RawInt -= ((Player)from).IntMod;

                    ((Player)from).StrMod = (int)(t.RawStr / 10);
                    ((Player)from).DexMod = (int)(t.RawDex / 10);
                    ((Player)from).IntMod = (int)(t.RawInt / 10);

                    from.RawStr += ((Player)from).StrMod;
                    from.RawDex += ((Player)from).DexMod;
                    from.RawInt += ((Player)from).IntMod;

                    if (t.Body.IsHuman == false)
                    {
                        ((Player)from).BodyDamageBonus = (int)(t.RawStr / 15);
                    }

                    if (t.Body.IsHuman)
                    {
                        from.HairItemID       = t.HairItemID;
                        from.FacialHairItemID = t.FacialHairItemID;
                        from.HairHue          = t.HairHue;
                        from.FacialHairHue    = t.FacialHairHue;
                    }

                    from.PublicOverheadMessage(MessageType.Regular, from.EmoteHue, false, String.Format("*transforms into the shape of {0}*", t.RawName));

                    hasChanged = true;

                    for (int x = 1; x <= 2; x++)
                    {
                        Item toDisarm = from.FindItemOnLayer(Layer.OneHanded);

                        if (toDisarm == null || !toDisarm.Movable)
                        {
                            toDisarm = from.FindItemOnLayer(Layer.TwoHanded);
                        }

                        Container pack = from.Backpack;
                        pack.DropItem(toDisarm);
                    }
                }
            }

            else
            {
                from.SendMessage("You cannot take that form.");
            }
        }
Пример #53
0
        public void DoDamage(PBGrenade nade, Mobile attacker, Mobile defender)
        {
            if (defender.FindItemOnLayer(Layer.Cloak) == null)
            {
                if (m_PBGI != null)
                {
                    m_PBGI.KillPlayer(defender);
                    defender.SendMessage("You are not on a team!  Removing you from the game.");
                }
                defender.SendMessage("Error: PBGI returns null. You are not in the game, Please Rejoin or contact a GM.");
            }
            else
            {
                PBArmor armor;
                //armor = defender.NeckArmor as PBArmor;

                int defenderTeam = defender.FindItemOnLayer(Layer.Cloak).Hue;
                int attackerTeam = attacker.FindItemOnLayer(Layer.Cloak).Hue;

                if (attackerTeam == defenderTeam)
                {
                    attacker.SendMessage("You are sprayed with paint from you`re own grenade.");
                }
                else
                {
                    for (int i = 0; i < m_PBGI.NadeDamage; ++i)
                    {
                        if (defender.NeckArmor != null && defender.NeckArmor.Hue == defenderTeam)
                        {
                            armor = defender.NeckArmor as PBArmor;
                            armor.WasHit(this, 0);
                        }
                        else if (defender.HandArmor != null && defender.HandArmor.Hue == defenderTeam)
                        {
                            armor = defender.HandArmor as PBArmor;
                            armor.WasHit(this, 0);
                        }
                        else if (defender.ArmsArmor != null && defender.ArmsArmor.Hue == defenderTeam)
                        {
                            armor = defender.ArmsArmor as PBArmor;
                            armor.WasHit(this, 0);
                        }
                        else if (defender.HeadArmor != null && defender.HeadArmor.Hue == defenderTeam)
                        {
                            armor = defender.HeadArmor as PBArmor;
                            armor.WasHit(this, 0);
                        }
                        else if (defender.LegsArmor != null && defender.LegsArmor.Hue == defenderTeam)
                        {
                            armor = defender.LegsArmor as PBArmor;
                            armor.WasHit(this, 0);
                        }
                        else if (defender.ChestArmor != null && defender.ChestArmor.Hue == defenderTeam)
                        {
                            armor = defender.ChestArmor as PBArmor;
                            armor.WasHit(this, 0);
                        }
                        else
                        {
                            attacker.SendMessage("You have just removed that player from the game!");
                            m_PBGI.KillPlayer(defender);
                        }


                        //armor.WasHit( this, 0 );

                        //armor.NadeHit( nade, 0 );
                    }
                }
            }
        }
Пример #54
0
        public static bool CheckBlockGaze(Mobile m)
        {
            if (m == null)
            {
                return(false);
            }

            Item helm = m.FindItemOnLayer(Layer.Helm);
            Item neck = m.FindItemOnLayer(Layer.Neck);
            Item ear  = m.FindItemOnLayer(Layer.Earrings);
            Item shi  = m.FindItemOnLayer(Layer.TwoHanded);

            bool deflect = false;
            int  perc    = 0;

            if (helm != null)
            {
                if (helm is BaseArmor && ((BaseArmor)helm).GorgonLenseCharges > 0)
                {
                    perc = GetScaleEffectiveness(((BaseArmor)helm).GorgonLenseType);

                    if (perc > Utility.Random(100))
                    {
                        ((BaseArmor)helm).GorgonLenseCharges--;
                        deflect = true;
                    }
                }
                else if (helm is BaseClothing && ((BaseClothing)helm).GorgonLenseCharges > 0)
                {
                    perc = GetScaleEffectiveness(((BaseClothing)helm).GorgonLenseType);

                    if (perc > Utility.Random(100))
                    {
                        ((BaseClothing)helm).GorgonLenseCharges--;
                        deflect = true;
                    }
                }
            }

            if (!deflect && shi != null && shi is BaseShield && ((BaseArmor)shi).GorgonLenseCharges > 0)
            {
                perc = GetScaleEffectiveness(((BaseArmor)shi).GorgonLenseType);

                if (perc > Utility.Random(100))
                {
                    ((BaseArmor)shi).GorgonLenseCharges--;
                    deflect = true;
                }
            }

            if (!deflect && neck != null)
            {
                if (neck is BaseArmor && ((BaseArmor)neck).GorgonLenseCharges > 0)
                {
                    perc = GetScaleEffectiveness(((BaseArmor)neck).GorgonLenseType);

                    if (perc > Utility.Random(100))
                    {
                        ((BaseArmor)neck).GorgonLenseCharges--;
                        deflect = true;
                    }
                }
                else if (neck is BaseJewel && ((BaseJewel)neck).GorgonLenseCharges > 0)
                {
                    perc = GetScaleEffectiveness(((BaseJewel)neck).GorgonLenseType);

                    if (perc > Utility.Random(100))
                    {
                        ((BaseJewel)neck).GorgonLenseCharges--;
                        deflect = true;
                    }
                }
                else if (neck is BaseClothing && ((BaseClothing)neck).GorgonLenseCharges > 0)
                {
                    perc = GetScaleEffectiveness(((BaseClothing)neck).GorgonLenseType);

                    if (perc > Utility.Random(100))
                    {
                        ((BaseClothing)neck).GorgonLenseCharges--;
                        deflect = true;
                    }
                }
            }

            if (!deflect && ear != null)
            {
                if (ear is BaseJewel && ((BaseJewel)ear).GorgonLenseCharges > 0)
                {
                    perc = GetScaleEffectiveness(((BaseJewel)ear).GorgonLenseType);

                    if (perc > Utility.Random(100))
                    {
                        ((BaseJewel)ear).GorgonLenseCharges--;
                        deflect = true;
                    }
                }
            }

            return(deflect);
        }
        public override bool OnEquip(Mobile from)
        {
            Item shirt = from.FindItemOnLayer(Layer.InnerTorso);
            Item glove = from.FindItemOnLayer(Layer.Gloves);
            Item pants = from.FindItemOnLayer(Layer.Pants);
            Item helm  = from.FindItemOnLayer(Layer.Helm);
            Item neck  = from.FindItemOnLayer(Layer.Neck);

            if (shirt != null && shirt.GetType() == typeof(PlateOfHonorChest) && glove != null && glove.GetType() == typeof(PlateOfHonorGloves) && pants != null && pants.GetType() == typeof(PlateOfHonorLegs) && helm != null && helm.GetType() == typeof(PlateOfHonorHelm) && neck != null && neck.GetType() == typeof(PlateOfHonorGorget))
            {
                Effects.PlaySound(from.Location, from.Map, 503);
                from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);

                Hue = 0x47E;
                ArmorAttributes.SelfRepair = 3;
                Attributes.NightSight      = 1;
                PhysicalBonus = 2;
                FireBonus     = 5;
                ColdBonus     = 5;
                PoisonBonus   = 3;
                EnergyBonus   = 5;


                PlateOfHonorChest  chest  = from.FindItemOnLayer(Layer.InnerTorso) as PlateOfHonorChest;
                PlateOfHonorGloves gloves = from.FindItemOnLayer(Layer.Gloves) as PlateOfHonorGloves;
                PlateOfHonorLegs   legs   = from.FindItemOnLayer(Layer.Pants) as PlateOfHonorLegs;
                PlateOfHonorHelm   helmet = from.FindItemOnLayer(Layer.Helm) as PlateOfHonorHelm;
                PlateOfHonorGorget gorget = from.FindItemOnLayer(Layer.Neck) as PlateOfHonorGorget;

                chest.Hue = 0x47E;
                chest.Attributes.NightSight      = 1;
                chest.Attributes.ReflectPhysical = 25;
                chest.ArmorAttributes.SelfRepair = 3;
                chest.SkillBonuses.SetValues(0, SkillName.Chivalry, 10.0);
                chest.PhysicalBonus = 2;
                chest.FireBonus     = 5;
                chest.ColdBonus     = 5;
                chest.PoisonBonus   = 3;
                chest.EnergyBonus   = 5;

                gloves.Hue = 0x47E;
                gloves.Attributes.NightSight      = 1;
                gloves.ArmorAttributes.SelfRepair = 3;
                gloves.PhysicalBonus = 2;
                gloves.FireBonus     = 5;
                gloves.ColdBonus     = 5;
                gloves.PoisonBonus   = 3;
                gloves.EnergyBonus   = 5;

                legs.Hue = 0x47E;
                legs.Attributes.NightSight      = 1;
                legs.ArmorAttributes.SelfRepair = 3;
                legs.PhysicalBonus = 2;
                legs.FireBonus     = 5;
                legs.ColdBonus     = 5;
                legs.PoisonBonus   = 3;
                legs.EnergyBonus   = 5;

                helmet.Hue = 0x47E;
                helmet.Attributes.NightSight      = 1;
                helmet.ArmorAttributes.SelfRepair = 3;
                helmet.PhysicalBonus = 2;
                helmet.FireBonus     = 5;
                helmet.ColdBonus     = 5;
                helmet.PoisonBonus   = 3;
                helmet.EnergyBonus   = 5;

                gorget.Hue = 0x47E;
                gorget.Attributes.NightSight      = 1;
                gorget.ArmorAttributes.SelfRepair = 3;
                gorget.PhysicalBonus = 2;
                gorget.FireBonus     = 5;
                gorget.ColdBonus     = 5;
                gorget.PoisonBonus   = 3;
                gorget.EnergyBonus   = 5;

                from.SendLocalizedMessage(1072391);
            }
            this.InvalidateProperties();
            return(base.OnEquip(from));
        }
Пример #56
0
        public override bool DoActionCombat()
        {
            Mobile combatant = m_Mobile.Combatant;

            if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map)
            {
                m_Mobile.DebugSay("My combatant is gone, so my guard is up");

                Action = ActionType.Guard;

                return(true);
            }

            if (WalkMobileRange(combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight))
            {
                m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant);
                if (m_toDisarm == null)
                {
                    m_toDisarm = combatant.FindItemOnLayer(Layer.OneHanded);
                }
                if (m_toDisarm == null)
                {
                    m_toDisarm = combatant.FindItemOnLayer(Layer.TwoHanded);
                }
                if (m_toDisarm != null && m_toDisarm.IsChildOf(m_Mobile.Backpack))
                {
                    m_toDisarm = combatant.FindItemOnLayer(Layer.OneHanded);
                    if (m_toDisarm == null)
                    {
                        m_toDisarm = combatant.FindItemOnLayer(Layer.TwoHanded);
                    }
                }
                if (!m_Mobile.DisarmReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.ArmsLore].Value >= 80.0 && m_toDisarm != null)
                {
                    EventSink.InvokeDisarmRequest(new DisarmRequestEventArgs(m_Mobile));
                }
                if (m_toDisarm != null && m_toDisarm.IsChildOf(combatant.Backpack) && m_Mobile.NextSkillTime <= Core.Now && (m_toDisarm.LootType != LootType.Blessed && m_toDisarm.LootType != LootType.Newbied))
                {
                    m_Mobile.DebugSay("Trying to steal from combatant.");
                    m_Mobile.UseSkill(SkillName.Stealing);
                    if (m_Mobile.Target != null)
                    {
                        m_Mobile.Target.Invoke(m_Mobile, m_toDisarm);
                    }
                }
                else if (m_toDisarm == null && m_Mobile.NextSkillTime <= Core.Now)
                {
                    Container cpack = combatant.Backpack;

                    if (cpack != null)
                    {
                        Item steala = cpack.FindItemByType(typeof(Bandage));
                        if (steala != null)
                        {
                            m_Mobile.DebugSay("Trying to steal from combatant.");
                            m_Mobile.UseSkill(SkillName.Stealing);
                            if (m_Mobile.Target != null)
                            {
                                m_Mobile.Target.Invoke(m_Mobile, steala);
                            }
                        }
                        Item stealb = cpack.FindItemByType(typeof(Nightshade));
                        if (stealb != null)
                        {
                            m_Mobile.DebugSay("Trying to steal from combatant.");
                            m_Mobile.UseSkill(SkillName.Stealing);
                            if (m_Mobile.Target != null)
                            {
                                m_Mobile.Target.Invoke(m_Mobile, stealb);
                            }
                        }
                        Item stealc = cpack.FindItemByType(typeof(BlackPearl));
                        if (stealc != null)
                        {
                            m_Mobile.DebugSay("Trying to steal from combatant.");
                            m_Mobile.UseSkill(SkillName.Stealing);
                            if (m_Mobile.Target != null)
                            {
                                m_Mobile.Target.Invoke(m_Mobile, stealc);
                            }
                        }
                        Item steald = cpack.FindItemByType(typeof(MandrakeRoot));
                        if (steald != null)
                        {
                            m_Mobile.DebugSay("Trying to steal from combatant.");
                            m_Mobile.UseSkill(SkillName.Stealing);
                            if (m_Mobile.Target != null)
                            {
                                m_Mobile.Target.Invoke(m_Mobile, steald);
                            }
                        }
                        else if (steala == null && stealb == null && stealc == null && steald == null)
                        {
                            if (m_Mobile.Debug)
                            {
                                m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name);
                            }

                            Action = ActionType.Flee;
                        }
                    }
                }
            }
            else
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("I should be closer to {0}", combatant.Name);
                }
            }

            if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100)
            {
                // We are low on health, should we flee?

                bool flee = false;

                if (m_Mobile.Hits < combatant.Hits)
                {
                    // We are more hurt than them

                    int diff = combatant.Hits - m_Mobile.Hits;

                    flee = (Utility.Random(0, 100) > (10 + diff));                         // (10 + diff)% chance to flee
                }
                else
                {
                    flee = Utility.Random(0, 100) > 10;                       // 10% chance to flee
                }

                if (flee)
                {
                    if (m_Mobile.Debug)
                    {
                        m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name);
                    }

                    Action = ActionType.Flee;
                }
            }

            return(true);
        }
Пример #57
0
 public static bool FullSet(Mobile m)
 {
     return(m.FindItemOnLayer(Layer.OneHanded) is Evocaricus &&
            m.FindItemOnLayer(Layer.TwoHanded) is MalekisHonor);
 }
Пример #58
0
        public override void Damage(Mobile m)
        {
            base.Damage(m);

            if (m.Alive)
            {
                Item item = m.FindItemOnLayer(Layer.OuterTorso);

                if (item is GMRobe)
                {
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }
                else if (item is GMRobeExplosion)
                {
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    m.PlaySound(Utility.RandomList(0x307, 0x308));
                }
                else if (item is GMRobeHoly)
                {
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);

                    m.FixedParticles(0x375A, 1, 30, 9966, 88, 2, EffectLayer.Head);
                    m.FixedParticles(0x37B9, 1, 30, 9502, 85, 3, EffectLayer.Head);
                    m.FixedParticles(0x376A, 1, 31, 9961, 80, 0, EffectLayer.Waist);
                    m.FixedParticles(0x37C4, 1, 31, 9502, 88, 2, EffectLayer.Waist);
                }
                else if (item is GMRobeTrailfire)
                {
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);

                    m.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
                }
                else
                {
                    // Cricket noises
                    if (Utility.RandomDouble() < 0.03)
                    {
                        m.PlaySound(Utility.RandomList(0x00A, 0x00B));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Jungle noises
                    if (Utility.RandomDouble() < 0.08)
                    {
                        m.PlaySound(Utility.RandomList(0x003, 0x004, 0x005, 0x2B3, 0x2B4, 0x2B5));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Wind
                    if (Utility.RandomDouble() < 0.01)
                    {
                        m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // sfx noises
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x0F5, 0x0F7, 0x0F8, 0x0FB));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // water drips
                    if (Utility.RandomDouble() < 0.01)
                    {
                        m.PlaySound(Utility.RandomList(0x022, 0x023, 0x024));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }
                }
            }
        }
Пример #59
0
        public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, BaseTool tool, Item item, CraftResource resource, Type resType, ref object resMessage)
        {
            if (item == null)
            {
                return(EnhanceResult.BadItem);
            }

            if (!item.IsChildOf(from.Backpack))
            {
                return(EnhanceResult.NotInBackpack);
            }

            if (!(item is BaseArmor) && !(item is BaseWeapon))
            {
                return(EnhanceResult.BadItem);
            }

            if (item is IArcaneEquip)
            {
                IArcaneEquip eq = (IArcaneEquip)item;
                if (eq.IsArcane)
                {
                    return(EnhanceResult.BadItem);
                }
            }

            if (CraftResources.IsStandard(resource))
            {
                return(EnhanceResult.BadResource);
            }

            int num = craftSystem.CanCraft(from, tool, item.GetType());

            if (num > 0)
            {
                resMessage = num;
                return(EnhanceResult.None);
            }

            CraftItem craftItem = craftSystem.CraftItems.SearchFor(item.GetType());

            if (craftItem == null || craftItem.Ressources.Count == 0)
            {
                return(EnhanceResult.BadItem);
            }

            #region Mondain's Legacy
            if (craftItem.ForceNonExceptional)
            {
                return(EnhanceResult.BadItem);
            }
            #endregion

            bool allRequiredSkills = false;
            if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0)
            {
                return(EnhanceResult.NoSkill);
            }

            CraftResourceInfo info = CraftResources.GetInfo(resource);

            if (info == null || info.ResourceTypes.Length == 0)
            {
                return(EnhanceResult.BadResource);
            }

            CraftAttributeInfo attributes = info.AttributeInfo;

            if (attributes == null)
            {
                return(EnhanceResult.BadResource);
            }

            int resHue = 0, maxAmount = 0;

            if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage))
            {
                return(EnhanceResult.NoResources);
            }

            if (craftSystem is DefBlacksmithy)
            {
                AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;
                if (hammer != null)
                {
                    hammer.UsesRemaining--;
                    if (hammer.UsesRemaining < 1)
                    {
                        hammer.Delete();
                    }
                }
            }

            int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
            int dura = 0, luck = 0, lreq = 0, dinc = 0;
            int baseChance = 0;

            bool physBonus = false;
            bool fireBonus = false;
            bool coldBonus = false;
            bool nrgyBonus = false;
            bool poisBonus = false;
            bool duraBonus = false;
            bool luckBonus = false;
            bool lreqBonus = false;
            bool dincBonus = false;

            if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (!CraftResources.IsStandard(weapon.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                baseChance = 20;

                dura = weapon.MaxHitPoints;
                luck = weapon.Attributes.Luck;
                lreq = weapon.WeaponAttributes.LowerStatReq;
                dinc = weapon.Attributes.WeaponDamage;

                fireBonus = (attributes.WeaponFireDamage > 0);
                coldBonus = (attributes.WeaponColdDamage > 0);
                nrgyBonus = (attributes.WeaponEnergyDamage > 0);
                poisBonus = (attributes.WeaponPoisonDamage > 0);

                duraBonus = (attributes.WeaponDurability > 0);
                luckBonus = (attributes.WeaponLuck > 0);
                lreqBonus = (attributes.WeaponLowerRequirements > 0);
                dincBonus = (dinc > 0);
            }
            else
            {
                BaseArmor armor = (BaseArmor)item;

                if (!CraftResources.IsStandard(armor.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                baseChance = 20;

                phys = armor.PhysicalResistance;
                fire = armor.FireResistance;
                cold = armor.ColdResistance;
                pois = armor.PoisonResistance;
                nrgy = armor.EnergyResistance;

                dura = armor.MaxHitPoints;
                luck = armor.Attributes.Luck;
                lreq = armor.ArmorAttributes.LowerStatReq;

                physBonus = (attributes.ArmorPhysicalResist > 0);
                fireBonus = (attributes.ArmorFireResist > 0);
                coldBonus = (attributes.ArmorColdResist > 0);
                nrgyBonus = (attributes.ArmorEnergyResist > 0);
                poisBonus = (attributes.ArmorPoisonResist > 0);

                duraBonus = (attributes.ArmorDurability > 0);
                luckBonus = (attributes.ArmorLuck > 0);
                lreqBonus = (attributes.ArmorLowerRequirements > 0);
                dincBonus = false;
            }

            int skill = from.Skills[craftSystem.MainSkill].Fixed / 10;

            if (skill >= 100)
            {
                baseChance -= (skill - 90) / 10;
            }

            EnhanceResult res = EnhanceResult.Success;

            if (physBonus)
            {
                CheckResult(ref res, baseChance + phys);
            }

            if (fireBonus)
            {
                CheckResult(ref res, baseChance + fire);
            }

            if (coldBonus)
            {
                CheckResult(ref res, baseChance + cold);
            }

            if (nrgyBonus)
            {
                CheckResult(ref res, baseChance + nrgy);
            }

            if (poisBonus)
            {
                CheckResult(ref res, baseChance + pois);
            }

            if (duraBonus)
            {
                CheckResult(ref res, baseChance + (dura / 40));
            }

            if (luckBonus)
            {
                CheckResult(ref res, baseChance + 10 + (luck / 2));
            }

            if (lreqBonus)
            {
                CheckResult(ref res, baseChance + (lreq / 4));
            }

            if (dincBonus)
            {
                CheckResult(ref res, baseChance + (dinc / 4));
            }

            switch (res)
            {
            case EnhanceResult.Broken:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                item.Delete();
                break;
            }

            case EnhanceResult.Success:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                if (item is BaseWeapon)
                {
                    BaseWeapon w = (BaseWeapon)item;

                    w.Resource = resource;

                    #region Mondain's Legacy
                    if (resource != CraftResource.Heartwood)
                    {
                        w.Attributes.WeaponDamage       += attributes.WeaponDamage;
                        w.Attributes.WeaponSpeed        += attributes.WeaponSwingSpeed;
                        w.Attributes.AttackChance       += attributes.WeaponHitChance;
                        w.Attributes.RegenHits          += attributes.WeaponRegenHits;
                        w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech;
                    }
                    else
                    {
                        switch (Utility.Random(6))
                        {
                        case 0: w.Attributes.WeaponDamage += attributes.WeaponDamage; break;

                        case 1: w.Attributes.WeaponSpeed += attributes.WeaponSwingSpeed; break;

                        case 2: w.Attributes.AttackChance += attributes.WeaponHitChance; break;

                        case 3: w.Attributes.Luck += attributes.WeaponLuck; break;

                        case 4: w.WeaponAttributes.LowerStatReq += attributes.WeaponLowerRequirements; break;

                        case 5: w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech; break;
                        }
                    }
                    #endregion

                    int hue = w.GetElementalDamageHue();
                    if (hue > 0)
                    {
                        w.Hue = hue;
                    }
                }
                #region Mondain's Legacy
                else if (item is BaseShield)
                {
                    BaseShield shield = (BaseShield)item;

                    shield.Resource = resource;

                    switch (resource)
                    {
                    case CraftResource.Ash:
                        shield.ArmorAttributes.LowerStatReq += 20;
                        break;

                    case CraftResource.Yew:
                        shield.Attributes.RegenHits += 1;
                        break;

                    case CraftResource.Heartwood:
                        switch (Utility.Random(7))
                        {
                        case 0: shield.Attributes.BonusDex += 2; break;

                        case 1: shield.Attributes.BonusStr += 2; break;

                        case 2: shield.Attributes.ReflectPhysical += 5; break;

                        case 3: shield.Attributes.SpellChanneling = 1; shield.Attributes.CastSpeed = -1; break;

                        case 4: shield.ArmorAttributes.SelfRepair += 2; break;

                        case 5: shield.PhysicalBonus += 5; break;

                        case 6: shield.ColdBonus += 3; break;
                        }
                        break;

                    case CraftResource.Bloodwood:
                        shield.Attributes.RegenHits += 2;
                        shield.Attributes.Luck      += 40;
                        break;

                    case CraftResource.Frostwood:
                        shield.Attributes.SpellChanneling = 1;
                        shield.Attributes.CastSpeed       = -1;
                        break;
                    }
                }
                #endregion
                else if (item is BaseArmor)                             //Sanity
                {
                    ((BaseArmor)item).Resource = resource;

                    #region Mondain's Legacy
                    BaseArmor armor = (BaseArmor)item;

                    if (resource != CraftResource.Heartwood)
                    {
                        armor.Attributes.WeaponDamage   += attributes.ArmorDamage;
                        armor.Attributes.AttackChance   += attributes.ArmorHitChance;
                        armor.Attributes.RegenHits      += attributes.ArmorRegenHits;
                        armor.ArmorAttributes.MageArmor += attributes.ArmorMage;
                    }
                    else
                    {
                        switch (Utility.Random(5))
                        {
                        case 0: armor.Attributes.WeaponDamage += attributes.ArmorDamage; break;

                        case 1: armor.Attributes.AttackChance += attributes.ArmorHitChance; break;

                        case 2: armor.ArmorAttributes.MageArmor += attributes.ArmorMage; break;

                        case 3: armor.Attributes.Luck += attributes.ArmorLuck; break;

                        case 4: armor.ArmorAttributes.LowerStatReq += attributes.ArmorLowerRequirements; break;
                        }
                    }
                    #endregion
                }

                break;
            }

            case EnhanceResult.Failure:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                break;
            }
            }

            return(res);
        }
Пример #60
0
        public override bool CanEquip(Mobile from)
        {
            if (BlessedBy != null && BlessedBy != from)
            {
                from.SendLocalizedMessage(1075277); // That item is blessed by another player.
                return(false);
            }

            if (from.IsPlayer())
            {
                if (_Owner != null && _Owner != from)
                {
                    from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                    return(false);
                }

                if (this is IAccountRestricted && ((IAccountRestricted)this).Account != null)
                {
                    Accounting.Account acct = from.Account as Accounting.Account;

                    if (acct == null || acct.Username != ((IAccountRestricted)this).Account)
                    {
                        from.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item.
                        return(false);
                    }
                }

                if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(from))
                {
                    from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                    return(false);
                }
            }

            if (from.AccessLevel < AccessLevel.GameMaster)
            {
                bool morph = from.FindItemOnLayer(Layer.Earrings) is MorphEarrings;

                if (from.Race == Race.Gargoyle && !CanBeWornByGargoyles)
                {
                    from.SendLocalizedMessage(1111708); // Gargoyles can't wear
                    return(false);
                }
                else if (RequiredRace != null && from.Race != RequiredRace && !morph)
                {
                    if (RequiredRace == Race.Elf)
                    {
                        from.SendLocalizedMessage(1072203); // Only Elves may use
                    }
                    else if (RequiredRace == Race.Gargoyle)
                    {
                        from.SendLocalizedMessage(1111707); // Only gargoyles can wear
                    }
                    else
                    {
                        from.SendMessage("Only {0} may use ", RequiredRace.PluralName);
                    }

                    return(false);
                }
            }

            return(base.CanEquip(from));
        }