コード例 #1
0
        //    // 强化需求 [7/19/2011 ivan edit]
        //public Item_Enhance Get_Equip_EnhanceLevel( int nIndexPacket)
        public Item_Enhance Get_Equip_EnhanceLevel(CObject_Item My_Equip)
        {
            Item_Enhance itemEnhance = new Item_Enhance();

            if (My_Equip == null || My_Equip.GetItemClass() != ITEM_CLASS.ICLASS_EQUIP)
            {
                return(itemEnhance);
            }
            CObject_Item_Equip equip = My_Equip as CObject_Item_Equip;

            if (equip == null)
            {
                return(itemEnhance);
            }

            int enhanceID = equip.GetStrengthIndex();
            _DBC_ITEM_ENHANCE pItemEnhance = ObjectSystem.EquipEnchanceDBC.Search_Index_EQU((int)enhanceID);

            if (pItemEnhance == null)
            {
                return(itemEnhance);
            }

            _DBC_ITEM_ENCHANCE_RATE pItemEnchanceRate = ObjectSystem.EquipEnchanceRateDBC.Search_Index_EQU(equip.GetCurrentDangCi());
            float fRatio = pItemEnchanceRate.nDangCiRatio / 100.0f;

            pItemEnchanceRate = ObjectSystem.EquipEnchanceRateDBC.Search_Index_EQU((int)equip.GetItemType());
            fRatio           *= pItemEnchanceRate.nEquipPointRatio / 100.0f;

            itemEnhance.needMoney = (int)(fRatio * pItemEnhance.needMoney + 0.5f);

            itemEnhance.addProperty = pItemEnhance.attribute[0];// 因为增加属性的百分比都一样,所以只获取一个就够了[7/19/2011 ivan edit]

            return(itemEnhance);
        }
コード例 #2
0
        /// <summary>
        /// 消耗道具是否足够
        /// </summary>
        /// <param name="oResult">失败时返回缺少道具</param>
        /// <returns>true,消耗品足够</returns>
        public override bool checkDeplete(out string oResult)
        {
            oResult = null;
            if (mEquip == null)
            {
                throw new Exception("The equip is null: checkDeplete()");
            }

            int enhanceID = mEquip.GetStrengthIndex();
            _DBC_ITEM_ENHANCE pItemEnhance = ObjectSystem.EquipEnchanceDBC.Search_Index_EQU((int)enhanceID);

            if (pItemEnhance == null)
            {
                return(true);
            }
            if (pItemEnhance.needMoney <= CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Money())
            {
                return(true);
            }
            else
            {
                oResult = "#{Money_Not_Enough}";
            }

            return(true);
        }
コード例 #3
0
        /// <summary>
        /// 获取成就几率
        /// </summary>
        /// <returns></returns>
        public override float getSucessRate()
        {
            if (mEquip == null)
            {
                throw new Exception("The equip is null: getSucessRate()");
            }

            int enhanceID = mEquip.GetStrengthIndex();
            _DBC_ITEM_ENHANCE pItemEnhance = ObjectSystem.EquipEnchanceDBC.Search_Index_EQU((int)enhanceID);

            if (pItemEnhance != null)
            {
                return(pItemEnhance.successRate);
            }

            return(0);
        }
コード例 #4
0
    float CaclStrendthValue(byte attrType, int nEquipPoint, int nLevel)
    {
        if (nLevel == 0)
        {
            return(1.0f);
        }
        int nId = nEquipPoint * 110 + nLevel;
        _DBC_ITEM_ENHANCE enchanceDBC = ObjectSystem.EquipEnchanceDBC.Search_Index_EQU(nId);

        if (enchanceDBC == null)
        {
            throw new NullReferenceException("EquipEnchance id not found: " + nId);
        }
        int nRate = enchanceDBC.attribute[attrType];

        //强化公式
        return(1.0f + nLevel * nRate * 0.01f);
    }