当前位置: 首页>>代码示例>>C#>>正文


C# CraftItem.GetSuccessChance方法代码示例

本文整理汇总了C#中Server.Engines.Craft.CraftItem.GetSuccessChance方法的典型用法代码示例。如果您正苦于以下问题:C# CraftItem.GetSuccessChance方法的具体用法?C# CraftItem.GetSuccessChance怎么用?C# CraftItem.GetSuccessChance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Engines.Craft.CraftItem的用法示例。


在下文中一共展示了CraftItem.GetSuccessChance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCraft

		public virtual int OnCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			int magery = from.Skills.Magery.BaseFixedPoint;

			if (makersMark)
			{
				Crafter = from;
			}

			m_Quality = (BookQuality)(quality - 1);

			if (craftItem.Recipe != null && craftItem.Recipe.ID == 1001) //Full spellbook
			{
				Content = ulong.MaxValue;

				bool allRequiredSkills = true;
				double chance = craftItem.GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
				double excepChance = craftItem.GetExceptionalChance(craftSystem, chance, from);

				double blessChance = excepChance / 3.0;
				if (blessChance < 0.025 && from.Skills[SkillName.Inscribe].Value >= 100.0)
				{
					blessChance = 0.025;
				}

				if (Crafter != null && m_Quality == BookQuality.Exceptional && blessChance > Utility.RandomDouble())
				{
					LootType = LootType.Blessed;
				}
			}

			return quality;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:41,代码来源:Spellbook.cs

示例2: DoCraft

        public static void DoCraft( Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantPigment pigments )
        {
            CraftContext context = system.GetContext( from );

            if ( context != null )
                context.OnMade( craftItem );

            bool allRequiredSkills = true;

            double chance = craftItem.GetSuccessChance( from, typeRes, system, true, ref allRequiredSkills );

            if ( chance > 0.0 )
                chance += craftItem.GetTalismanBonus( from, system );

            if ( allRequiredSkills )
            {
                pigments.Consume();

                if ( chance < Utility.RandomDouble() )
                {
                    from.SendGump( new CraftGump( from, system, tool, 1044043 ) ); // You failed to create the item, and some of your materials are lost.
                }
                else
                {
                    from.Backpack.ConsumeTotal( typeof( ColorFixative ), 1 );

                    bool toolBroken = false;

                    tool.UsesRemaining--;

                    if ( tool.UsesRemaining < 1 )
                        toolBroken = true;

                    if ( toolBroken )
                    {
                        tool.Delete();

                        from.SendLocalizedMessage( 1044038 ); // You have worn out your tool!
                        from.SendLocalizedMessage( 1044154 ); // You create the item.
                    }
                    else
                    {
                        // You create the item.
                        from.SendGump( new CraftGump( from, system, tool, 1044154 ) );
                    }

                    from.AddToBackpack( new NaturalDye( pigments.PlantHue ) );
                }
            }
            else
            {
                // You don't have the required skills to attempt this item.
                from.SendGump( new CraftGump( from, system, tool, 1044153 ) );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:55,代码来源:NaturalDye.cs


注:本文中的Server.Engines.Craft.CraftItem.GetSuccessChance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。