public static int GetAdvanceCost(SacrificeCostGrowth growthMode, int tier, float costBase, float growthFactor, int startTier) { if (tier == -1 || tier == 9) { return(-1); } return(CalculateBaseCost(growthMode, tier, costBase, growthFactor, startTier)); }
/// <summary> /// Gets the cost of going up tiers according to formula. /// Cost is that of bloodstones. /// </summary> /// <param name="tier">The current tier of soul reap.</param> /// <returns>The base cost of leveling up soul reap, in bloodstones.</returns> protected static int CalculateBaseCost(SacrificeCostGrowth growthMode, int tier, float costBase, float growthFactor, int startTier) { var tierDiff = Math.Max(0, tier - startTier); switch (growthMode) { case SacrificeCostGrowth.Linear: return((int)(costBase + tierDiff * growthFactor)); case SacrificeCostGrowth.Exponential: return((int)(costBase * Math.Max(1, (int)Math.Pow(growthFactor, tierDiff)))); case SacrificeCostGrowth.Quadratic: return((int)(costBase + costBase * tierDiff * tierDiff)); default: return(0); } }