//Dictionary<int, EquipData> edDic = new Dictionary<int, EquipData>(); //ItemEquip item; //List<BackpackEquipVO> list = new List<BackpackEquipVO>(); //Dictionary<int, BackpackEquipVO> equipDic = new Dictionary<int, BackpackEquipVO>(); //Dictionary<int, BackpackEquipVO> allDic = new Dictionary<int, BackpackEquipVO>(); //List<HeroDataVO> equipList = new List<HeroDataVO>(); //string[] equipS; //装备ID //int site; //装备位 #endregion void Awake() { instance = this; for (int i = 1; i <= 6; i++) { equip.Add(transform.FindChild("Equip" + i).GetComponent <ItemEquip>()); itemEquipDicI.Add(i, transform.FindChild("Equip" + i).GetComponent <ItemEquip>()); //取装备位置 } obj = new object[FSDataNodeTable <HeroAttrNode> .GetSingleton().DataNodeList.Count]; objDic = FSDataNodeTable <HeroAttrNode> .GetSingleton().DataNodeList; int index = 0; foreach (object hn in objDic.Values) { if (index < obj.Length) { obj[index] = hn; index++; } } for (int i = 0; i < obj.Length; i++) { HeroAttrNode herodata = (HeroAttrNode)obj[i]; if (!herodataDic.ContainsKey(herodata.id)) { herodataDic.Add(herodata.id, herodata); } equipAllList.Add(herodata); } jinjieEffect = transform.Find("UI_YXJJ_01"); }
/// <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); } }
/// <summary> /// 获取指定类型的主属性值(力敏智三者之一) | /// 计算公式:基础值+星级成长系数*英雄等级+装备加成+buff值 /// </summary> public static float GetAProperty(HeroData hd, AttrType type) { HeroAttrNode heroAttr = (HeroAttrNode)hd.attrNode; float baseAtttrVal = 0f; if (type == AttrType.power) { baseAtttrVal = heroAttr.power; } else if (type == AttrType.intelligence) { baseAtttrVal = heroAttr.intelligence; } else if (type == AttrType.agility) { baseAtttrVal = heroAttr.agility; } return(baseAtttrVal + heroAttr.heroNode.GetStarGrowUpRate((int)type, hd.star) * hd.lvl + hd.equipTotalAttrs[(int)type] + GetAttr(hd.buffAttrs, type)); }
void PlayAppearedAnim(GameObject model, HeroAttrNode heroAttr = null) { ani = model.GetComponent <Animator>(); cs = UnityUtil.AddComponetIfNull <CharacterState>(model); if (type == AnimType.Run) { ani.SetInteger("Speed", 1); } else if (type == AnimType.Appeared) { Appeared = Animator.StringToHash("Base.Chuchang"); if (ani.HasState(ani.GetLayerIndex("Base"), Appeared)) { ani.SetTrigger("Appeared"); } } type = AnimType.None; if (heroAttr != null && heroAttr.heroNode != null) { cs.mAmountDlg = heroAttr.heroNode.dlgAmount; } }