feat: add BasePower abstraction
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
namespace Cs2SuperPowers;
|
||||
|
||||
public static class GlobalConfig
|
||||
{
|
||||
public static bool NoDelayEnabled { get; set; } = false;
|
||||
|
||||
// Boost levels stack linearly: level 0 = base value, level 1 = 2x, level 2 = 3x, etc.
|
||||
public static int GrenadeLauncherBoostLevel { get; set; } = 0;
|
||||
public static int NotSoDecoyBoostLevel { get; set; } = 0;
|
||||
public static int AirStrikeBoostLevel { get; set; } = 0;
|
||||
public static int DroppedNadesBoostLevel { get; set; } = 0;
|
||||
|
||||
public static int GetGrenadeLauncherCount(int baseCount)
|
||||
{
|
||||
return GetBoostedCount(baseCount, GrenadeLauncherBoostLevel);
|
||||
}
|
||||
|
||||
public static int GetNotSoDecoyCount(int baseCount)
|
||||
{
|
||||
return GetBoostedCount(baseCount, NotSoDecoyBoostLevel);
|
||||
}
|
||||
|
||||
public static int GetAirStrikeCount(int baseCount)
|
||||
{
|
||||
return GetBoostedCount(baseCount, AirStrikeBoostLevel);
|
||||
}
|
||||
|
||||
public static int GetDroppedNadesCount(int baseCount)
|
||||
{
|
||||
return GetBoostedCount(baseCount, DroppedNadesBoostLevel);
|
||||
}
|
||||
|
||||
private static int GetBoostedCount(int baseCount, int level)
|
||||
{
|
||||
if (baseCount <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (level <= 0)
|
||||
{
|
||||
return baseCount;
|
||||
}
|
||||
|
||||
long boostedCount = (long)baseCount * (level + 1L);
|
||||
return boostedCount > int.MaxValue ? int.MaxValue : (int)boostedCount;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user