當前位置: 首頁>>代碼示例>>C#>>正文


C# CraftItem.GetTalismanBonus方法代碼示例

本文整理匯總了C#中Server.Engines.Craft.CraftItem.GetTalismanBonus方法的典型用法代碼示例。如果您正苦於以下問題:C# CraftItem.GetTalismanBonus方法的具體用法?C# CraftItem.GetTalismanBonus怎麽用?C# CraftItem.GetTalismanBonus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Engines.Craft.CraftItem的用法示例。


在下文中一共展示了CraftItem.GetTalismanBonus方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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.GetTalismanBonus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。