Exemple #1
0
    void CreatBullockCarts(int monsterid, float lvl, float scale = 1)
    {
        MonsterAttrNode node = FSDataNodeTable <MonsterAttrNode> .GetSingleton().FindDataByType(monsterid);

        if (null == node)
        {
            Debug.Log("huoche id not found.");
            return;
        }
        cart = Resource.CreatPrefabs(node.icon_name, bullockCarts, Vector3.zero, GameLibrary.NPC_URL);
        if (null == cart)
        {
            cart = Resource.CreatPrefabs(node.icon_name, bullockCarts, Vector3.zero, GameLibrary.Monster_URL);
        }
        if (null == cart)
        {
            cart = Resource.CreatPrefabs(node.icon_name, bullockCarts, Vector3.zero, GameLibrary.Hero_URL);
        }
        if (null == cart)
        {
            Debug.Log("Cart is null.");
            return;
        }
        cart.gameObject.layer     = CharacterManager.player.gameObject.layer;
        cart.transform.localScale = Vector3.one * scale;
        SetBullockCarts(node.id, lvl);
    }
Exemple #2
0
    /// <summary>
    /// 计算指定类型的二级属性最终值(二级属性包括生命、攻击、护甲、魔抗、暴击、护甲穿透、魔法穿透、韧性、闪避、命中、吸血) |
    /// 属性分服务器和本地两套,服务器属性从serverAttrs里取,本地属性根据配表自行计算 |
    /// 英雄属性计算公式:基础值+对应主属性值*属性加成率 |
    /// 怪物属性计算公式:基础值+等级成长*等级+buff值
    /// </summary>
    public static float GetSingleAttribute(CharacterData characterData, AttrType type)
    {
        if (characterData is HeroData)
        {
            HeroData     hd           = (HeroData)characterData;
            HeroAttrNode heroAttrNode = (HeroAttrNode)characterData.attrNode;
            switch (type)
            {
            case AttrType.hp:
                return(CalcServerOrLocalAttr(hd, type, AttrType.power, 23.5f));

            case AttrType.attack:
                // 攻击力=(主属性+敏捷*0.5)*9+(初始值+装备)
                float servMainAttr  = GetAttr(hd.serverAttrs, type) + 9 * (GetAttr(hd.buffAttrs, (AttrType)(heroAttrNode.heroNode.attribute - 1)) + 0.5f * GetAttr(hd.buffAttrs, AttrType.agility)) + GetAttr(hd.buffAttrs, type);
                float localMainAttr = 9 * (GetAProperty(hd, (AttrType)(heroAttrNode.heroNode.attribute - 1)) + 0.5f * GetAProperty(hd, AttrType.agility)) + GetBProperty(hd, type);
                return(characterData.useServerAttr ? servMainAttr : localMainAttr + GetAttr(hd.buffAttrs, type));

            case AttrType.armor:
                return(CalcServerOrLocalAttr(hd, type, AttrType.agility, 3.6f));

            case AttrType.magic_resist:
                return(CalcServerOrLocalAttr(hd, type, AttrType.intelligence, 6.6f));

            case AttrType.critical:
                return(CalcServerOrLocalAttr(hd, type, AttrType.agility, 2.25f));

            case AttrType.armor_penetration:
                return(CalcServerOrLocalAttr(hd, type, AttrType.agility, 1.8f));

            case AttrType.magic_penetration:
                return(CalcServerOrLocalAttr(hd, type, AttrType.intelligence, 3.3f));

            case AttrType.tenacity:
                return(CalcServerOrLocalAttr(hd, type, AttrType.power, 1.25f));

            default:
                return(characterData.useServerAttr ? (GetAttr(hd.serverAttrs, type) + GetAttr(hd.buffAttrs, type)) : (GetBProperty(hd, type) + GetAttr(hd.buffAttrs, type)));
            }
        }
        else
        {
            if (characterData != null)//野外打怪会报错
            {
                MonsterAttrNode maNode      = (MonsterAttrNode)characterData.attrNode;
                MonsterData     monsterData = (MonsterData)characterData;
                return(GetAttr(maNode.attrLvRates, type) * (monsterData.lvlRate != 0 ? monsterData.lvlRate : characterData.lvl) + GetAttr(maNode.base_Propers, type) + GetAttr(characterData.buffAttrs, type));
            }
            return(0);
        }
    }