Ejemplo n.º 1
0
		public override bool OnEquip( Mobile from )
		{
			from.CheckStatTimers();

			Misc.Titles.AwardKarma( from, -20, true ); // todo: verify

			return base.OnEquip( from );
		}
Ejemplo n.º 2
0
        public static void AddContext( Mobile m, AnimalFormContext context )
        {
            m_Table[m] = context;

            if ( context.Type == typeof( BakeKitsune ) || context.Type == typeof( GreyWolf ) )
                m.CheckStatTimers();
        }
Ejemplo n.º 3
0
		public void RemoveStatBonuses( Mobile from )
		{
			string modName = Owner.Serial.ToString();

			from.RemoveStatMod( modName + "Str" );
			from.RemoveStatMod( modName + "Dex" );
			from.RemoveStatMod( modName + "Int" );

			from.CheckStatTimers();
		}
Ejemplo n.º 4
0
		public void AddStatBonuses( Mobile to )
		{
			int strBonus = BonusStr;
			int dexBonus = BonusDex;
			int intBonus = BonusInt;

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

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

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

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

			to.CheckStatTimers();
		}
Ejemplo n.º 5
0
		public static void AddStatBonuses( Mobile to, Item item, int str, int dex, int intel )
		{			
			if ( (str != 0 || dex != 0 || intel != 0) )
			{		
				string modName = item.Serial.ToString();

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

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

				if ( intel != 0 )
					to.AddStatMod( new StatMod( StatType.Int, modName + "SetInt", intel, TimeSpan.Zero ) );
			}
			
			to.CheckStatTimers();
		}
Ejemplo n.º 6
0
		public static void RemoveStatBonuses( Mobile from, Item item )
		{			
			string modName = item.Serial.ToString();
			
			from.RemoveStatMod( modName + "SetStr" );
			from.RemoveStatMod( modName + "SetDex" );
			from.RemoveStatMod( modName + "SetInt" );
			
			from.Delta( MobileDelta.Armor );
			from.CheckStatTimers();
		}
Ejemplo n.º 7
0
        public static MorphResult Morph( Mobile m, int entryID )
        {
            if ( entryID < 0 || entryID >= m_Entries.Length )
                return MorphResult.Fail;

            AnimalFormEntry entry = m_Entries[entryID];

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

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

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

            double ninjitsu = m.Skills.Ninjitsu.Value;

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

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

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

            BaseMount.Dismount( m );

            m.BodyMod = entry.BodyMod;

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

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

            SkillMod mod = null;

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

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

            AddContext( m, new AnimalFormContext( timer, mod, entry.SpeedBoost, entry.Type ) );
            m.CheckStatTimers();
            return MorphResult.Success;
        }
Ejemplo n.º 8
0
		public void ApplyStatBonuses(Mobile wearer, StatType stat)
		{
			// BE CAREFUL! This function is an event handler for Mobile.StatChange. AddStatMod invokes StatChange - ie, the potential here for an
			// infinite recursion loop is VERY real. Make sure that you do not make stats interdependant on bonuses!!!
			// ie when calculating DexBonus, you can use Str or Int but using Dex will cause a loop.
			// using Str in calc'ing DexBonus and ALSO using Dex in calc'ing StrBonus will also cause a loop.
			// See examples.
			wearer.CheckStatTimers();

			string modName = this.Serial.ToString();

			/* EXAMPLES
			 * 
			 * if ((stat & StatType.Dex) != 0)
			 * {
			 *	   Here I can add statmods for Str and Int but not Dex.
			 * }
			 * if ((stat & StatType.Int) != 0 && (stat & StatType.Str) != 0)
			 * {
			 *     Here I can only add statmods for Dex, because the calculation is using Int and Str
			 * }
			 */
			
			if ((stat & StatType.Str) != 0) // since we're handling Str, we're not allowed to modify it
			{
				double dexBonus = ComputeStatBonus( StatType.Dex, wearer );
				if (dexBonus != 0  && (wearer.GetStatMod(modName + "Dex") == null || wearer.GetStatMod(modName + "Dex").Offset != dexBonus))
					wearer.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );
				if (dexBonus == 0)
					wearer.RemoveStatMod(modName + "Dex");
			}
		}
Ejemplo n.º 9
0
        /// <summary>
        /// Removes the mobile and/or attributes from the dictionary
        /// </summary>
        /// <param name="m"></param>
        /// <param name="title">null or default value will remove the entire entry. Add the title arg to remove only that element from the list.</param>
        /// <returns></returns>
        public static bool RemoveMobile(Mobile m, string title = null)
        {
            if (EnhancementList.ContainsKey(m))
            {
                if (title != null)
                {
                    EnhancementAttributes match = null;

                    for (var index = 0; index < EnhancementList[m].Count; index++)
                    {
                        var attrs = EnhancementList[m][index];

                        if (attrs.Title == title)
                        {
                            match = attrs;
                            break;
                        }
                    }

                    if (match != null && EnhancementList[m].Contains(match))
                    {
                        if (match.Attributes.BonusStr > 0)
                        {
                            m.RemoveStatMod("MagicalEnhancementStr");
                        }

                        if (match.Attributes.BonusDex > 0)
                        {
                            m.RemoveStatMod("MagicalEnhancementDex");
                        }

                        if (match.Attributes.BonusInt > 0)
                        {
                            m.RemoveStatMod("MagicalEnhancementInt");
                        }

                        EnhancementList[m].Remove(match);
                    }
                }

                if (EnhancementList[m].Count == 0 || title == null)
                {
                    EnhancementList.Remove(m);
                }

                m.CheckStatTimers();
                m.UpdateResistances();
                m.Delta(MobileDelta.Stat | MobileDelta.WeaponDamage | MobileDelta.Hits | MobileDelta.Stam | MobileDelta.Mana);

                for (var index = 0; index < m.Items.Count; index++)
                {
                    var i = m.Items[index];

                    i.InvalidateProperties();
                }

                return(true);
            }

            return(false);
        }