/// <summary> /// 获取装备的武器 /// </summary> public ItemBase GetEquipWeapon() { ItemBase weapon = null; foreach (uint uid in equips) { ItemBase item = ItemBase.FindItem(uid); if (item.staticData.type == ItemType.Weapon) { weapon = item; break; } } return(weapon); }
// 只有武器装备加的攻击距离会生效,其他装备的都不会生效 // 注意,不要给装备赋予魔力和力量属性,装备属性要在最后计算,因为要计算发挥,需要先结算完其他buff增加的属性 // 攻击速度等于武器的发挥 攻击距离等于武器的攻击距离 // 移动速度 等于 力量 * (int)ItemType.EquipEnd / 装备总重量 private void AddEquipAttribute() { double equipWeight = 0; double speed = 1; foreach (uint uid in equips) { ItemBase item = ItemBase.FindItem(uid); equipWeight += item.weight; // 计算重量发挥和能量发挥 double weightPlay = CalculationPlay(Strength, item.weight, true); double energyPlay = CalculationPlay(Magic, item.energy, false); if (item.staticData.type == ItemType.Weapon) { attackDistance = (float)item.attackDistance; attackSpeed = (float)weightPlay; } Defence += (int)(item.defence * weightPlay); MaxHP += (int)(item.hp * weightPlay); MaxSP += (int)(item.sp * weightPlay); fireDamage += (int)(item.fireDamage * weightPlay); iceDamage += (int)(item.iceDamage * weightPlay); electricityDamage += (int)(item.electricityDamage * weightPlay); poisonDamage += (int)(item.poisonDamage * weightPlay); fireAppend += (int)(item.fireAppend * weightPlay); iceAppend += (int)(item.iceAppend * weightPlay); electricityAppend += (int)(item.electricityAppend * weightPlay); poisonAppend += (int)(item.poisonAppend * weightPlay); fireResistance += (int)(item.fireResistance * weightPlay); iceResistance += (int)(item.iceResistance * weightPlay); electricityResistance += (int)(item.electricityResistance * weightPlay); poisonResistance += (int)(item.poisonResistance * weightPlay); speed += (item.speed * weightPlay); } attackDistance = (float)(attackDistance * speed); attackSpeed = (float)(attackSpeed * speed); moveSpeed = (float)(Strength * (int)ItemType.EquipEnd / equipWeight * speed); }