Example #1
0
		public override bool OnEquip( Mobile from )
		{
			from.CheckStatTimers();

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

			return base.OnEquip( from );
		}
Example #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();
        }
		public void RemoveStatBonuses( Mobile from )
		{
			string modName = Owner.Serial.ToString();

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

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

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

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

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

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

			to.CheckStatTimers();
		}
Example #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();
		}
Example #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();
		}
Example #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;
        }
Example #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");
			}
		}