/// <summary> /// 计算强度 /// </summary> private static float CalcIntensity(s_building_typeInfo TypeInfo, s_buildstarInfo StarInfo, s_buildstarInfo original, s_buildqualityInfo QualityInfo, int level) { if (TypeInfo == null) { return(0); } float value = TypeInfo.intensity * 0.01f; if (StarInfo != null) { value += StarInfo.intensitygrow * (level - 1) * 0.01f; } if (original != null) { value += (StarInfo.intensitygrow - original.intensitygrow) * 0.01f; } if (QualityInfo != null) { value += QualityInfo.addintensity * 0.01f; } return(value); }
/// <summary> /// 填充基础建筑信息 /// </summary> private static void CalcStageBuildInfo(s_stagebuildInfo I, ref BuildInfo Info) { if (I == null || Info == null) { return; } //获取技能 Info.m_Skill = GetSkill(Info.BuildType, Info.Quality); s_buildstarInfo StarInfo = GetBuildStar(Info.BuildType, Info.StarLevel); s_buildqualityInfo QualityInfo = GetBuildQuality(Info.BuildType, Info.Quality); int originalStar = buildingM.GetMinBuildStar(Info.BuildType); s_buildstarInfo oriInfo = buildingM.GetBuildStar(Info.BuildType, originalStar); //建筑物三围 //Info.m_Solidity = CalcSolidity(I, StarInfo, oriInfo, QualityInfo, Info.Level); //Info.m_Intensity = CalcIntensity(I, StarInfo, oriInfo, QualityInfo, Info.Level); //Info.m_Tenacity = CalcTenacity(I, StarInfo, oriInfo, QualityInfo, Info.Level); Info.m_hp = I.hp; Info.m_phyattack = I.phy_attack; Info.m_magicattack = I.magic_attack; Info.m_phydefend = I.physicaldefend; Info.m_magicdefend = I.magicdefend; Info.m_DefensePower = CalcDefendPower(Info.Quality, Info.StarLevel, Info.Level); Info.m_bear = I.bear; }
/// <summary> /// 填充基础建筑信息 /// </summary> private static void CalcBuildInfo(s_building_typeInfo I, ref BuildInfo Info) { if (I == null || Info == null) { return; } //获取技能 Info.m_Skill = GetSkill(Info.BuildType, Info.Quality); s_buildstarInfo StarInfo = GetBuildStar(Info.BuildType, Info.StarLevel); s_buildqualityInfo QualityInfo = GetBuildQuality(Info.BuildType, Info.Quality); int originalStar = buildingM.GetMinBuildStar(Info.BuildType); s_buildstarInfo oriInfo = buildingM.GetBuildStar(Info.BuildType, originalStar); //建筑物三围 Info.m_Solidity = CalcSolidity(I, StarInfo, oriInfo, QualityInfo, Info.Level); Info.m_Intensity = CalcIntensity(I, StarInfo, oriInfo, QualityInfo, Info.Level); Info.m_Tenacity = CalcTenacity(I, StarInfo, oriInfo, QualityInfo, Info.Level); Info.m_hp = CalcHp(I, QualityInfo, Info.m_Solidity); Info.m_phyattack = CalcPhyAttack(I, QualityInfo, Info.m_Intensity); Info.m_magicattack = CalcMagAttack(I, QualityInfo, Info.m_Intensity); Info.m_phydefend = CalcPhyDefend(I, QualityInfo, Info.m_Tenacity); Info.m_magicdefend = CalcMagDefend(I, QualityInfo, Info.m_Tenacity); Info.m_DefensePower = CalcDefendPower(Info.Quality, Info.StarLevel, Info.Level); Info.m_bear = CalcBear(I, StarInfo, QualityInfo); }
/// <summary> /// 获取升星所需资源 /// </summary> /// <param name="BuildType">类型</param> /// <param name="Star">星级</param> /// <param name="NeedMaterial">需要材料,key item id,value 数量</param> /// <param name="Star">建筑星级</param> /// <returns>建筑数据,null 获取失败</returns> public static void GetUpStarNeed(int BuildType, int Star, ref int fragmentNum, ref int Coin) { Coin = 0; s_buildstarInfo Info = GetBuildStar(BuildType, Star); if (Info != null) { Coin = Info.coin; fragmentNum = Info.num; } }
/// <summary> /// 获取建筑星级成长 /// </summary> /// <param name="Info">建筑数据</param> /// <param name="SolidityGrow">硬度成长</param> /// <param name="IntensityGrow">强度成长</param> /// <param name="TenacityGrow">韧性成长</param> public static void GetStarInfoGrow(BuildInfo Info, ref float SolidityGrow, ref float IntensityGrow, ref float TenacityGrow) { SolidityGrow = 0; IntensityGrow = 0; TenacityGrow = 0; if (Info == null) { return; } s_buildstarInfo I = GetBuildStar(Info.BuildType, Info.StarLevel); if (I != null) { SolidityGrow = I.soliditygrow * 0.01f; IntensityGrow = I.intensitygrow * 0.01f; TenacityGrow = I.tenacitygrow * 0.01f; } }
/// <summary> /// 计算承受力 /// </summary> private static int CalcBear(s_building_typeInfo TypeInfo, s_buildstarInfo StarInfo, s_buildqualityInfo QualityInfo) { if (TypeInfo == null) { return(0); } int value = TypeInfo.bear; if (StarInfo != null) { value += StarInfo.bear; } if (QualityInfo != null) { value += QualityInfo.bear; } return(value); }