package engine.gameManager;

import engine.objects.Guild;

public class ZergManager {

    public static int getBaneCap(Guild guild) {
        int cityRank = guild.getOwnedCity().getTOL().getRank();
        return (cityRank == 8) ? 20 : ((guild.getNation().getSubGuildList().size() + 1 <= 4) ? 10 : 20);
    }

    public static float getCurrentMultiplier(int count, int maxCount){
        switch(maxCount) {
            case 3:
                return getMultiplier3Man(count);
            case 5:
                return getMultiplier5Man(count);
            case 10:
                return getMultiplier10Man(count);
            case 20:
                return getMultiplier20Man(count);
            default:
                return getMultiplier40Man(count);
        }
    }
    public static float getMultiplier(int count, int maxCount, float[] thresholds) {
        if (count <= maxCount) return 1.0f;
        if (count > thresholds.length) return 0.0f;
        return 1.0f - thresholds[count - maxCount - 1];
    }

    public static float getMultiplier3Man(int count) {
        float[] thresholds = {0.37f, 0.60f, 0.75f};
        return getMultiplier(count, 3, thresholds);
    }

    public static float getMultiplier5Man(int count) {
        float[] thresholds = {0.25f, 0.43f, 0.56f, 0.67f, 0.75f};
        return getMultiplier(count, 5, thresholds);
    }

    public static float getMultiplier10Man(int count) {
        float[] thresholds = {0.14f, 0.25f, 0.35f, 0.43f, 0.50f, 0.56f, 0.62f, 0.67f, 0.71f, 0.75f};
        return getMultiplier(count, 10, thresholds);
    }

    public static float getMultiplier20Man(int count) {
        return getMultiplier10Man(count * 2);
    }

    public static float getMultiplier40Man(int count) {
        return getMultiplier10Man(count * 4);
    }
}